diff --git a/plugins/LayerView/LayerView.qml b/plugins/LayerView/LayerView.qml index b26d301648..e8af832267 100644 --- a/plugins/LayerView/LayerView.qml +++ b/plugins/LayerView/LayerView.qml @@ -25,11 +25,72 @@ Item maximumValue: UM.LayerView.numLayers; stepSize: 1 + property real pixelsPerStep: ((height - UM.Theme.getSize("slider_handle").height) / (maximumValue - minimumValue)) * stepSize; + value: UM.LayerView.currentLayer onValueChanged: UM.LayerView.setCurrentLayer(value) - style: UM.Theme.styles.layerViewSlider + style: UM.Theme.styles.slider; + + Rectangle + { + x: parent.width + UM.Theme.getSize("default_margin").width; + y: parent.height - (parent.value * parent.pixelsPerStep) - UM.Theme.getSize("slider_handle").height * 1.25; + + height: UM.Theme.getSize("slider_handle").height + UM.Theme.getSize("default_margin").height + width: valueLabel.width + (busyIndicator.visible ? busyIndicator.width : 0) + UM.Theme.getSize("default_margin").width + Behavior on height { NumberAnimation { duration: 50; } } + + border.width: UM.Theme.getSize("default_lining").width; + border.color: UM.Theme.getColor("slider_groove_border"); + + visible: UM.LayerView.getLayerActivity && Printer.getPlatformActivity ? true : false + + TextField + { + id: valueLabel + property string maxValue: slider.maximumValue + 1 + text: slider.value + 1 + horizontalAlignment: TextInput.AlignRight; + onEditingFinished: + { + if(valueLabel.text != '') + { + slider.value = valueLabel.text - 1 + } + } + validator: IntValidator { bottom: 1; top: slider.maximumValue + 1; } + + anchors.left: parent.left; + anchors.leftMargin: UM.Theme.getSize("default_margin").width / 2; + anchors.verticalCenter: parent.verticalCenter; + + width: UM.Theme.getSize("line").width * maxValue.length; + + style: TextFieldStyle + { + textColor: UM.Theme.getColor("setting_control_text"); + font: UM.Theme.getFont("default"); + background: Item { } + } + } + + BusyIndicator + { + id: busyIndicator; + anchors.right: parent.right; + anchors.rightMargin: UM.Theme.getSize("default_margin").width / 2; + anchors.verticalCenter: parent.verticalCenter; + + width: UM.Theme.getSize("slider_handle").height; + height: width; + + running: UM.LayerView.busy; + visible: UM.LayerView.busy; + } + } } + Rectangle { anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter