Hi Diederik,
Seems to work great!! Very nice work.
A long standing wish of me...: The snapping points should depend a bit on where the user clicks. If I want some point to snap to some gridpoint, I tend to click close to that point and drag it close to where I want it to snap. Does that make sense? I do not have a clear idea how to go about this; perhaps some "rating" of possible snaps with better rating for snaps occuring short distances away from the mouse cursor...
Cheers, Johan
-----Original Message----- From: Diederik van Lierop [mailto:mail@...1689...] Sent: zaterdag 25 oktober 2008 15:22 To: inkscape-devel Subject: [Inkscape-devel] Snapping should only occur at the end of a movement
Hi,
Way back in time, someone suggested that snapping should only occur at the end of a movement or only at low mouse-speeds, as this would make Inkscape more responsive. I finally got to implementing this and apparently it works nicely, but I think it could use some testing on other systems, for example by users with a tablet. Let me first shortly explain what I implemented:
Inkscape now has a hard-coded speed limit above which no snapping will occur. The speed is calculated after each GDK_MOTION_NOTIFY event (in sp_canvas_motion). When trying to stop my mouse movements as fast as possible I measured speeds up to 1 pixel per millisecond at the last event in line. The speed limit should be above this value, otherwise snapping might not occur when breaking hard. When moving slowly though, almost all motion events will cause snapping when we use such a high speed limit, which wouldn't help in making Inkscape more responsive. I solved this by using both a watchdog timer and a relatively low speed-limit of 0.1 px/msec. The watchdog ensures that Inkscape will always snap at the end of a movement, even when we break abruptly. It will bark when no event comes in below the speed limit, within 100 msec after the last event. In such a case the last event will be repeated with snapping enabled.
There might be some issues though:
- Is it good practice to resend an event? Or might this have
side effects of which I'm not aware? 2) Someone mentioned in another thread that tablets will show jitter or noise. If the noise-level of the measured speed is above our speed limit, then Inkscape will not snap predictably. Could someone with a tablet (or a more expensive mouse) please uncomment line 1615 in sp-canvas.cpp and report to me what speed is measured? 3) When moving at speeds around the speed limit, Inkscape might snap for one motion event but not for the next, which will make the object that's being dragged jump from the snapped position to the mouse position and back again. That could be annoying, but I don't see an easy way around this.
Any comment is appreciated!
Diederik
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel