summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 97be673)
raw | patch | inline | side by side (parent: 97be673)
author | dvlierop2 <dvlierop2@users.sourceforge.net> | |
Tue, 20 Mar 2007 21:14:34 +0000 (21:14 +0000) | ||
committer | dvlierop2 <dvlierop2@users.sourceforge.net> | |
Tue, 20 Mar 2007 21:14:34 +0000 (21:14 +0000) |
src/arc-context.cpp | patch | blob | history | |
src/gradient-context.cpp | patch | blob | history | |
src/gradient-drag.cpp | patch | blob | history | |
src/spiral-context.cpp | patch | blob | history |
diff --git a/src/arc-context.cpp b/src/arc-context.cpp
index 1071d6f5d9133ec0fc49eb92af66410dc7e9b623..db64d79511c95671037b286467fd697a41625182 100644 (file)
--- a/src/arc-context.cpp
+++ b/src/arc-context.cpp
}
break;
case GDK_MOTION_NOTIFY:
- if (dragging && event->motion.state && GDK_BUTTON1_MASK) {
+ if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) {
if ( event_context->within_tolerance
&& ( abs( (gint) event->motion.x - event_context->xp ) < event_context->tolerance )
index c44cf1c594231e77369170209c52d4bbb320cf8a..42b4df5783167973a50bc26f4ec2a3904aff223b 100644 (file)
--- a/src/gradient-context.cpp
+++ b/src/gradient-context.cpp
#include "sp-stop.h"
#include "svg/css-ostringstream.h"
#include "svg/svg-color.h"
-
+#include "snap.h"
+#include "sp-namedview.h"
@@ -410,8 +411,9 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event)
/* Position center */
NR::Point const button_dt = desktop->w2d(button_w);
/* Snap center to nearest magnetic point */
-
- rc->origin = button_dt;
+
+ SnapManager const &m = desktop->namedview->snap_manager;
+ rc->origin = m.freeSnap(Inkscape::Snapper::BBOX_POINT | Inkscape::Snapper::SNAP_POINT, button_dt, NULL).getPoint();
ret = TRUE;
}
diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp
index 4a8f7e8edc97f234bd9e93a0e37b75db9eee31f7..d671b4823822e7e673fb290b73262e01b5661ede 100644 (file)
--- a/src/gradient-drag.cpp
+++ b/src/gradient-drag.cpp
#include "gradient-drag.h"
#include "sp-stop.h"
+#include "snap.h"
+#include "sp-namedview.h"
+
+
#define GR_KNOT_COLOR_NORMAL 0xffffff00
#define GR_KNOT_COLOR_SELECTED 0x0000ff00
@@ -429,19 +433,26 @@ gr_knot_moved_handler(SPKnot *knot, NR::Point const *ppointer, guint state, gpoi
}
}
-
if (!((state & GDK_SHIFT_MASK) || ((state & GDK_CONTROL_MASK) && (state & GDK_MOD1_MASK)))) {
- // See if we need to snap to any of the levels
- for (guint i = 0; i < dragger->parent->hor_levels.size(); i++) {
- if (fabs(p[NR::Y] - dragger->parent->hor_levels[i]) < snap_dist) {
- p[NR::Y] = dragger->parent->hor_levels[i];
- sp_knot_moveto (knot, &p);
+ // Try snapping to the grid or guides
+ SnapManager const &m = dragger->parent->desktop->namedview->snap_manager;
+ Inkscape::SnappedPoint s = m.freeSnap(Inkscape::Snapper::SNAP_POINT | Inkscape::Snapper::BBOX_POINT, p, NULL);
+ if (s.getDistance() < 1e6) {
+ p = s.getPoint();
+ sp_knot_moveto (knot, &p);
+ } else {
+ // No snapping so far, let's see if we need to snap to any of the levels
+ for (guint i = 0; i < dragger->parent->hor_levels.size(); i++) {
+ if (fabs(p[NR::Y] - dragger->parent->hor_levels[i]) < snap_dist) {
+ p[NR::Y] = dragger->parent->hor_levels[i];
+ sp_knot_moveto (knot, &p);
+ }
}
- }
- for (guint i = 0; i < dragger->parent->vert_levels.size(); i++) {
- if (fabs(p[NR::X] - dragger->parent->vert_levels[i]) < snap_dist) {
- p[NR::X] = dragger->parent->vert_levels[i];
- sp_knot_moveto (knot, &p);
+ for (guint i = 0; i < dragger->parent->vert_levels.size(); i++) {
+ if (fabs(p[NR::X] - dragger->parent->vert_levels[i]) < snap_dist) {
+ p[NR::X] = dragger->parent->vert_levels[i];
+ sp_knot_moveto (knot, &p);
+ }
}
}
}
diff --git a/src/spiral-context.cpp b/src/spiral-context.cpp
index ef3e3470b75790b0726aee6497d984705be899ee..f912d66146b138aa9f21ceb4f07f92effdc8ed0b 100644 (file)
--- a/src/spiral-context.cpp
+++ b/src/spiral-context.cpp
}
break;
case GDK_MOTION_NOTIFY:
- if (dragging && event->motion.state && GDK_BUTTON1_MASK) {
+ if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) {
if ( event_context->within_tolerance
&& ( abs( (gint) event->motion.x - event_context->xp ) < event_context->tolerance )