mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-30 22:16:14 +00:00
Fixed size limits of item on big images.
This commit is contained in:
@@ -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;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user