diff options
author | Nino van Hooff <ninovanhooff@gmail.com> | 2019-11-01 12:51:21 +0300 |
---|---|---|
committer | Nino van Hooff <ninovanhooff@gmail.com> | 2019-11-01 12:51:21 +0300 |
commit | 94d291a20c3e5e9bd84d3476cd8844bd9bf8930c (patch) | |
tree | d322550e0a12c0661fec06bfa1b1e573b732c94b /plugins/SimulationView | |
parent | 888c3f51a5718c80f9b3736aa86e5953e1c4ed8d (diff) | |
parent | 71fe01d7f20b76a79ff7b259b97fe13a4afa98c2 (diff) |
Merge branch 'master' into CURA-6854_align_layer_label_top_bottom
# Conflicts:
# plugins/SimulationView/SimulationViewMainComponent.qml
Diffstat (limited to 'plugins/SimulationView')
-rw-r--r-- | plugins/SimulationView/PathSlider.qml | 5 | ||||
-rw-r--r-- | plugins/SimulationView/SimulationViewMainComponent.qml | 23 |
2 files changed, 23 insertions, 5 deletions
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 { diff --git a/plugins/SimulationView/SimulationViewMainComponent.qml b/plugins/SimulationView/SimulationViewMainComponent.qml index 8d32e50654..bfd8799673 100644 --- a/plugins/SimulationView/SimulationViewMainComponent.qml +++ b/plugins/SimulationView/SimulationViewMainComponent.qml @@ -18,7 +18,10 @@ Item property bool isSimulationPlaying: false - readonly property var layerSliderSafeYMax: safeArea.y + safeArea.height + 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 @@ -26,13 +29,21 @@ Item PathSlider { id: pathSlider + + 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: 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,18 @@ Item { property var preferredHeight: UM.Theme.getSize("slider_layerview_size").height property double heightMargin: UM.Theme.getSize("default_margin").height * 3 // extra margin to accomodate layer number tooltips + property double layerSliderSafeHeight: layerSliderSafeYMax - layerSliderSafeYMin + 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 |