From 9430d05cac522fb1953cb134cf603bcd4db6ad6c Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Fri, 25 Oct 2019 15:06:33 +0200 Subject: WIP: center path slider between view controls and action panel CURA-6874 --- .../SimulationView/SimulationViewMainComponent.qml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'plugins/SimulationView') diff --git a/plugins/SimulationView/SimulationViewMainComponent.qml b/plugins/SimulationView/SimulationViewMainComponent.qml index cd7d108370..0cd2027dfa 100644 --- a/plugins/SimulationView/SimulationViewMainComponent.qml +++ b/plugins/SimulationView/SimulationViewMainComponent.qml @@ -18,7 +18,10 @@ Item property bool isSimulationPlaying: false + readonly property var layerSliderSafeYMin: safeArea.y readonly property var layerSliderSafeYMax: safeArea.y + safeArea.height + readonly property var pathSliderSafeXMin: safeArea.x + playButton.width //todo playbutton margin or group button + slider in an item? + readonly property var pathSliderSafeXMax: safeArea.x + safeArea.width visible: UM.SimulationView.layerActivity && CuraApplication.platformActivity @@ -26,13 +29,21 @@ Item PathSlider { id: pathSlider + + readonly property var preferredWidth: UM.Theme.getSize("slider_layerview_size").height // not a typo, should be as long as layerview slider + readonly property var margin: UM.Theme.getSize("default_margin").width + readonly property var pathSliderSafeWidth: pathSliderSafeXMax - pathSliderSafeXMin + height: UM.Theme.getSize("slider_handle").width - width: UM.Theme.getSize("slider_layerview_size").height + width: preferredWidth + margin * 2 < pathSliderSafeWidth ? preferredWidth : pathSliderSafeWidth - margin * 2 + anchors.bottom: parent.bottom - anchors.bottomMargin: UM.Theme.getSize("default_margin").height + anchors.bottomMargin: margin anchors.horizontalCenter: parent.horizontalCenter + anchors.horizontalCenterOffset: -(parent.width - pathSliderSafeXMax - pathSliderSafeXMin) / 2 // center between parent top and layerSliderSafeYMax + visible: !UM.SimulationView.compatibilityMode @@ -184,16 +195,19 @@ Item { property var preferredHeight: UM.Theme.getSize("slider_layerview_size").height property double heightMargin: UM.Theme.getSize("default_margin").height + property double layerSliderSafeHeight: layerSliderSafeYMax - layerSliderSafeYMin + //todo incorporate margins in safeHeight? + id: layerSlider width: UM.Theme.getSize("slider_handle").width - height: preferredHeight + heightMargin * 2 < layerSliderSafeYMax ? preferredHeight : layerSliderSafeYMax - heightMargin * 2 + height: preferredHeight + heightMargin * 2 < layerSliderSafeHeight ? preferredHeight : layerSliderSafeHeight - heightMargin * 2 anchors { right: parent.right verticalCenter: parent.verticalCenter - verticalCenterOffset: -(parent.height - layerSliderSafeYMax) / 2 // center between parent top and layerSliderSafeYMax + verticalCenterOffset: -(parent.height - layerSliderSafeYMax - layerSliderSafeYMin) / 2 // center between parent top and layerSliderSafeYMax rightMargin: UM.Theme.getSize("default_margin").width bottomMargin: heightMargin topMargin: heightMargin -- cgit v1.2.3 From d59a343b3f4020e2ff9742376378d143b4f59ad3 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Mon, 28 Oct 2019 09:59:30 +0100 Subject: Update simulation slider handle position after width change CURA-6874 --- plugins/SimulationView/PathSlider.qml | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'plugins/SimulationView') diff --git a/plugins/SimulationView/PathSlider.qml b/plugins/SimulationView/PathSlider.qml index c7a43c6407..facdbb6a53 100644 --- a/plugins/SimulationView/PathSlider.qml +++ b/plugins/SimulationView/PathSlider.qml @@ -56,6 +56,11 @@ Item return Math.min(Math.max(value, sliderRoot.minimumValue), sliderRoot.maximumValue) } + onWidthChanged : { + // After a width change, the pixel-position of the handle is out of sync with the property value + setHandleValue(handleValue) + } + // slider track Rectangle { -- cgit v1.2.3 From 958a92280845ba9833ca3dae5b86cecd8b0aaf24 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Wed, 30 Oct 2019 10:54:22 +0100 Subject: Cleanup debugging things for cura-6874 CURA-6874 --- plugins/SimulationView/SimulationViewMainComponent.qml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'plugins/SimulationView') diff --git a/plugins/SimulationView/SimulationViewMainComponent.qml b/plugins/SimulationView/SimulationViewMainComponent.qml index 0cd2027dfa..3b70c69e82 100644 --- a/plugins/SimulationView/SimulationViewMainComponent.qml +++ b/plugins/SimulationView/SimulationViewMainComponent.qml @@ -18,10 +18,10 @@ Item property bool isSimulationPlaying: false - readonly property var layerSliderSafeYMin: safeArea.y - readonly property var layerSliderSafeYMax: safeArea.y + safeArea.height - readonly property var pathSliderSafeXMin: safeArea.x + playButton.width //todo playbutton margin or group button + slider in an item? - readonly property var pathSliderSafeXMax: safeArea.x + safeArea.width + readonly property real layerSliderSafeYMin: safeArea.y + readonly property real layerSliderSafeYMax: safeArea.y + safeArea.height + readonly property real pathSliderSafeXMin: safeArea.x + playButton.width + readonly property real pathSliderSafeXMax: safeArea.x + safeArea.width visible: UM.SimulationView.layerActivity && CuraApplication.platformActivity @@ -30,9 +30,9 @@ Item { id: pathSlider - readonly property var preferredWidth: UM.Theme.getSize("slider_layerview_size").height // not a typo, should be as long as layerview slider - readonly property var margin: UM.Theme.getSize("default_margin").width - readonly property var pathSliderSafeWidth: pathSliderSafeXMax - pathSliderSafeXMin + readonly property real preferredWidth: UM.Theme.getSize("slider_layerview_size").height // not a typo, should be as long as layerview slider + readonly property real margin: UM.Theme.getSize("default_margin").width + readonly property real pathSliderSafeWidth: pathSliderSafeXMax - pathSliderSafeXMin height: UM.Theme.getSize("slider_handle").width width: preferredWidth + margin * 2 < pathSliderSafeWidth ? preferredWidth : pathSliderSafeWidth - margin * 2 -- cgit v1.2.3