New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drag/Scale/Group-bug #1542

Closed
nkholski opened this Issue Jan 14, 2015 · 6 comments

Comments

7 participants
@nkholski
Copy link
Contributor

nkholski commented Jan 14, 2015

Sprites dragged within a scaled group will not follow in the same speed as the pointer that is dragging. It seems like the distance moved by the pointer is multiplied with the scale-value making the sprite go faster than the pointer if scale>1 and slower if scale<1. I've tested dragging both with the mouse and touch.

This fiddle is a modified example from examples.phaser.io demonstrating the bug:
http://jsfiddle.net/niklasberg/xxqad499/10
(I failed to get the images to load correctly and commented out the preload but the example proves it point even with the green boxes.)

Edit: I edited InputHandler.js and got the example to move in the same speed as the pointer, however the position starts a bit off and I haven't tested anything else but my specific case. Maybe it can be of use: http://jsfiddle.net/niklasberg/xxqad499/11/ (changes marked with "change"-comments). If I make any progress I'll post it here, but I'm not sure if I will be able to produce anything that could actually be merged.

@jf908

This comment has been minimized.

Copy link
Contributor

jf908 commented Apr 10, 2015

Can confirm, I ran into the same bug

@TimvdEijnden

This comment has been minimized.

Copy link
Contributor

TimvdEijnden commented Apr 17, 2015

You can solve this by creating a CustomInputHandler.

Override the startDrag & updateDrag

#inside the dragStart
this.dragOffset.x *= MyGame.scaleFactor;
this.dragOffset.y *= MyGame.scaleFactor;

#inside the updateDrag
px /= MyGame.scaleFactor
py /= MyGame.scaleFactor
@alamboley

This comment has been minimized.

Copy link

alamboley commented Apr 24, 2015

Same bug here too... :/

@samalexander

This comment has been minimized.

Copy link

samalexander commented Dec 4, 2015

Same issue here. Any solutions?

@62316e

This comment has been minimized.

Copy link

62316e commented Dec 21, 2015

?

@photonstorm

This comment has been minimized.

Copy link
Owner

photonstorm commented Feb 4, 2016

This is an unfortunate limitation of the current implementation. However I'm afraid there are no immediate plans to spend any more time on this trying to resolve it (we get so far, and then hit another wall, which means the whole system needs looking at really, which is beyond the scope for Phaser).

Anyone is welcome to submit a PR if you feel you can resolve it in a clean and relatively API friendly way.

@photonstorm photonstorm closed this Feb 4, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment