undo improvements; rotation handle improvements

presentation
morro 7 years ago
parent 8afa48ce95
commit 5353c15d62
  1. 12
      src/control/tools/EditSelection.cpp
  2. 5
      src/control/tools/EditSelectionContents.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;
}
}
}

@ -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);

Loading…
Cancel
Save