From: dvlierop2 Date: Fri, 16 Mar 2007 21:26:53 +0000 (+0000) Subject: Fix bug #1511262: don't snap rect to itself X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=706b1688d22c58b73e6d8e7b8566c5f6201e615c;p=inkscape.git Fix bug #1511262: don't snap rect to itself --- diff --git a/src/object-edit.cpp b/src/object-edit.cpp index 2eabdd7bd..5ca346977 100644 --- a/src/object-edit.cpp +++ b/src/object-edit.cpp @@ -331,18 +331,18 @@ static NR::Point sp_rect_wh_get(SPItem *item) return NR::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed); } -static NR::Point rect_snap_knot_position(NR::Point const &p) +static NR::Point rect_snap_knot_position(SPRect *rect, NR::Point const &p) { SPDesktop const *desktop = inkscape_active_desktop(); NR::Point s = sp_desktop_dt2root_xy_point(desktop, p); SnapManager const &m = desktop->namedview->snap_manager; - s = m.freeSnap(Inkscape::Snapper::BBOX_POINT | Inkscape::Snapper::SNAP_POINT, s, NULL).getPoint(); + s = m.freeSnap(Inkscape::Snapper::BBOX_POINT | Inkscape::Snapper::SNAP_POINT, s, rect).getPoint(); return sp_desktop_root2dt_xy_point(desktop, s); } static void sp_rect_wh_set_internal(SPRect *rect, NR::Point const &p, NR::Point const &origin, guint state) { - NR::Point const s = rect_snap_knot_position(p); + NR::Point const s = rect_snap_knot_position(rect, p); if (state & GDK_CONTROL_MASK) { // original width/height when drag started @@ -420,7 +420,7 @@ static void sp_rect_xy_set(SPItem *item, NR::Point const &p, NR::Point const &or gdouble w_orig = opposite_x - origin[NR::X]; gdouble h_orig = opposite_y - origin[NR::Y]; - NR::Point const s = rect_snap_knot_position(p); + NR::Point const s = rect_snap_knot_position(rect, p); // mouse displacement since drag started gdouble minx = s[NR::X] - origin[NR::X]; diff --git a/src/rect-context.cpp b/src/rect-context.cpp index 8482cd042..b6c331538 100644 --- a/src/rect-context.cpp +++ b/src/rect-context.cpp @@ -330,7 +330,7 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent NR::Point motion_dt(desktop->w2d(motion_w)); SnapManager const &m = desktop->namedview->snap_manager; - motion_dt = m.freeSnap(Inkscape::Snapper::BBOX_POINT | Inkscape::Snapper::SNAP_POINT, motion_dt, NULL).getPoint(); + motion_dt = m.freeSnap(Inkscape::Snapper::BBOX_POINT | Inkscape::Snapper::SNAP_POINT, motion_dt, rc->item).getPoint(); sp_rect_drag(*rc, motion_dt, event->motion.state);