Code

Eliminate some redundant snapping calls
authordvlierop2 <dvlierop2@users.sourceforge.net>
Sun, 18 May 2008 20:01:38 +0000 (20:01 +0000)
committerdvlierop2 <dvlierop2@users.sourceforge.net>
Sun, 18 May 2008 20:01:38 +0000 (20:01 +0000)
src/arc-context.cpp
src/rect-context.cpp

index b06b5fb86d879e0b23f31209c653d62c3c34a696..45b67a7dcbc5e8a0e85a276c2f2ddb7320dbc77d 100644 (file)
@@ -263,10 +263,6 @@ static gint sp_arc_context_root_handler(SPEventContext *event_context, GdkEvent
                 dragging = true;
                 ac->center = Inkscape::setup_for_drag_start(desktop, event_context, event);
 
-                SnapManager &m = desktop->namedview->snap_manager;
-                m.setup(desktop, ac->item);                
-                m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, ac->center);
-                
                 sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
                                     GDK_KEY_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
                                     GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK,
@@ -290,10 +286,6 @@ static gint sp_arc_context_root_handler(SPEventContext *event_context, GdkEvent
                 NR::Point const motion_w(event->motion.x, event->motion.y);
                 NR::Point motion_dt(desktop->w2d(motion_w));
                 
-                SnapManager &m = desktop->namedview->snap_manager;
-                m.setup(desktop, ac->item);            
-                m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, motion_dt);
-
                 sp_arc_drag(ac, motion_dt, event->motion.state);
 
                 gobble_motion_events(GDK_BUTTON1_MASK);
@@ -433,6 +425,11 @@ static void sp_arc_drag(SPArcContext *ac, NR::Point pt, guint state)
         ac->item->updateRepr();
 
         sp_canvas_force_full_redraw_after_interruptions(desktop->canvas, 5);
+        
+        /* Snap center */
+        SnapManager &m = desktop->namedview->snap_manager;
+        m.setup(desktop, ac->item);
+        m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, ac->center);
     }
 
     bool ctrl_save = false;
index 3ecd89113724f9a81fdfb2cf6115b2e26117ecbd..d1e5fe3817a66c0e4d7fb98b2b62feede493ec7d 100644 (file)
@@ -328,14 +328,9 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent
             // motion notify coordinates as given (no snapping back to origin)
             event_context->within_tolerance = false;
 
-            NR::Point const motion_w(event->motion.x,
-                                     event->motion.y);
+            NR::Point const motion_w(event->motion.x, event->motion.y);
             NR::Point motion_dt(desktop->w2d(motion_w));
             
-            //SnapManager &m = desktop->namedview->snap_manager;
-            //m.setup(desktop, rc->item);
-            //m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, motion_dt);
-            
             sp_rect_drag(*rc, motion_dt, event->motion.state); // this will also handle the snapping
             gobble_motion_events(GDK_BUTTON1_MASK);
             ret = TRUE;