summaryrefslogtreecommitdiffstats
path: root/src/object-edit.cpp
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/object-edit.cpp
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/object-edit.cpp')
-rw-r--r--src/object-edit.cpp36
1 files changed, 18 insertions, 18 deletions
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;