summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDiederik van Lierop <mailat-signdiedenrezidotnl>2010-07-18 10:12:38 +0000
committerDiederik van Lierop <mailat-signdiedenrezidotnl>2010-07-18 10:12:38 +0000
commit03e65527a5994b916056f263e96d9bc19acff878 (patch)
tree80fe353aeb22a1b708f0573d8638130e3c79fb23 /src
parentTurn off color profile debug messages. (diff)
downloadinkscape-03e65527a5994b916056f263e96d9bc19acff878.tar.gz
inkscape-03e65527a5994b916056f263e96d9bc19acff878.zip
- do not use shift to disable snapping while holding shift to rotate a guide
- snap guides to paths too - always show the same snap indicator (bzr r9625)
Diffstat (limited to 'src')
-rw-r--r--src/desktop-events.cpp14
-rw-r--r--src/display/snap-indicator.cpp30
-rw-r--r--src/object-snapper.cpp8
-rw-r--r--src/object-snapper.h2
-rw-r--r--src/snap.cpp3
5 files changed, 20 insertions, 37 deletions
diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp
index 810f501d7..bb22b0faa 100644
--- a/src/desktop-events.cpp
+++ b/src/desktop-events.cpp
@@ -296,10 +296,9 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data)
if (!(event->motion.state & GDK_SHIFT_MASK)) {
m.guideConstrainedSnap(motion_dt, *guide);
}
- } else if (!(event->motion.state & GDK_SHIFT_MASK)) {
- if (!((drag_type == SP_DRAG_ROTATE) && (event->motion.state & GDK_CONTROL_MASK))) {
- m.guideFreeSnap(motion_dt, guide->normal_to_line, drag_type);
- }
+ } else if (!((drag_type == SP_DRAG_ROTATE) && (event->motion.state & GDK_CONTROL_MASK))) {
+ // cannot use shift here to disable snapping, because we already use it for rotating the guide
+ m.guideFreeSnap(motion_dt, guide->normal_to_line, drag_type);
}
switch (drag_type) {
@@ -361,10 +360,9 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data)
if (!(event->button.state & GDK_SHIFT_MASK)) {
m.guideConstrainedSnap(event_dt, *guide);
}
- } else if (!(event->button.state & GDK_SHIFT_MASK)) {
- if (!((drag_type == SP_DRAG_ROTATE) && (event->motion.state & GDK_CONTROL_MASK))) {
- m.guideFreeSnap(event_dt, guide->normal_to_line, drag_type);
- }
+ } else if (!((drag_type == SP_DRAG_ROTATE) && (event->motion.state & GDK_CONTROL_MASK))) {
+ // cannot use shift here to disable snapping, because we already use it for rotating the guide
+ m.guideFreeSnap(event_dt, guide->normal_to_line, drag_type);
}
if (sp_canvas_world_pt_inside_window(item->canvas, event_w)) {
diff --git a/src/display/snap-indicator.cpp b/src/display/snap-indicator.cpp
index 0409e64b1..776c56c15 100644
--- a/src/display/snap-indicator.cpp
+++ b/src/display/snap-indicator.cpp
@@ -228,27 +228,15 @@ SnapIndicator::set_new_snaptarget(Inkscape::SnappedPoint const &p, bool pre_snap
// Display the snap indicator (i.e. the cross)
SPCanvasItem * canvasitem = NULL;
- if (p.getTarget() == SNAPTARGET_NODE_SMOOTH || p.getTarget() == SNAPTARGET_NODE_CUSP) {
- canvasitem = sp_canvas_item_new(sp_desktop_tempgroup (_desktop),
- SP_TYPE_CTRL,
- "anchor", GTK_ANCHOR_CENTER,
- "size", 10.0,
- "stroked", TRUE,
- "stroke_color", pre_snap ? 0x7f7f7fff : 0xff0000ff,
- "mode", SP_KNOT_MODE_XOR,
- "shape", SP_KNOT_SHAPE_DIAMOND,
- NULL );
- } else {
- canvasitem = sp_canvas_item_new(sp_desktop_tempgroup (_desktop),
- SP_TYPE_CTRL,
- "anchor", GTK_ANCHOR_CENTER,
- "size", 10.0,
- "stroked", TRUE,
- "stroke_color", pre_snap ? 0x7f7f7fff : 0xff0000ff,
- "mode", SP_KNOT_MODE_XOR,
- "shape", SP_KNOT_SHAPE_CROSS,
- NULL );
- }
+ canvasitem = sp_canvas_item_new(sp_desktop_tempgroup (_desktop),
+ SP_TYPE_CTRL,
+ "anchor", GTK_ANCHOR_CENTER,
+ "size", 10.0,
+ "stroked", TRUE,
+ "stroke_color", pre_snap ? 0x7f7f7fff : 0xff0000ff,
+ "mode", SP_KNOT_MODE_XOR,
+ "shape", SP_KNOT_SHAPE_CROSS,
+ NULL );
const int timeout_val = 1200; // TODO add preference for snap indicator timeout?
diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp
index 22d5f35aa..57d5b0fc5 100644
--- a/src/object-snapper.cpp
+++ b/src/object-snapper.cpp
@@ -281,18 +281,16 @@ void Inkscape::ObjectSnapper::_snapNodes(SnappedConstraints &sc,
}
}
-void Inkscape::ObjectSnapper::_snapTranslatingGuideToNodes(SnappedConstraints &sc,
+void Inkscape::ObjectSnapper::_snapTranslatingGuide(SnappedConstraints &sc,
Geom::Point const &p,
Geom::Point const &guide_normal) const
{
// Iterate through all nodes, find out which one is the closest to this guide, and snap to it!
_collectNodes(SNAPSOURCE_GUIDE, true);
- // Although we won't snap to paths here (which would give us under constrained snaps) we can still snap to intersections of paths.
if (_snapmanager->snapprefs.getSnapToItemPath() || _snapmanager->snapprefs.getSnapToBBoxPath() || _snapmanager->snapprefs.getSnapToPageBorder()) {
_collectPaths(Inkscape::SnapCandidatePoint(p, SNAPSOURCE_GUIDE), true);
_snapPaths(sc, Inkscape::SnapCandidatePoint(p, SNAPSOURCE_GUIDE), NULL, NULL);
- // The paths themselves should be discarded in findBestSnap(), as we should only snap to their intersections
}
SnappedPoint s;
@@ -682,7 +680,7 @@ void Inkscape::ObjectSnapper::guideFreeSnap(SnappedConstraints &sc,
}
_findCandidates(sp_document_root(_snapmanager->getDocument()), &it, true, Geom::Rect(p, p), snap_dim, false, Geom::identity());
- _snapTranslatingGuideToNodes(sc, p, guide_normal);
+ _snapTranslatingGuide(sc, p, guide_normal);
}
@@ -706,7 +704,7 @@ void Inkscape::ObjectSnapper::guideConstrainedSnap(SnappedConstraints &sc,
}
_findCandidates(sp_document_root(_snapmanager->getDocument()), &it, true, Geom::Rect(p, p), snap_dim, false, Geom::identity());
- _snapTranslatingGuideToNodes(sc, p, guide_normal);
+ _snapTranslatingGuide(sc, p, guide_normal);
}
diff --git a/src/object-snapper.h b/src/object-snapper.h
index 454a18545..b0084c2d7 100644
--- a/src/object-snapper.h
+++ b/src/object-snapper.h
@@ -84,7 +84,7 @@ private:
Inkscape::SnapCandidatePoint const &p,
std::vector<SnapCandidatePoint> *unselected_nodes) const; // in desktop coordinates
- void _snapTranslatingGuideToNodes(SnappedConstraints &sc,
+ void _snapTranslatingGuide(SnappedConstraints &sc,
Geom::Point const &p,
Geom::Point const &guide_normal) const;
diff --git a/src/snap.cpp b/src/snap.cpp
index 1127ccba1..ccaf3dee3 100644
--- a/src/snap.cpp
+++ b/src/snap.cpp
@@ -430,8 +430,7 @@ void SnapManager::guideFreeSnap(Geom::Point &p, Geom::Point const &guide_normal,
(*i)->freeSnap(sc, candidate, Geom::OptRect(), NULL, NULL);
}
- // Snap to intersections of curves, but not to the curves themselves! (see _snapTranslatingGuideToNodes in object-snapper.cpp)
- Inkscape::SnappedPoint const s = findBestSnap(candidate, sc, false, true);
+ Inkscape::SnappedPoint const s = findBestSnap(candidate, sc, false, false);
s.getPoint(p);
}