summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDiederik van Lierop <mail@diedenrezi.nl>2012-10-14 18:06:40 +0000
committerDiederik van Lierop <mail@diedenrezi.nl>2012-10-14 18:06:40 +0000
commitc524e974852c8bb0a356353e23702be96fff9b83 (patch)
tree912dc655cad52123664b499d80e0ae0033509d26 /src
parentRemove invalid return statements (diff)
downloadinkscape-c524e974852c8bb0a356353e23702be96fff9b83.tar.gz
inkscape-c524e974852c8bb0a356353e23702be96fff9b83.zip
Fix "shift disables snapping" for LPEs and for editing objects
Fixed bugs: - https://launchpad.net/bugs/1065931 (bzr r11800)
Diffstat (limited to 'src')
-rw-r--r--src/knot-holder-entity.cpp16
-rw-r--r--src/knot-holder-entity.h4
-rw-r--r--src/live_effects/lpe-angle_bisector.cpp8
-rw-r--r--src/live_effects/lpe-copy_rotate.cpp8
-rw-r--r--src/live_effects/lpe-knot.cpp2
-rw-r--r--src/live_effects/lpe-parallel.cpp8
-rw-r--r--src/live_effects/lpe-perp_bisector.cpp14
-rw-r--r--src/live_effects/lpe-perp_bisector.h4
-rw-r--r--src/live_effects/lpe-perspective_path.cpp4
-rw-r--r--src/live_effects/lpe-tangent_to_curve.cpp12
-rw-r--r--src/live_effects/parameter/point.cpp4
-rw-r--r--src/live_effects/parameter/powerstrokepointarray.cpp4
-rw-r--r--src/live_effects/parameter/vector.cpp4
-rw-r--r--src/object-edit.cpp36
14 files changed, 68 insertions, 60 deletions
diff --git a/src/knot-holder-entity.cpp b/src/knot-holder-entity.cpp
index cb8f29f46..75732f805 100644
--- a/src/knot-holder-entity.cpp
+++ b/src/knot-holder-entity.cpp
@@ -89,8 +89,12 @@ KnotHolderEntity::update_knot()
}
Geom::Point
-KnotHolderEntity::snap_knot_position(Geom::Point const &p)
+KnotHolderEntity::snap_knot_position(Geom::Point const &p, guint state)
{
+ if (state & GDK_SHIFT_MASK) { // Don't snap when shift-key is held
+ return p;
+ }
+
Geom::Affine const i2dt (item->i2dt_affine());
Geom::Point s = p * i2dt;
@@ -103,8 +107,12 @@ KnotHolderEntity::snap_knot_position(Geom::Point const &p)
}
Geom::Point
-KnotHolderEntity::snap_knot_position_constrained(Geom::Point const &p, Inkscape::Snapper::SnapConstraint const &constraint)
+KnotHolderEntity::snap_knot_position_constrained(Geom::Point const &p, Inkscape::Snapper::SnapConstraint const &constraint, guint state)
{
+ if (state & GDK_SHIFT_MASK) { // Don't snap when shift-key is held
+ return p;
+ }
+
Geom::Affine const i2d (item->i2dt_affine());
Geom::Point s = p * i2d;
@@ -148,7 +156,7 @@ PatternKnotHolderEntityXY::knot_set(Geom::Point const &p, Geom::Point const &ori
SPPattern *pat = SP_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style));
// FIXME: this snapping should be done together with knowing whether control was pressed. If GDK_CONTROL_MASK, then constrained snapping should be used.
- Geom::Point p_snapped = snap_knot_position(p);
+ Geom::Point p_snapped = snap_knot_position(p, state);
if ( state & GDK_CONTROL_MASK ) {
if (fabs((p - origin)[Geom::X]) > fabs((p - origin)[Geom::Y])) {
@@ -220,7 +228,7 @@ PatternKnotHolderEntityScale::knot_set(Geom::Point const &p, Geom::Point const &
SPPattern *pat = SP_PATTERN(SP_STYLE_FILL_SERVER(SP_OBJECT(item)->style));
// FIXME: this snapping should be done together with knowing whether control was pressed. If GDK_CONTROL_MASK, then constrained snapping should be used.
- Geom::Point p_snapped = snap_knot_position(p);
+ Geom::Point p_snapped = snap_knot_position(p, state);
// get angle from current transform
gdouble theta = sp_pattern_extract_theta(pat);
diff --git a/src/knot-holder-entity.h b/src/knot-holder-entity.h
index 58dc89bfd..09d70f8c9 100644
--- a/src/knot-holder-entity.h
+++ b/src/knot-holder-entity.h
@@ -65,8 +65,8 @@ public:
void update_knot();
//private:
- Geom::Point snap_knot_position(Geom::Point const &p);
- Geom::Point snap_knot_position_constrained(Geom::Point const &p, Inkscape::Snapper::SnapConstraint const &constraint);
+ Geom::Point snap_knot_position(Geom::Point const &p, guint state);
+ Geom::Point snap_knot_position_constrained(Geom::Point const &p, Inkscape::Snapper::SnapConstraint const &constraint, guint state);
SPKnot *knot;
SPItem *item;
diff --git a/src/live_effects/lpe-angle_bisector.cpp b/src/live_effects/lpe-angle_bisector.cpp
index ce152bb34..4e6176c92 100644
--- a/src/live_effects/lpe-angle_bisector.cpp
+++ b/src/live_effects/lpe-angle_bisector.cpp
@@ -99,11 +99,11 @@ LPEAngleBisector::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *deskt
namespace AB {
void
-KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/)
+KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state)
{
LPEAngleBisector *lpe = dynamic_cast<LPEAngleBisector *>(_effect);
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
double lambda = Geom::nearest_point(s, lpe->ptA, lpe->dir);
lpe->length_left.param_set_value(-lambda);
@@ -112,11 +112,11 @@ KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*ori
}
void
-KnotHolderEntityRightEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/)
+KnotHolderEntityRightEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state)
{
LPEAngleBisector *lpe = dynamic_cast<LPEAngleBisector *>(_effect);
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
double lambda = Geom::nearest_point(s, lpe->ptA, lpe->dir);
lpe->length_right.param_set_value(lambda);
diff --git a/src/live_effects/lpe-copy_rotate.cpp b/src/live_effects/lpe-copy_rotate.cpp
index 68242cc94..01c0e550c 100644
--- a/src/live_effects/lpe-copy_rotate.cpp
+++ b/src/live_effects/lpe-copy_rotate.cpp
@@ -152,7 +152,7 @@ KnotHolderEntityStartingAngle::knot_set(Geom::Point const &p, Geom::Point const
{
LPECopyRotate* lpe = dynamic_cast<LPECopyRotate *>(_effect);
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
// I first suspected the minus sign to be a bug in 2geom but it is
// likely due to SVG's choice of coordinate system orientation (max)
@@ -172,7 +172,7 @@ KnotHolderEntityRotationAngle::knot_set(Geom::Point const &p, Geom::Point const
{
LPECopyRotate* lpe = dynamic_cast<LPECopyRotate *>(_effect);
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
// I first suspected the minus sign to be a bug in 2geom but it is
// likely due to SVG's choice of coordinate system orientation (max)
@@ -191,14 +191,14 @@ Geom::Point
KnotHolderEntityStartingAngle::knot_get()
{
LPECopyRotate* lpe = dynamic_cast<LPECopyRotate *>(_effect);
- return snap_knot_position(lpe->start_pos);
+ return lpe->start_pos;
}
Geom::Point
KnotHolderEntityRotationAngle::knot_get()
{
LPECopyRotate* lpe = dynamic_cast<LPECopyRotate *>(_effect);
- return snap_knot_position(lpe->rot_pos);
+ return lpe->rot_pos;
}
} // namespace CR
diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp
index 746dbbb7a..61e457d35 100644
--- a/src/live_effects/lpe-knot.cpp
+++ b/src/live_effects/lpe-knot.cpp
@@ -634,7 +634,7 @@ Geom::Point
KnotHolderEntityCrossingSwitcher::knot_get()
{
LPEKnot* lpe = dynamic_cast<LPEKnot *>(_effect);
- return snap_knot_position(lpe->switcher);
+ return lpe->switcher;
}
void
diff --git a/src/live_effects/lpe-parallel.cpp b/src/live_effects/lpe-parallel.cpp
index a6b894ce3..5638bf6de 100644
--- a/src/live_effects/lpe-parallel.cpp
+++ b/src/live_effects/lpe-parallel.cpp
@@ -113,13 +113,13 @@ void LPEParallel::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *deskt
namespace Pl {
void
-KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/)
+KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state)
{
using namespace Geom;
LPEParallel *lpe = dynamic_cast<LPEParallel *>(_effect);
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
double lambda = L2(s - lpe->offset_pt) * sgn(dot(s - lpe->offset_pt, lpe->dir));
lpe->length_left.param_set_value(-lambda);
@@ -128,13 +128,13 @@ KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*ori
}
void
-KnotHolderEntityRightEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/)
+KnotHolderEntityRightEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state)
{
using namespace Geom;
LPEParallel *lpe = dynamic_cast<LPEParallel *>(_effect);
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
double lambda = L2(s - lpe->offset_pt) * sgn(dot(s - lpe->offset_pt, lpe->dir));
lpe->length_right.param_set_value(lambda);
diff --git a/src/live_effects/lpe-perp_bisector.cpp b/src/live_effects/lpe-perp_bisector.cpp
index 7417c166f..df7e18dcf 100644
--- a/src/live_effects/lpe-perp_bisector.cpp
+++ b/src/live_effects/lpe-perp_bisector.cpp
@@ -31,7 +31,7 @@ namespace PB {
class KnotHolderEntityEnd : public LPEKnotHolderEntity {
public:
KnotHolderEntityEnd(LPEPerpBisector *effect) : LPEKnotHolderEntity(effect) {};
- void bisector_end_set(Geom::Point const &p, bool left = true);
+ void bisector_end_set(Geom::Point const &p, guint state, bool left = true);
};
class KnotHolderEntityLeftEnd : public KnotHolderEntityEnd {
@@ -61,11 +61,11 @@ KnotHolderEntityRightEnd::knot_get() {
}
void
-KnotHolderEntityEnd::bisector_end_set(Geom::Point const &p, bool left) {
+KnotHolderEntityEnd::bisector_end_set(Geom::Point const &p, guint state, bool left) {
LPEPerpBisector *lpe = dynamic_cast<LPEPerpBisector *>(_effect);
if (!lpe) return;
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
double lambda = Geom::nearest_point(s, lpe->M, lpe->perp_dir);
if (left) {
@@ -81,13 +81,13 @@ KnotHolderEntityEnd::bisector_end_set(Geom::Point const &p, bool left) {
}
void
-KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/) {
- bisector_end_set(p);
+KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) {
+ bisector_end_set(p, state);
}
void
-KnotHolderEntityRightEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/) {
- bisector_end_set(p, false);
+KnotHolderEntityRightEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) {
+ bisector_end_set(p, state, false);
}
} //namescape PB
diff --git a/src/live_effects/lpe-perp_bisector.h b/src/live_effects/lpe-perp_bisector.h
index 823717e62..f5a918028 100644
--- a/src/live_effects/lpe-perp_bisector.h
+++ b/src/live_effects/lpe-perp_bisector.h
@@ -27,7 +27,7 @@ namespace PB {
class KnotHolderEntityEnd;
class KnotHolderEntityLeftEnd;
class KnotHolderEntityRightEnd;
- void bisector_end_set(SPItem *item, Geom::Point const &p, bool left);
+ void bisector_end_set(SPItem *item, Geom::Point const &p, guint state, bool left);
}
class LPEPerpBisector : public Effect {
@@ -46,7 +46,7 @@ public:
friend class PB::KnotHolderEntityEnd;
friend class PB::KnotHolderEntityLeftEnd;
friend class PB::KnotHolderEntityRightEnd;
- friend void PB::bisector_end_set(SPItem *item, Geom::Point const &p, bool left = true);
+ friend void PB::bisector_end_set(SPItem *item, Geom::Point const &p, guint state, bool left = true);
void addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item);
private:
diff --git a/src/live_effects/lpe-perspective_path.cpp b/src/live_effects/lpe-perspective_path.cpp
index f3cf802a1..aeee77482 100644
--- a/src/live_effects/lpe-perspective_path.cpp
+++ b/src/live_effects/lpe-perspective_path.cpp
@@ -149,13 +149,13 @@ void LPEPerspectivePath::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop
namespace PP {
void
-KnotHolderEntityOffset::knot_set(Geom::Point const &p, Geom::Point const &origin, guint /*state*/)
+KnotHolderEntityOffset::knot_set(Geom::Point const &p, Geom::Point const &origin, guint state)
{
using namespace Geom;
LPEPerspectivePath* lpe = dynamic_cast<LPEPerspectivePath *>(_effect);
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
lpe->offsetx.param_set_value((s - origin)[Geom::X]);
lpe->offsety.param_set_value(-(s - origin)[Geom::Y]); // additional minus sign is due to coordinate system flipping
diff --git a/src/live_effects/lpe-tangent_to_curve.cpp b/src/live_effects/lpe-tangent_to_curve.cpp
index 93dacf3e0..d76675467 100644
--- a/src/live_effects/lpe-tangent_to_curve.cpp
+++ b/src/live_effects/lpe-tangent_to_curve.cpp
@@ -122,13 +122,13 @@ LPETangentToCurve::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desk
namespace TtC {
void
-KnotHolderEntityAttachPt::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/)
+KnotHolderEntityAttachPt::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state)
{
using namespace Geom;
LPETangentToCurve* lpe = dynamic_cast<LPETangentToCurve *>(_effect);
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
// FIXME: There must be a better way of converting the path's SPCurve* to pwd2.
SPCurve *curve = SP_PATH(item)->get_curve_for_edit();
@@ -146,11 +146,11 @@ KnotHolderEntityAttachPt::knot_set(Geom::Point const &p, Geom::Point const &/*or
}
void
-KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/)
+KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state)
{
LPETangentToCurve *lpe = dynamic_cast<LPETangentToCurve *>(_effect);
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
double lambda = Geom::nearest_point(s, lpe->ptA, lpe->derivA);
lpe->length_left.param_set_value(-lambda);
@@ -159,11 +159,11 @@ KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*ori
}
void
-KnotHolderEntityRightEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/)
+KnotHolderEntityRightEnd::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state)
{
LPETangentToCurve *lpe = dynamic_cast<LPETangentToCurve *>(_effect);
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
double lambda = Geom::nearest_point(s, lpe->ptA, lpe->derivA);
lpe->length_right.param_set_value(lambda);
diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp
index b751aeda3..2be87e048 100644
--- a/src/live_effects/parameter/point.cpp
+++ b/src/live_effects/parameter/point.cpp
@@ -141,9 +141,9 @@ private:
};
void
-PointParamKnotHolderEntity::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/)
+PointParamKnotHolderEntity::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state)
{
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
pparam->param_setValue(s);
sp_lpe_item_update_patheffect(SP_LPE_ITEM(item), false, false);
}
diff --git a/src/live_effects/parameter/powerstrokepointarray.cpp b/src/live_effects/parameter/powerstrokepointarray.cpp
index 68d0175ca..93161ec0d 100644
--- a/src/live_effects/parameter/powerstrokepointarray.cpp
+++ b/src/live_effects/parameter/powerstrokepointarray.cpp
@@ -144,7 +144,7 @@ PowerStrokePointArrayParamKnotHolderEntity::PowerStrokePointArrayParamKnotHolder
}
void
-PowerStrokePointArrayParamKnotHolderEntity::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/)
+PowerStrokePointArrayParamKnotHolderEntity::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state)
{
using namespace Geom;
@@ -156,7 +156,7 @@ PowerStrokePointArrayParamKnotHolderEntity::knot_set(Geom::Point const &p, Geom:
Piecewise<D2<SBasis> > const & pwd2 = _pparam->get_pwd2();
Piecewise<D2<SBasis> > const & n = _pparam->get_pwd2_normal();
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
double t = nearest_point(s, pwd2);
double offset = dot(s - pwd2.valueAt(t), n.valueAt(t));
_pparam->_vector.at(_index) = Geom::Point(t, offset);
diff --git a/src/live_effects/parameter/vector.cpp b/src/live_effects/parameter/vector.cpp
index 8b62ba91e..a20c46042 100644
--- a/src/live_effects/parameter/vector.cpp
+++ b/src/live_effects/parameter/vector.cpp
@@ -149,8 +149,8 @@ public:
VectorParamKnotHolderEntity_Origin(VectorParam *p) : param(p) { }
virtual ~VectorParamKnotHolderEntity_Origin() {}
- virtual void knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint /*state*/) {
- Geom::Point const s = snap_knot_position(p);
+ virtual void knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) {
+ Geom::Point const s = snap_knot_position(p, state);
param->setOrigin(s);
sp_lpe_item_update_patheffect(SP_LPE_ITEM(item), false, false);
};
diff --git a/src/object-edit.cpp b/src/object-edit.cpp
index ebd0f7584..989d84c7f 100644
--- a/src/object-edit.cpp
+++ b/src/object-edit.cpp
@@ -141,7 +141,7 @@ RectKnotHolderEntityRX::knot_set(Geom::Point const &p, Geom::Point const &/*orig
//In general we cannot just snap this radius to an arbitrary point, as we have only a single
//degree of freedom. For snapping to an arbitrary point we need two DOF. If we're going to snap
//the radius then we should have a constrained snap. snap_knot_position() is unconstrained
- Geom::Point const s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed), Geom::Point(-1, 0)));
+ Geom::Point const s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed), Geom::Point(-1, 0)), state);
if (state & GDK_CONTROL_MASK) {
gdouble temp = MIN(rect->height.computed, rect->width.computed) / 2.0;
@@ -190,7 +190,7 @@ RectKnotHolderEntityRY::knot_set(Geom::Point const &p, Geom::Point const &/*orig
//In general we cannot just snap this radius to an arbitrary point, as we have only a single
//degree of freedom. For snapping to an arbitrary point we need two DOF. If we're going to snap
//the radius then we should have a constrained snap. snap_knot_position() is unconstrained
- Geom::Point const s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed), Geom::Point(0, 1)));
+ Geom::Point const s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed), Geom::Point(0, 1)), state);
if (state & GDK_CONTROL_MASK) { // When holding control then rx will be kept equal to ry,
// resulting in a perfect circle (and not an ellipse)
@@ -279,13 +279,13 @@ RectKnotHolderEntityWH::set_internal(Geom::Point const &p, Geom::Point const &or
// snap to horizontal or diagonal
if (minx != 0 && fabs(miny/minx) > 0.5 * 1/ratio && (SGN(minx) == SGN(miny))) {
// closer to the diagonal and in same-sign quarters, change both using ratio
- s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-ratio, -1)));
+ s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-ratio, -1)), state);
minx = s[Geom::X] - origin[Geom::X];
miny = s[Geom::Y] - origin[Geom::Y];
rect->height.computed = MAX(h_orig + minx / ratio, 0);
} else {
// closer to the horizontal, change only width, height is h_orig
- s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-1, 0)));
+ s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-1, 0)), state);
minx = s[Geom::X] - origin[Geom::X];
miny = s[Geom::Y] - origin[Geom::Y];
rect->height.computed = MAX(h_orig, 0);
@@ -296,13 +296,13 @@ RectKnotHolderEntityWH::set_internal(Geom::Point const &p, Geom::Point const &or
// snap to vertical or diagonal
if (miny != 0 && fabs(minx/miny) > 0.5 * ratio && (SGN(minx) == SGN(miny))) {
// closer to the diagonal and in same-sign quarters, change both using ratio
- s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-ratio, -1)));
+ s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-ratio, -1)), state);
minx = s[Geom::X] - origin[Geom::X];
miny = s[Geom::Y] - origin[Geom::Y];
rect->width.computed = MAX(w_orig + miny * ratio, 0);
} else {
// closer to the vertical, change only height, width is w_orig
- s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(0, -1)));
+ s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(0, -1)), state);
minx = s[Geom::X] - origin[Geom::X];
miny = s[Geom::Y] - origin[Geom::Y];
rect->width.computed = MAX(w_orig, 0);
@@ -315,7 +315,7 @@ RectKnotHolderEntityWH::set_internal(Geom::Point const &p, Geom::Point const &or
} else {
// move freely
- s = snap_knot_position(p);
+ s = snap_knot_position(p, state);
rect->width.computed = MAX(s[Geom::X] - rect->x.computed, 0);
rect->height.computed = MAX(s[Geom::Y] - rect->y.computed, 0);
rect->width._set = rect->height._set = true;
@@ -369,14 +369,14 @@ RectKnotHolderEntityXY::knot_set(Geom::Point const &p, Geom::Point const &origin
// snap to horizontal or diagonal
if (minx != 0 && fabs(miny/minx) > 0.5 * 1/ratio && (SGN(minx) == SGN(miny))) {
// closer to the diagonal and in same-sign quarters, change both using ratio
- s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-ratio, -1)));
+ s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-ratio, -1)), state);
minx = s[Geom::X] - origin[Geom::X];
miny = s[Geom::Y] - origin[Geom::Y];
rect->y.computed = MIN(origin[Geom::Y] + minx / ratio, opposite_y);
rect->height.computed = MAX(h_orig - minx / ratio, 0);
} else {
// closer to the horizontal, change only width, height is h_orig
- s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-1, 0)));
+ s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-1, 0)), state);
minx = s[Geom::X] - origin[Geom::X];
miny = s[Geom::Y] - origin[Geom::Y];
rect->y.computed = MIN(origin[Geom::Y], opposite_y);
@@ -388,14 +388,14 @@ RectKnotHolderEntityXY::knot_set(Geom::Point const &p, Geom::Point const &origin
// snap to vertical or diagonal
if (miny != 0 && fabs(minx/miny) > 0.5 *ratio && (SGN(minx) == SGN(miny))) {
// closer to the diagonal and in same-sign quarters, change both using ratio
- s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-ratio, -1)));
+ s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(-ratio, -1)), state);
minx = s[Geom::X] - origin[Geom::X];
miny = s[Geom::Y] - origin[Geom::Y];
rect->x.computed = MIN(origin[Geom::X] + miny * ratio, opposite_x);
rect->width.computed = MAX(w_orig - miny * ratio, 0);
} else {
// closer to the vertical, change only height, width is w_orig
- s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(0, -1)));
+ s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(p_handle, Geom::Point(0, -1)), state);
minx = s[Geom::X] - origin[Geom::X];
miny = s[Geom::Y] - origin[Geom::Y];
rect->x.computed = MIN(origin[Geom::X], opposite_x);
@@ -409,7 +409,7 @@ RectKnotHolderEntityXY::knot_set(Geom::Point const &p, Geom::Point const &origin
} else {
// move freely
- s = snap_knot_position(p);
+ s = snap_knot_position(p, state);
minx = s[Geom::X] - origin[Geom::X];
miny = s[Geom::Y] - origin[Geom::Y];
@@ -483,7 +483,7 @@ Box3DKnotHolderEntity::knot_get_generic(SPItem *item, unsigned int knot_id)
void
Box3DKnotHolderEntity::knot_set_generic(SPItem *item, unsigned int knot_id, Geom::Point const &new_pos, guint state)
{
- Geom::Point const s = snap_knot_position(new_pos);
+ Geom::Point const s = snap_knot_position(new_pos, state);
g_assert(item != NULL);
SPBox3D *box = SP_BOX3D(item);
@@ -660,7 +660,7 @@ Box3DKnotHolderEntity7::knot_set(Geom::Point const &new_pos, Geom::Point const &
void
Box3DKnotHolderEntityCenter::knot_set(Geom::Point const &new_pos, Geom::Point const &origin, guint state)
{
- Geom::Point const s = snap_knot_position(new_pos);
+ Geom::Point const s = snap_knot_position(new_pos, state);
SPBox3D *box = SP_BOX3D(item);
Geom::Affine const i2dt (item->i2dt_affine ());
@@ -875,7 +875,7 @@ ArcKnotHolderEntityRX::knot_set(Geom::Point const &p, Geom::Point const &/*origi
{
SPGenericEllipse *ge = SP_GENERICELLIPSE(item);
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
ge->rx.computed = fabs( ge->cx.computed - s[Geom::X] );
@@ -910,7 +910,7 @@ ArcKnotHolderEntityRY::knot_set(Geom::Point const &p, Geom::Point const &/*origi
{
SPGenericEllipse *ge = SP_GENERICELLIPSE(item);
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
ge->ry.computed = fabs( ge->cy.computed - s[Geom::Y] );
@@ -995,7 +995,7 @@ StarKnotHolderEntity1::knot_set(Geom::Point const &p, Geom::Point const &/*origi
{
SPStar *star = SP_STAR(item);
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
Geom::Point d = s - star->center;
@@ -1021,7 +1021,7 @@ StarKnotHolderEntity2::knot_set(Geom::Point const &p, Geom::Point const &/*origi
{
SPStar *star = SP_STAR(item);
- Geom::Point const s = snap_knot_position(p);
+ Geom::Point const s = snap_knot_position(p, state);
if (star->flatsided == false) {
Geom::Point d = s - star->center;