Code

Snapping of axonometric grid: correctly snap to vertical gridline. angled lines not...
authorjohanengelen <johanengelen@users.sourceforge.net>
Sun, 2 Dec 2007 23:17:00 +0000 (23:17 +0000)
committerjohanengelen <johanengelen@users.sourceforge.net>
Sun, 2 Dec 2007 23:17:00 +0000 (23:17 +0000)
src/display/canvas-axonomgrid.cpp

index 698211b6c109e90e511b70a5829a7d601aa588eb..cd79e00bd538db52a788a378af98ec080a4065b2 100644 (file)
@@ -640,23 +640,20 @@ CanvasAxonomGridSnapper::_getSnapLines(NR::Point const &p) const
         return s;
     }
 
-    for (unsigned int i = 0; i < 2; ++i) {
+    /* This is to make sure we snap to only visible grid lines */
+    double scaled_spacing = grid->spacing_ylines; // this is spacing of visible lines if screen pixels
 
-        /* This is to make sure we snap to only visible grid lines */
-        double scaled_spacing = grid->sw[i]; // this is spacing of visible lines if screen pixels
-
-        // convert screen pixels to px
-        // FIXME: after we switch to snapping dist in screen pixels, this will be unnecessary
-        if (SP_ACTIVE_DESKTOP) {
-            scaled_spacing /= SP_ACTIVE_DESKTOP->current_zoom();
-        }
+    // convert screen pixels to px
+    // FIXME: after we switch to snapping dist in screen pixels, this will be unnecessary
+    if (SP_ACTIVE_DESKTOP) {
+        scaled_spacing /= SP_ACTIVE_DESKTOP->current_zoom();
+    }
 
-        NR::Coord const rounded = round_to_nearest_multiple_plus(p[i],
-                                                                 scaled_spacing,
-                                                                 grid->origin[i]);
+    NR::Coord const rounded = round_to_nearest_multiple_plus(p[0],
+                                                             scaled_spacing,
+                                                             grid->origin[0]);
 
-        s.push_back(std::make_pair(NR::Dim2(i), rounded));
-    }
+    s.push_back(std::make_pair(NR::Dim2(0), rounded));
 
     return s;
 }