diff --git a/application/sources/document.h b/application/sources/document.h index e60173c9..7d22120f 100644 --- a/application/sources/document.h +++ b/application/sources/document.h @@ -31,10 +31,7 @@ public: enum class EditMode { Add = 0, Select, - Paint, - Drag, - ZoomIn, - ZoomOut + Pick }; enum class SnapshotFor { diff --git a/application/sources/document_window.cc b/application/sources/document_window.cc index 7f7184e4..23172ba4 100644 --- a/application/sources/document_window.cc +++ b/application/sources/document_window.cc @@ -1300,7 +1300,6 @@ void DocumentWindow::initializeToolShortcuts(SkeletonGraphicsWidget* graphicsWid defineShortcut(Qt::Key_Y, graphicsWidget, &SkeletonGraphicsWidget::shortcutYlock); defineShortcut(Qt::Key_X, graphicsWidget, &SkeletonGraphicsWidget::shortcutXlock); defineShortcut(Qt::Key_S, graphicsWidget, &SkeletonGraphicsWidget::shortcutSelectMode); - defineShortcut(Qt::Key_D, graphicsWidget, &SkeletonGraphicsWidget::shortcutPaintMode); defineShortcut(Qt::Key_R, graphicsWidget, &SkeletonGraphicsWidget::shortcutToggleRotation); defineShortcut(Qt::Key_O, graphicsWidget, &SkeletonGraphicsWidget::shortcutToggleFlatShading); defineShortcut(Qt::Key_W, graphicsWidget, &SkeletonGraphicsWidget::shortcutToggleWireframe); diff --git a/application/sources/skeleton_graphics_widget.cc b/application/sources/skeleton_graphics_widget.cc index bfcc414f..48735a94 100644 --- a/application/sources/skeleton_graphics_widget.cc +++ b/application/sources/skeleton_graphics_widget.cc @@ -105,7 +105,7 @@ void SkeletonGraphicsWidget::shortcutEscape() if (!isVisible()) return; - if (Document::EditMode::Add == m_document->editMode || Document::EditMode::Paint == m_document->editMode) { + if (Document::EditMode::Select != m_document->editMode) { emit setEditMode(Document::EditMode::Select); return; } @@ -700,6 +700,14 @@ void SkeletonGraphicsWidget::updateCursor() } // Set cursor here if needed + switch (m_document->editMode) { + case Document::EditMode::Pick: + setCursor(Qt::CrossCursor); + break; + default: + unsetCursor(); + break; + } emit cursorChanged(); } @@ -1384,29 +1392,7 @@ QPointF SkeletonGraphicsWidget::mouseEventScenePos(QMouseEvent* event) bool SkeletonGraphicsWidget::mousePress(QMouseEvent* event) { if (event->button() == Qt::LeftButton) { - if (Document::EditMode::ZoomIn == m_document->editMode) { - ViewportAnchor lastAnchor = transformationAnchor(); - setTransformationAnchor(QGraphicsView::AnchorUnderMouse); - scale(1.25, 1.25); - setTransformationAnchor(lastAnchor); - return true; - } else if (Document::EditMode::ZoomOut == m_document->editMode) { - ViewportAnchor lastAnchor = transformationAnchor(); - setTransformationAnchor(QGraphicsView::AnchorUnderMouse); - scale(0.8, 0.8); - setTransformationAnchor(lastAnchor); - //if ((!verticalScrollBar() || !verticalScrollBar()->isVisible()) && - // (!horizontalScrollBar() || !horizontalScrollBar()->isVisible())) { - // setTransform(QTransform()); - //} - return true; - } else if (Document::EditMode::Drag == m_document->editMode) { - if (!m_dragStarted) { - m_lastGlobalPos = event->globalPos(); - m_dragStarted = true; - updateCursor(); - } - } else if (Document::EditMode::Add == m_document->editMode) { + if (Document::EditMode::Add == m_document->editMode) { if (m_cursorNodeItem->isVisible()) { if (m_addFromNodeItem) { if (m_hoveredNodeItem && m_addFromNodeItem && m_hoveredNodeItem != m_addFromNodeItem && m_hoveredNodeItem->profile() == m_addFromNodeItem->profile() && !m_document->findEdgeByNodes(m_addFromNodeItem->id(), m_hoveredNodeItem->id()) && m_document->isNodeEditable(m_hoveredNodeItem->id())) { @@ -1748,11 +1734,6 @@ void SkeletonGraphicsWidget::shortcutSelectMode() emit setEditMode(Document::EditMode::Select); } -void SkeletonGraphicsWidget::shortcutPaintMode() -{ - emit setEditMode(Document::EditMode::Paint); -} - void SkeletonGraphicsWidget::shortcutZoomRenderedModelByMinus10() { if (!isVisible()) @@ -2022,28 +2003,11 @@ void SkeletonGraphicsWidget::shortcutRoundEndOrNotSelectedPart() bool SkeletonGraphicsWidget::keyPress(QKeyEvent* event) { - if (event->key() == Qt::Key_Space) { - if (Document::EditMode::ZoomIn == m_document->editMode || Document::EditMode::ZoomOut == m_document->editMode || Document::EditMode::Select == m_document->editMode || Document::EditMode::Add == m_document->editMode) { - m_inTempDragMode = true; - m_modeBeforeEnterTempDragMode = m_document->editMode; - emit setEditMode(Document::EditMode::Drag); - return true; - } - } - return false; } bool SkeletonGraphicsWidget::keyRelease(QKeyEvent* event) { - if (event->key() == Qt::Key_Space) { - if (m_inTempDragMode) { - m_inTempDragMode = false; - emit setEditMode(m_modeBeforeEnterTempDragMode); - return true; - } - } - return false; } diff --git a/application/sources/skeleton_graphics_widget.h b/application/sources/skeleton_graphics_widget.h index 39e67ab5..38c95aba 100644 --- a/application/sources/skeleton_graphics_widget.h +++ b/application/sources/skeleton_graphics_widget.h @@ -185,7 +185,6 @@ public slots: void shortcutCopy(); void shortcutPaste(); void shortcutSelectMode(); - void shortcutPaintMode(); void shortcutZoomRenderedModelByMinus10(); void shortcutZoomSelectedByMinus1(); void shortcutZoomRenderedModelBy10(); @@ -270,8 +269,6 @@ private: QTimer* m_deferredRemoveTimer = nullptr; bool m_eventForwardingToModelWidget = false; ModelWidget* m_modelWidget = nullptr; - bool m_inTempDragMode = false; - Document::EditMode m_modeBeforeEnterTempDragMode = Document::EditMode::Select; float m_turnaroundOpacity = 0.25f; bool m_rotated = false; QImage* m_backgroundImage = nullptr;