Skip to content
Permalink
Browse files

Fix selection expansion bug when moving

When moving a selection, it would sometimes grow by a pixel in
width and/or height. While it makes sense to want to create a
selection that fully encompasses the selected area as
toAlignedRect does, it results in some confusing and unintuitive
results when adjusting. Rounding as toRect does seems much more
natural when you are using it, and doesn't change the size of your
selections when dragging.
  • Loading branch information...
scribblemaniac committed Apr 12, 2019
1 parent 624b470 commit 673ec0cf7a3872c56cc1439c07cd0497be138f92
Showing with 4 additions and 4 deletions.
  1. +4 −4 core_lib/src/interface/scribblearea.cpp
@@ -1121,8 +1121,8 @@ void ScribbleArea::paintSelectionVisuals(QPainter& painter)
// outline of the transformed selection
painter.setWorldMatrixEnabled(false);
painter.setOpacity(1.0);
mCurrentTransformSelection = mEditor->view()->getView().mapToPolygon(myTempTransformedSelection.toAlignedRect());
mLastTransformSelection = mEditor->view()->getView().mapToPolygon(myTransformedSelection.toAlignedRect());
mCurrentTransformSelection = mEditor->view()->getView().mapToPolygon(myTempTransformedSelection.toRect());
mLastTransformSelection = mEditor->view()->getView().mapToPolygon(myTransformedSelection.toRect());

Layer* layer = mEditor->layers()->currentLayer();
if (layer != nullptr)
@@ -1643,7 +1643,7 @@ void ScribbleArea::paintTransformedSelection()
{
if (layer->type() == Layer::BITMAP)
{
mCanvasPainter.setTransformedSelection(mySelection.toAlignedRect(), selectionTransformation);
mCanvasPainter.setTransformedSelection(mySelection.toRect(), selectionTransformation);
}
else if (layer->type() == Layer::VECTOR)
{
@@ -1746,7 +1746,7 @@ void ScribbleArea::setSelection(QRectF rect)

if (layer->type() == Layer::BITMAP)
{
rect = rect.toAlignedRect();
rect = rect.toRect();
}
mySelection = rect;
myTransformedSelection = rect;

0 comments on commit 673ec0c

Please sign in to comment.
You can’t perform that action at this time.