mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-09 06:45:09 -06:00
Limit draggable component to the main window.
This commit is contained in:
parent
28a14c0a3b
commit
37fddaee5c
2 changed files with 19 additions and 3 deletions
|
@ -245,10 +245,16 @@ Item
|
|||
onPositionChanged:
|
||||
{
|
||||
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y);
|
||||
if (delta.x != 0 || delta.y != 0)
|
||||
if (delta.x !== 0 || delta.y !== 0)
|
||||
{
|
||||
contentContainer.x += delta.x;
|
||||
contentContainer.y += delta.y;
|
||||
var minPt = base.mapFromItem(null, 0, 0);
|
||||
var maxPt = base.mapFromItem(null,
|
||||
CuraApplication.appWidth() - contentContainer.width,
|
||||
CuraApplication.appHeight() - contentContainer.height);
|
||||
var initialY = background.height + base.shadowOffset + base.contentSpacingY;
|
||||
|
||||
contentContainer.x = Math.min(maxPt.x, Math.max(minPt.x, contentContainer.x + delta.x));
|
||||
contentContainer.y = Math.min(maxPt.y, Math.max(initialY, contentContainer.y + delta.y));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue