Code

First stage of draggable vanishing points (no snapping/unsnapping yet)
[inkscape.git] / src / box3d-context.cpp
index 5f1029576a6420e68a545fb61aa691f424f3a47f..3096ad17985c268d9e3ed897a8d62cb037082be4 100644 (file)
@@ -113,6 +113,8 @@ static void sp_3dbox_context_init(SP3DBoxContext *box3d_context)
     box3d_context->ctrl_dragged = false;
     box3d_context->extruded = false;
     
+    box3d_context->_vpdrag = NULL;
+
     new (&box3d_context->sel_changed_connection) sigc::connection();
 }
 
@@ -123,6 +125,9 @@ static void sp_3dbox_context_dispose(GObject *object)
 
     ec->enableGrDrag(false);
 
+    delete (bc->_vpdrag);
+    bc->_vpdrag = NULL;
+
     bc->sel_changed_connection.disconnect();
     bc->sel_changed_connection.~connection();
 
@@ -213,6 +218,8 @@ static void sp_3dbox_context_setup(SPEventContext *ec)
         sigc::bind(sigc::ptr_fun(&sp_3dbox_context_selection_changed), (gpointer)bc)
     );
 
+    bc->_vpdrag = new Box3D::VPDrag(ec->desktop);
+
     if (prefs_get_int_attribute("tools.shapes", "selcue", 0) != 0) {
         ec->enableSelectionCue();
     }
@@ -520,6 +527,9 @@ static void sp_3dbox_drag(SP3DBoxContext &bc, guint state)
         }
 
         bc.item->updateRepr();
+        // TODO: It would be nice to show the VPs during dragging, but since there is no selection
+        //       at this point (only after finishing the box), we must do this "manually"
+        bc._vpdrag->updateDraggers();
 
         sp_canvas_force_full_redraw_after_interruptions(desktop->canvas, 5);
     }