summaryrefslogtreecommitdiffstats
path: root/src/seltrans.cpp
diff options
context:
space:
mode:
authorDiederik van Lierop <mail@diedenrezi.nl>2009-01-18 20:00:19 +0000
committerdvlierop2 <dvlierop2@users.sourceforge.net>2009-01-18 20:00:19 +0000
commit644f4f4a93a81735fb8265907533308df80d6b11 (patch)
tree47a80b1dc162b88a063b295dbae920cc2a668e93 /src/seltrans.cpp
parentsnap indicator: try a diamond shaped indicator for snapping to nodes. see how... (diff)
downloadinkscape-644f4f4a93a81735fb8265907533308df80d6b11.tar.gz
inkscape-644f4f4a93a81735fb8265907533308df80d6b11.zip
- Snap to the midpoint of shapes and bboxes
- Snap to the midpoint of paths and bbox edges - Refactor the snapping toggle, i.e. what snaps to what when toggling a specific option in the snapping toolbar PS: icons.svg has been modified, so use "make install" if needed (bzr r7144)
Diffstat (limited to 'src/seltrans.cpp')
-rw-r--r--src/seltrans.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/seltrans.cpp b/src/seltrans.cpp
index 1055e55ef..0fd15593c 100644
--- a/src/seltrans.cpp
+++ b/src/seltrans.cpp
@@ -285,16 +285,20 @@ void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool s
// Next, get all points to consider for snapping
SnapManager const &m = _desktop->namedview->snap_manager;
+ Inkscape::SnapPreferences local_snapprefs = m.snapprefs;
+ local_snapprefs.setSnapToItemNode(true); // We should get at least the cusp nodes here. This might
+ // have been turned off because (for example) the user only want paths as a snap target, not nodes
+ // but as a snap source we still need some nodes though!
_snap_points.clear();
- _snap_points = selection->getSnapPoints(&m.snapprefs);
- std::vector<Geom::Point> snap_points_hull = selection->getSnapPointsConvexHull(&m.snapprefs);
- if (_snap_points.size() > 100) {
- /* Snapping a huge number of nodes will take way too long, so limit the number of snappable nodes
- An average user would rarely ever try to snap such a large number of nodes anyway, because
- (s)he could hardly discern which node would be snapping */
- _snap_points = snap_points_hull;
- // Unfortunately, by now we will have lost the font-baseline snappoints :-(
- }
+ _snap_points = selection->getSnapPoints(&local_snapprefs);
+ std::vector<Geom::Point> snap_points_hull = selection->getSnapPointsConvexHull(&local_snapprefs);
+ if (_snap_points.size() > 100) {
+ /* Snapping a huge number of nodes will take way too long, so limit the number of snappable nodes
+ An average user would rarely ever try to snap such a large number of nodes anyway, because
+ (s)he could hardly discern which node would be snapping */
+ _snap_points = snap_points_hull;
+ // Unfortunately, by now we will have lost the font-baseline snappoints :-(
+ }
// Find bbox hulling all special points, which excludes stroke width. Here we need to include the
// path nodes, for example because a rectangle which has been converted to a path doesn't have
@@ -312,7 +316,9 @@ void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool s
_bbox_points.clear();
if (_bbox) {
- getBBoxPoints(_bbox, &_bbox_points, m.snapprefs.getSnapMidpoints());
+ if (m.snapprefs.getSnapModeBBox()) {
+ getBBoxPoints(_bbox, &_bbox_points, true, m.snapprefs.getSnapBBoxEdgeMidpoints(), m.snapprefs.getSnapBBoxMidpoints());
+ }
// There are two separate "opposites" (i.e. opposite w.r.t. the handle being dragged):
// - one for snapping the boundingbox, which can be either visual or geometric
// - one for snapping the special points