Sign in to follow this  
vulvulune

Get original position when dragging with lockCenter

Recommended Posts

Hello,

Is there any way to get the original position of the sprite in the onDragStart event when the lockCenter is activated?

I would like to restore the position of the sprite if the user try to drop it in a wrong place, but the position of the sprite has already changed to be centered with the cursor when the onDragStart event is triggered, so in my opinion it's impossible to get the original position? (Except if I backup myself the position in my sprite object)

Maybe we should add a new param to the onDragStart event with the position of the sprite before the centering, or call the onDragStart event before the centering, but in this case we can create issues with existing codes. What do you think?

Vulvulune

Share this post


Link to post
Share on other sites

But I think it's pretty dangerous to move the "onDragStart" before, maybe in some projects people use the x,y,z in this event and these values won't be the same.

Maybe add a new param "originalPosition: Phaser.Point" in the event is a best way?

What do you think rich?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.