Fixed size limits of item on big images.

This commit is contained in:
23rd 2021-03-21 20:22:22 +03:00
parent 36e5056b59
commit 1504f92a64
2 changed files with 10 additions and 2 deletions

View file

@ -74,6 +74,10 @@ ItemBase::ItemBase(
_scaledHandleSize,
_scaledHandleSize,
_scaledHandleSize) * 0.5;
_sizeLimits = {
.min = int(st::photoEditorItemMinSize / zoom),
.max = int(st::photoEditorItemMaxSize / zoom),
};
}, _lifetime);
}
@ -124,8 +128,8 @@ void ItemBase::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
prepareGeometryChange();
_horizontalSize = std::clamp(
(dx > dy ? dx : dy),
st::photoEditorItemMinSize,
st::photoEditorItemMaxSize);
_sizeLimits.min,
_sizeLimits.max);
updateVerticalSize();
}

View file

@ -90,6 +90,10 @@ private:
base::unique_qptr<Ui::PopupMenu> _menu;
struct {
int min = 0.;
int max = 0.;
} _sizeLimits;
float64 _scaledHandleSize = 1.0;
QMarginsF _scaledInnerMargins;