Skip to content
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

Draggable objects break when restarting a scene #4278

Closed
iArePJ opened this issue Jan 5, 2019 · 1 comment
Closed

Draggable objects break when restarting a scene #4278

iArePJ opened this issue Jan 5, 2019 · 1 comment

Comments

@iArePJ
Copy link

iArePJ commented Jan 5, 2019

Version

  • Phaser Version: 3.16.10 Beta 4
  • Operating system: Windows 10
  • Browser: Chrome

Description

Dragging an object works fine the first time the scene is created, but if you stop a scene and then start it again, you are no longer able to drag the object. I have tried both this.input.on() and gameObject.on() drag events.

Example Test Code

class Drag {
    create() {
        let image = this.add.image(50, 50, 'yes')
            .setInteractive();

        this.input.setDraggable(image);

        image.on('drag', function (pointer, x, y) {
            this.x = x;
            this.y = y;
        });
    }
}

Additional Information

Fix:
https://github.com/photonstorm/phaser/blob/master/src/input/InputPlugin.js#L2288
Change this line to

this._dragState = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
@photonstorm
Copy link
Collaborator

Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants