![](https://secure.gravatar.com/avatar/75bd3e29dcf253111b056c2390b14268.jpg?s=120&d=mm&r=g)
Diederik van Lierop wrote:
On 10/26/2008 07:47 PM, Vladimir Savic wrote:
Careful choice of snapping time delay will _probably_ make jitter much less present.
I've changed the snapping behavior in my latest commit, once again. Inkscape now always postpones snapping until the mouse movement has settled, and after that waits for and additional 400 msec. It will now snap only once, at the end of the movement. We still have the speed threshold to eliminate any tablet jitter, but it's at 0.02 px/msec. And if we happen to have any jitter then Inkscape will snap never more than 2.5 times per second. I really like this already, because now the snapping is very predictable and no processing power is wasted at all. Please test this and tell me if you like it too!
I've started experimenting yesterday. And what I must say is congratulation! :)
Snapping works now better then ever. There are only few things I've noticed so far. First, snapping occurs at end of movement, but what happens with starting point. The most obvious case is when creating objects. Take drawing rectangle with grid lines turned on, as example. Starting point (upper left) will always "hang" between grids. Of course, if you're not lucky enough to hit left mouse button at right place. :)
Second problem. This has nothing to do with grids. Draw rectangle and vertical line beside it. Drag middle side arrow to expand rectangle and you'll see that it simply wont snap to line. Dragging rectangle's corner arrow will. Although I can think of many use cases where it would be appropriate to keep object's height or width, it's not possible at the moment.
And the last thing... Think of better snap indicator. I can cover present one too easily with mouse pointer. Especially if using a bit "bigger" mouse pointer theme. KDE4 has oxygen which quite problematic for snapping.
Finally, I am confident in snapper doing right thing. You really deserve all the glory. Great work!
BTW, what's your IRC nick? Can't seem to find you there.
Vlada
Another thing that I've added is that when finding the node with the best snap, we now also consider the initial distance to the mouse pointer, not just the distance to the snapped point. This way you can indicate which node you would like to snap by grabbing the selected item at that specific node. I've used a weight factor for this, which you can adjust on line 80 of snapped-point.cpp (for those who want to play with this):
double const w = 0.25; // weigth factor: controls which node should be preferrerd for snapping, which is either // the node with the closest snap (w = 0), or the node closest to the mousepointer (w = 1)
When set to 0, it won't always work as expected. I still have to look into this. Maybe we can provide a slider in the UI one day to adjust this weight factor dynamically, if we're going this route.
Regards,
Diederik