Skip to content
This repository has been archived by the owner on Apr 8, 2020. It is now read-only.

Meaning of snapDist #130

Open
arunkjn opened this issue Jun 16, 2014 · 6 comments
Open

Meaning of snapDist #130

arunkjn opened this issue Jun 16, 2014 · 6 comments

Comments

@arunkjn
Copy link

arunkjn commented Jun 16, 2014

I cannot understand the use of snapDist setting and how it differs from snap setting.
Please elaborate.

@arunkjn
Copy link
Author

arunkjn commented Jun 16, 2014

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?

@AliasIO
Copy link
Owner

AliasIO commented Jun 16, 2014

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).

2014-06-17-091637_1920x1080_scrot

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:

http://alias.io/raphael/free_transform/

@arunkjn
Copy link
Author

arunkjn commented Jun 17, 2014

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.

@arunkjn
Copy link
Author

arunkjn commented Jun 17, 2014

I tried to disable snapping for bottom and right edges.
Here is the code I used arunkjn@96d7ac4
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/

@arunkjn
Copy link
Author

arunkjn commented Jun 23, 2014

Hi @ElbertF . Just wondering if you had a chance to look at it.

@arunkjn
Copy link
Author

arunkjn commented Aug 7, 2014

Hey @ElbertF sorry for poking you again, but I am kind of stuck here. Do you have any suggestions?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants