Code

enable motion hints for non-freehand actions
[inkscape.git] / src / arc-context.cpp
index b06b5fb86d879e0b23f31209c653d62c3c34a696..0be96353e80ca6d3beab5cf3873e5741b4513fb1 100644 (file)
@@ -123,7 +123,7 @@ static void sp_arc_context_dispose(GObject *object)
     ac->sel_changed_connection.~connection();
 
     if (ec->shape_knot_holder) {
-        sp_knot_holder_destroy(ec->shape_knot_holder);
+        delete ec->shape_knot_holder;
         ec->shape_knot_holder = NULL;
     }
 
@@ -161,7 +161,7 @@ void sp_arc_context_selection_changed(Inkscape::Selection * selection, gpointer
     SPEventContext *ec = SP_EVENT_CONTEXT(ac);
 
     if (ec->shape_knot_holder) { // desktroy knotholder
-        sp_knot_holder_destroy(ec->shape_knot_holder);
+        delete ec->shape_knot_holder;
         ec->shape_knot_holder = NULL;
     }
 
@@ -262,14 +262,15 @@ 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);
                 
+                /* Snap center */
+                SnapManager &m = desktop->namedview->snap_manager;
+                m.setup(desktop, NULL); //null, because we don't have an item yet
+                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,
+                                    GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK,
                                     NULL, event->button.time);
                 ret = TRUE;
             }
@@ -290,10 +291,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);
@@ -453,7 +450,7 @@ static void sp_arc_drag(SPArcContext *ac, NR::Point pt, guint state)
         NR::Point c = r.midpoint();
         if (!ctrl_save) {
             if (fabs(dir[NR::X]) > 1E-6 && fabs(dir[NR::Y]) > 1E-6) {
-                NR::Matrix const i2d (sp_item_i2d_affine (ac->item));
+                NR::Matrix const i2d (from_2geom(sp_item_i2d_affine (ac->item)));
                 NR::Point new_dir = pt * i2d - c;
                 new_dir[NR::X] *= dir[NR::Y] / dir[NR::X];
                 double lambda = NR::L2(new_dir) / dir[NR::Y];