index 9e3a3babcf8c4b369fa2379c349a510aed702bd2..005ca24c71c1fbe2e1b8bbb8112c5c5401f4ed26 100644 (file)
-#define __KNOT_HOLDER_ENTITY_C__
-
/** \file
* KnotHolderEntity definition.
*
* Authors:
* Mitsuru Oka <oka326@parkcity.ne.jp>
* Maximilian Albert <maximilian.albert@gmail.com>
+ * Abhishek Sharma
*
* Copyright (C) 1999-2001 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop, true, item);
-
m.freeSnapReturnByRef(s, Inkscape::SNAPSOURCE_NODE_HANDLE);
+ m.unSetup();
return s * i2d.inverse();
}
Geom::Point
-KnotHolderEntity::snap_knot_position_constrained(Geom::Point const &p, Inkscape::Snapper::ConstraintLine const &constraint)
+KnotHolderEntity::snap_knot_position_constrained(Geom::Point const &p, Inkscape::Snapper::SnapConstraint const &constraint)
{
Geom::Matrix const i2d (item->i2d_affine());
Geom::Point s = p * i2d;
@@ -110,22 +109,11 @@ KnotHolderEntity::snap_knot_position_constrained(Geom::Point const &p, Inkscape:
m.setup(desktop, true, item);
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- if ((prefs->getBool("/options/snapmousepointer/value", false))) { // legacy behavior (pre v0.47)
- // Snapping the mouse pointer instead of the constrained position of the knot allows to snap to
- // things which don't intersect with the constraint line. This should be handled by the
- // smart dynamic guides which are yet to be implemented, making this behavior more clean and
- // transparent. With the current implementation it leads to unexpected results, and it doesn't
- // allow accurately controlling what is being snapped to.
-
- // freeSnap() will try snapping point p. This will not take into account the constraint, which
- // is therefore to be enforced after snap_knot_position_constrained() has finished
- m.freeSnapReturnByRef(s, Inkscape::SNAPSOURCE_NODE_HANDLE);
- } else {
- // constrainedSnap() will first project the point p onto the constraint line and then try to snap along that line.
- // This way the constraint is already enforced, no need to worry about that later on
- Inkscape::Snapper::ConstraintLine transformed_constraint = Inkscape::Snapper::ConstraintLine(constraint.getPoint() * i2d, (constraint.getPoint() + constraint.getDirection()) * i2d - constraint.getPoint() * i2d);
- m.constrainedSnapReturnByRef(s, Inkscape::SNAPSOURCE_NODE_HANDLE, transformed_constraint);
- }
+ // constrainedSnap() will first project the point p onto the constraint line and then try to snap along that line.
+ // This way the constraint is already enforced, no need to worry about that later on
+ Inkscape::Snapper::SnapConstraint transformed_constraint = Inkscape::Snapper::SnapConstraint(constraint.getPoint() * i2d, (constraint.getPoint() + constraint.getDirection()) * i2d - constraint.getPoint() * i2d);
+ m.constrainedSnapReturnByRef(s, Inkscape::SNAPSOURCE_NODE_HANDLE, transformed_constraint);
+ m.unSetup();
return s * i2d.inverse();
}
fill-column:99
End:
*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :