From baac2d1a0fe737e93750f0d7e68461a329a43616 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Thu, 25 Apr 2019 13:33:31 +0200 Subject: [PATCH] Fix various expandable/dragable/window interactions. [CURA-6478] --- resources/qml/ExpandableComponent.qml | 14 ++++++++++---- .../PrintSetupSelectorContents.qml | 6 +++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index ff40a80cab..936b2e0b22 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -83,6 +83,11 @@ Item contentContainer.visible = !expanded } + function updateDragPosition() + { + contentContainer.trySetPosition(contentContainer.x, contentContainer.y); + } + // Add this binding since the background color is not updated otherwise Binding { @@ -102,7 +107,8 @@ Item { if (!base.enabled && expanded) { - toggleContent() + toggleContent(); + updateDragPosition(); } } } @@ -223,8 +229,8 @@ Item CuraApplication.appHeight() - (contentContainer.height + margin.height)); var initialY = background.height + base.shadowOffset + margin.height; - contentContainer.x = Math.min(maxPt.x, Math.max(minPt.x, posNewX)); - contentContainer.y = Math.min(maxPt.y, Math.max(initialY, posNewY)); + contentContainer.x = Math.max(minPt.x, Math.min(maxPt.x, posNewX)); + contentContainer.y = Math.max(initialY, Math.min(maxPt.y, posNewY)); } ExpandableComponentHeader @@ -248,7 +254,7 @@ Item left: parent.left right: contentHeader.xPosCloseButton } - property variant clickPos: Qt.point(0, 0) + property var clickPos: Qt.point(0, 0) onPressed: { diff --git a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml index 7da0e92bb9..99dca6764b 100644 --- a/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml +++ b/resources/qml/PrintSetupSelector/PrintSetupSelectorContents.qml @@ -143,7 +143,11 @@ Item iconSource: UM.Theme.getIcon("arrow_right") isIconOnRightSide: true visible: currentModeIndex == PrintSetupSelectorContents.Mode.Recommended - onClicked: currentModeIndex = PrintSetupSelectorContents.Mode.Custom + onClicked: + { + currentModeIndex = PrintSetupSelectorContents.Mode.Custom + updateDragPosition(); + } } //Invisible area at the bottom with which you can resize the panel.