Code

fix by dvlierop2 for snapping bugs 1579556 and 1579587
authorbuliabyak <buliabyak@users.sourceforge.net>
Mon, 5 Mar 2007 21:30:04 +0000 (21:30 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Mon, 5 Mar 2007 21:30:04 +0000 (21:30 +0000)
src/selection.h
src/seltrans.cpp
src/seltrans.h
src/ui/dialog/inkscape-preferences.cpp

index 1dcaa53ff3d836082dc63d253d128dcd6171b524..bae368e8149461633866d43967deec77247e35a6 100644 (file)
@@ -273,7 +273,7 @@ public:
     std::vector<NR::Point> getBBoxPoints() const;
 
     /**
-     * @return A vector containing the 2 (top-left and bottom-right)
+     * @return A vector containing the 2 (bottom-left and upper-right)
      * corners of the selection bounding box.
      */
     std::vector<NR::Point> getBBoxPointsOuter() const;
index cd68399b03d6315f93b12e29302b8678f89ffb86..067c648598ceeb96d42d67779c5b6dce523010c0 100644 (file)
@@ -259,6 +259,9 @@ void Inkscape::SelTrans::grab(NR::Point const &p, gdouble x, gdouble y, bool sho
 
     _snap_points = selection->getSnapPointsConvexHull();
     _bbox_points = selection->getBBoxPointsOuter();
+    _bbox_4points = _bbox_points;
+    _bbox_4points.push_back(NR::Point(_bbox_points[0][NR::X], _bbox_points[1][NR::Y]));
+    _bbox_4points.push_back(NR::Point(_bbox_points[1][NR::X], _bbox_points[0][NR::Y]));
 
     gchar const *scale_origin = prefs_get_string_attribute("tools.select", "scale_origin");
     bool const origin_on_bbox = (scale_origin == NULL || !strcmp(scale_origin, "bbox"));
@@ -860,7 +863,7 @@ gboolean Inkscape::SelTrans::scaleRequest(NR::Point &pt, guint state)
         /* Scale aspect ratio is unlocked */
         
         std::pair<NR::scale, bool> bb = m.freeSnapScale(Snapper::BBOX_POINT,
-                                                        _bbox_points,
+                                                        _bbox_4points,
                                                         it,
                                                         s,
                                                         _origin);
@@ -870,7 +873,7 @@ gboolean Inkscape::SelTrans::scaleRequest(NR::Point &pt, guint state)
                                                         s,
                                                         _origin);
 
-        /* Pick the snap that puts us closest to the original scale */
+       /* Pick the snap that puts us closest to the original scale */
         NR::Coord bd = bb.second ?
             fabs(NR::L2(NR::Point(bb.first[NR::X], bb.first[NR::Y])) -
                  NR::L2(NR::Point(s[NR::X], s[NR::Y])))
@@ -1406,7 +1409,7 @@ void Inkscape::SelTrans::moveTo(NR::Point const &xy, guint state)
             /* Snap to things with no constraint */
 
             s.push_back(m.freeSnapTranslation(Inkscape::Snapper::BBOX_POINT,
-                                              _bbox_points, it, dxy));
+                                              _bbox_4points, it, dxy));
             s.push_back(m.freeSnapTranslation(Inkscape::Snapper::SNAP_POINT,
                                               _snap_points, it, dxy));
         }
index 3ba56ffb4ce18223a5821073c7dacb71f6feab48..8d527ca5c76d05979147d6e4d799fd8f5eddcce4 100644 (file)
@@ -105,6 +105,7 @@ private:
     
     std::vector<NR::Point> _snap_points;
     std::vector<NR::Point> _bbox_points;
+    std::vector<NR::Point> _bbox_4points;
     
     Inkscape::SelCue _selcue;
 
index 16be12449b8752582f89dea769ac9556f79c01e6..1eb38f99a034bab3f6eca1c87e29f009ed50a51b 100644 (file)
@@ -175,10 +175,12 @@ void InkscapePreferences::initPageSteps()
 {
     this->AddPage(_page_steps, _("Steps"), PREFS_PAGE_STEPS);
 
-    _steps_arrow.init ( "options.nudgedistance", "value", 0.0, 3000.0, 0.01, 1.0, 2.0, false, false);
+    _steps_arrow.init ( "options.nudgedistance", "value", 0.0, 1000.0, 0.01, 1.0, 2.0, false, false);
+    //nudgedistance is limited to 1000 in select-context.cpp: use the same limit here
     _page_steps.add_line( false, _("Arrow keys move by:"), _steps_arrow, _("px"), 
                           _("Pressing an arrow key moves selected object(s) or node(s) by this distance (in px units)"), false);
-    _steps_scale.init ( "options.defaultscale", "value", 0.0, 3000.0, 0.01, 1.0, 2.0, false, false);
+    _steps_scale.init ( "options.defaultscale", "value", 0.0, 1000.0, 0.01, 1.0, 2.0, false, false);
+    //defaultscale is limited to 1000 in select-context.cpp: use the same limit here 
     _page_steps.add_line( false, _("> and < scale by:"), _steps_scale, _("px"), 
                           _("Pressing > or < scales selection up or down by this increment (in px units)"), false);
     _steps_inset.init ( "options.defaultoffsetwidth", "value", 0.0, 3000.0, 0.01, 1.0, 2.0, false, false);