Jump to content

Get original position when dragging with lockCenter


vulvulune
 Share

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

Link to comment
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?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...