Open arunkjn opened 10 years ago
I am getting this weird behaviour on snap drag settings. Demonstrated here - http://jsfiddle.net/arunkjn/ddeBW/ Try dragging the rectangle. If I rotate the rectangle first and then drag it, the drag behaviour is fone and snaps properly. What might I be doing wrong here?
snap
is where it snaps to (grid size, green) and snapDist
is when it snaps (how far the object needs to be away from a grid line, red).
If you make the values the same the objects will always snap. If you make snapDist
smaller they can move freely between grid lines, to an extent.
Both sides of the object snap. In your case it's trying to snap both the left and right size simultaneously. A larger snap
value or smaller snapDist
value should fix that.
You can play around with some of the presets on the demo:
Hi @ElbertF
thanks for the clarification. I tried your suggestion and tweaked around with snap and snapDist settings to no avail. I also tried changing the rectangle proportions and (x,y) co-ordinates. But it did not help.
I noticed that after initial scaling by dragging one of the bBoxCorners or initial rotation through x-y axis handles makes the behaviour perfect.
Is there anything else I could be missing here? Can you please try tweaking the values and tell me the one that works? (I tried 80 and 20 from your example page, but that didn't work).
Also, if there a way of overriding the snap behaviour and snap only top and left edges? Or better the 'leading' edge to the direction of drag.
I tried to disable snapping for bottom and right edges. Here is the code I used https://github.com/arunkjn/Raphael.FreeTransform/commit/96d7ac42934182c6731c843e30ae2e4ed168e0db I have an updated example here http://jsfiddle.net/arunkjn/G9Lqv/3/ the same behaviour persists. If i scale or rotate first then it works fine.
An example where I programmatically apply scale transform before setting options works fine http://jsfiddle.net/arunkjn/8Fdwg/1/
Hi @ElbertF . Just wondering if you had a chance to look at it.
Hey @ElbertF sorry for poking you again, but I am kind of stuck here. Do you have any suggestions?
I cannot understand the use of snapDist setting and how it differs from snap setting. Please elaborate.