mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-01 23:54:13 +02:00
Merge pull request #1192 from ispyisail/fix/editor-resize-zero-undo
Fix bugtracker #266: undo of a resize to zero width does nothing
This commit is contained in:
@@ -527,6 +527,12 @@ void ElementPrimitiveDecorator::handlerMouseMoveEvent(QetGraphicsHandlerItem *qg
|
||||
{
|
||||
Q_UNUSED(qghi);
|
||||
|
||||
// A selection with no width or height cannot be scaled (see
|
||||
// scaleItems()); resizing it would only record a bogus undo step.
|
||||
if (!original_bounding_rect_.width() || !original_bounding_rect_.height()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QPointF scene_pos = event -> scenePos();
|
||||
QPointF movement = scene_pos - latest_pos_;
|
||||
|
||||
@@ -564,8 +570,15 @@ void ElementPrimitiveDecorator::handlerMouseMoveEvent(QetGraphicsHandlerItem *qg
|
||||
movement = rounded_scene_pos - current_position;
|
||||
}
|
||||
|
||||
QRectF scaled_rect = modified_bounding_rect_;
|
||||
applyMovementToRect(current_operation_square_, movement, scaled_rect);
|
||||
// A rect with no width or height cannot be scaled back from, so the
|
||||
// resize could never be undone: keep the last usable size instead.
|
||||
if (!scaled_rect.width() || !scaled_rect.height()) {
|
||||
return;
|
||||
}
|
||||
QRectF bounding_rect = modified_bounding_rect_;
|
||||
applyMovementToRect(current_operation_square_, movement, modified_bounding_rect_);
|
||||
modified_bounding_rect_ = scaled_rect;
|
||||
if (modified_bounding_rect_ != bounding_rect) {
|
||||
adjustEffectiveBoundingRect();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user