Jump to content

What's up with the drag snap x/y sensitivity?


hackenstein
 Share

Recommended Posts

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 by hackenstein
Link to comment
Share on other sites

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

 Share

  • Recently Browsing   0 members

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