vulvulune Posted January 27, 2015 Share Posted January 27, 2015 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 More sharing options...
redsheep Posted January 27, 2015 Share Posted January 27, 2015 The problem is happened because "onDragStart" event is fired after startDrag(centering).check the implement of InputHandler http://docs.phaser.io/InputHandler.js.html#sunlight-1-line-1241 I agree with you, It's kind of wired that "onDragStart" is fire after startDrag method finished. Link to comment Share on other sites More sharing options...
vulvulune Posted January 27, 2015 Author Share Posted January 27, 2015 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 More sharing options...
Recommended Posts