hackenstein Posted October 8, 2013 Share Posted October 8, 2013 (edited) I noticed that if I drag the atari1 sprite in the snap.php example, the sprite will snap up or left after a much smaller drag distance, than if I drag it down or right. Especially with smaller sprites this is very noticeable and feels odd.Is there a way to change this?Neither setting the sprite anchor to (0.5,0.5) nor setting a snapOffset seems to help. EDIT:Ok, I found a way to fix this. I changed Math.floor to Math.round in InputHander.updateDrag:if (this.snapOnDrag){ this.sprite.x = Math.round(this.sprite.x / this.snapX) * this.snapX; this.sprite.y = Math.round(this.sprite.y / this.snapY) * this.snapY;}This way drag&snap handles much better in my opinion. Edited October 8, 2013 by hackenstein Link to comment Share on other sites More sharing options...
rich Posted October 8, 2013 Share Posted October 8, 2013 Hmmm it never really felt that strange to me, but I guess I only really tested with quite large sprites. Have swapped it to Math.round and although I'm not feeling much difference it all still works, and if it makes you happy I'll leave it that way Link to comment Share on other sites More sharing options...
hackenstein Posted October 8, 2013 Author Share Posted October 8, 2013 That's awesome! Thanks, mate. Link to comment Share on other sites More sharing options...
Recommended Posts