Comments (9)
Hi @ArgosOz, thanks for the bug report!
The editor camera controls are located in https://github.com/superpowers/superpowers-game/blob/master/SupEngine/src/components/Camera2DControls.ts and https://github.com/superpowers/superpowers-game/blob/master/SupEngine/src/components/Camera3DControls.ts
We don't have a Magic Trackpad so you're probably in the best position to diagnose and submit a fix, but we're willing to help if you have questions, of course.
Looking at this line, it looks like numpad plus and minus already allow zooming in and out.
from superpowers-core.
Hi @elisee,
Looking at this line, it looks like numpad plus and minus already allow zooming in and out.
Indeed it is :) Great.
I'd like to add an option for Mac users to use the function with cmd key, later sometime... Currently it uses control key and it works well enough.
I appreciate your work.
All the best.
from superpowers-core.
I am also having this issue on a Windows 10 laptop. Pinch to zoom however does work well, zooming at a much better speed. A workaround to this problem could be adding a toggle to make the two finger swipes pan the view rather than zooming? (Something I also noted is that horizontal two finger swipe also zooms rather than pans)
from superpowers-core.
I think I have a solution for this and happy to make a PR. The problem is twofolds:
- The trackpad can have a delta of 0 at the end of the scroll but still trigger an event
- The trackpad triggers 2 or 3 times more events than a mouse
A way to tackle this could be in Input.ts
in SupEngine and replace the OnMouseWheel
function with a throttled version as well as handling the delta === 0
case.
private onMouseWheelRealTime = (event: MouseWheelEvent) => {
event.preventDefault();
this.newScrollDelta = 0;
if ((event.wheelDelta || event.detail) !== 0) {
this.newScrollDelta = (event.wheelDelta > 0 || event.detail < 0) ? 1 : -1;
}
return false;
};
private onMouseWheel = throttle(this.onMouseWheelRealTime, 100);
Ideally, this.newScrollDelta = Math.sign(event.wheelData || event.detail)
but Math.sign
is ES6 only.
This seems to work for me and doesn't seem to impact the mouse (the 100 value can be tweaked but I think not under 75 if it's a little more sluggish).
My concern was around modifying the Input
not knowing the exact architecture of Superpowers. If that Input
class is reused elsewhere than the editor, it could be a problem for games that rely on the wheel and want to handle the stream of events themselves.
Otherwise, in Camera2DControls
we could throttle changeOrthographicScale
(instead of going to Input directly). However it would still require to handle de 0 value case in onMouseWheel
.
Let me know what you prefer and I can put together a PR.
from superpowers-core.
@elisee Hey! I'm keen to get this fixed quickly so I can really use the editor to its fullest. Is there anything I can do to speed up the process?
It seems like this is modifying superpowers-game
which is the default game system, so I suspect the Input
code is the one available under Sup.Input
. If so it's probably to stick to Camera2DControls
for the throttling and just fixed the 0 case in Input
. I can put together a PR with this if that's easier.
from superpowers-core.
@MathieuLoutre I will take a look at it soon. Feel free to submit a PR, even if we end up doing it differently, it's always useful to have a starting point!
from superpowers-core.
Great! Thanks! Will see if I can wrestle something this evening or tomorrow.
from superpowers-core.
@elisee I've made the PR on superpowers-game
as I believe it needed to be done there: superpowers/superpowers-game#132
Let me know if that was the wrong place somehow.
from superpowers-core.
Closing this in favor of superpowers/superpowers-game#123 and superpowers/superpowers-game#132 since this is related to Superpowers Game.
from superpowers-core.
Related Issues (20)
- Systematically disconnected when trying to modify a script HOT 3
- Server management cancel buttons are missing text HOT 1
- local rotations are global HOT 1
- Typescript error checking is extremely slow HOT 6
- Add superpowers to IndieDB HOT 1
- Attempting to edit script from cloned git repo results in being disconnected from server HOT 2
- Loadscreen - legal HOT 1
- Can not move in the scene editor HOT 1
- Why the software history was not kept? HOT 2
- Sup.exit() HOT 1
- Pas de prévisualisation sur serveur externe HOT 2
- Prevent creating a project if no system is installed.
- Error - only a single primitive is supported - Importing 3D asset. HOT 4
- Possible bug in ArcadeBody2D HOT 1
- Can't create a project: this server doesn't have any systems installed yet. HOT 2
- Linux Mint 18.1 64 bit can't use buttons/load graphics
- [FEATURE] game and editor is working on glitch
- Possible bug in installation (or installation tutorial) HOT 3
- Keep super powers alive
- Is the engine dead? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from superpowers-core.