mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fixed size limits of item on big images.
This commit is contained in:
parent
36e5056b59
commit
1504f92a64
2 changed files with 10 additions and 2 deletions
|
@ -74,6 +74,10 @@ ItemBase::ItemBase(
|
||||||
_scaledHandleSize,
|
_scaledHandleSize,
|
||||||
_scaledHandleSize,
|
_scaledHandleSize,
|
||||||
_scaledHandleSize) * 0.5;
|
_scaledHandleSize) * 0.5;
|
||||||
|
_sizeLimits = {
|
||||||
|
.min = int(st::photoEditorItemMinSize / zoom),
|
||||||
|
.max = int(st::photoEditorItemMaxSize / zoom),
|
||||||
|
};
|
||||||
}, _lifetime);
|
}, _lifetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,8 +128,8 @@ void ItemBase::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
_horizontalSize = std::clamp(
|
_horizontalSize = std::clamp(
|
||||||
(dx > dy ? dx : dy),
|
(dx > dy ? dx : dy),
|
||||||
st::photoEditorItemMinSize,
|
_sizeLimits.min,
|
||||||
st::photoEditorItemMaxSize);
|
_sizeLimits.max);
|
||||||
updateVerticalSize();
|
updateVerticalSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,10 @@ private:
|
||||||
|
|
||||||
base::unique_qptr<Ui::PopupMenu> _menu;
|
base::unique_qptr<Ui::PopupMenu> _menu;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
int min = 0.;
|
||||||
|
int max = 0.;
|
||||||
|
} _sizeLimits;
|
||||||
float64 _scaledHandleSize = 1.0;
|
float64 _scaledHandleSize = 1.0;
|
||||||
QMarginsF _scaledInnerMargins;
|
QMarginsF _scaledInnerMargins;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue