From 5353c15d627f9aac318f1856bf49e26462c124fb Mon Sep 17 00:00:00 2001 From: morro Date: Wed, 5 Dec 2018 19:19:40 +0100 Subject: [PATCH] undo improvements; rotation handle improvements --- src/control/tools/EditSelection.cpp | 12 +++++++----- src/control/tools/EditSelectionContents.cpp | 5 +++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/control/tools/EditSelection.cpp b/src/control/tools/EditSelection.cpp index 9faa35cc..d92286f3 100644 --- a/src/control/tools/EditSelection.cpp +++ b/src/control/tools/EditSelection.cpp @@ -319,6 +319,8 @@ void EditSelection::mouseUp() PageRef page = this->view->getPage(); Layer* layer = page->getSelectedLayer(); + printf("EditSelection::mouseUp\n"); + this->contents->updateContent(this->x, this->y, this->width, this->height, this->aspectRatio, layer, page, this->view, this->undo, this->mouseDownType); @@ -597,6 +599,11 @@ CursorSelectionType EditSelection::getSelectionTypeForPos(double x, double y, do return CURSOR_SELECTION_BOTTOM_RIGHT; } + if (x2 + BORDER_PADDING + 8 <= x && x <= x2 + BORDER_PADDING + 16 && (y2 + y1)/2 - 4 <= y && (y2 + y1)/2 + 4 >= y ) + { + return CURSOR_SELECTION_ROTATE; + } + if (!this->aspectRatio) { if (x1 <= x && x2 >= x) @@ -623,11 +630,6 @@ CursorSelectionType EditSelection::getSelectionTypeForPos(double x, double y, do { return CURSOR_SELECTION_RIGHT; } - - if (x2+16 - BORDER_PADDING <= x && x <= x2+16 + BORDER_PADDING) - { - return CURSOR_SELECTION_ROTATE; - } } } diff --git a/src/control/tools/EditSelectionContents.cpp b/src/control/tools/EditSelectionContents.cpp index 0b04496a..918cc179 100644 --- a/src/control/tools/EditSelectionContents.cpp +++ b/src/control/tools/EditSelectionContents.cpp @@ -324,6 +324,7 @@ double EditSelectionContents::getOriginalHeight() void EditSelectionContents::finalizeSelection(double x, double y, double width, double height, bool aspectRatio, Layer* layer, PageRef targetPage, XojPageView* targetView, UndoRedoHandler* undo) { + printf("EditSelectionContents::finalizeSelection\n"); double fx = width / this->originalWidth; double fy = height / this->originalHeight; @@ -353,7 +354,7 @@ void EditSelectionContents::finalizeSelection(double x, double y, double width, } if (rotate) { - e->rotate(x, y, this->originalWidth / 2, this->originalHeight / 2, this->rotation); + e->rotate(x, y, this->lastWidth / 2, this->lastHeight / 2, this->rotation); } layer->addElement(e); } @@ -425,7 +426,7 @@ void EditSelectionContents::updateContent(double x, double y, double width, doub default: break; } - printf("adding ScaleUndoAction for object\n"); + printf("EditSelectionContents::updateContent - adding ScaleUndoAction for object\n"); ScaleUndoAction* scaleUndo = new ScaleUndoAction(this->sourcePage, &this->selected, px, py, fx, fy); undo->addUndoAction(scaleUndo);