Enlarge the zone where you can use scrolling to look trough the layer mode.

Also make it more visible

fixes #118
This commit is contained in:
Tamara Hogenhout 2015-07-09 16:27:31 +02:00
parent ab07b0205f
commit ae89ef37c0
4 changed files with 44 additions and 6 deletions

View file

@ -146,9 +146,11 @@ class LayerView(View):
self._current_layer_num = self._max_layers self._current_layer_num = self._max_layers
# This makes sure we update the current layer # This makes sure we update the current layer
self.setLayer(int(self._max_layers * (self._current_layer_num / self._old_max_layers))) self.setLayer(int(self._max_layers))
self.currentLayerNumChanged.emit()
maxLayersChanged = Signal() maxLayersChanged = Signal()
currentLayerNumChanged = Signal()
## Hackish way to ensure the proxy is already created, which ensures that the layerview.qml is already created ## Hackish way to ensure the proxy is already created, which ensures that the layerview.qml is already created
# as this caused some issues. # as this caused some issues.

View file

@ -15,10 +15,11 @@ Item
Slider Slider
{ {
id: slider
width: 10 width: 10
height: 250 height: 250
anchors.right : parent.right anchors.right : parent.right
anchors.rightMargin: UM.Theme.sizes.default_margin.width * 2 anchors.rightMargin: UM.Theme.sizes.slider_layerview_margin.width
orientation: Qt.Vertical orientation: Qt.Vertical
minimumValue: 0; minimumValue: 0;
maximumValue: UM.LayerView.numLayers; maximumValue: UM.LayerView.numLayers;
@ -27,6 +28,31 @@ Item
value: UM.LayerView.currentLayer value: UM.LayerView.currentLayer
onValueChanged: UM.LayerView.setCurrentLayer(value) onValueChanged: UM.LayerView.setCurrentLayer(value)
style: UM.LayerView.getLayerActivity ? UM.Theme.styles.layerViewSlider : UM.Theme.styles.slider style: UM.Theme.styles.layerViewSlider
}
Rectangle {
anchors.right: parent.right
y: -UM.Theme.sizes.slider_layerview_background_extension.height
z: slider.z - 1
width: UM.Theme.sizes.button.width
height: UM.Theme.sizes.slider_layerview_background_extension.height
color: UM.Theme.colors.slider_text_background
}
UM.AngledCornerRectangle {
anchors.right : parent.right
anchors.verticalCenter: parent.verticalCenter
z: slider.z - 1
cornerSize: UM.Theme.sizes.default_margin.width;
width: UM.Theme.sizes.slider_layerview_background.width
height: slider.height + UM.Theme.sizes.default_margin.height * 2
color: UM.Theme.colors.slider_text_background
MouseArea {
id: sliderMouseArea
property double manualStepSize: slider.maximumValue / 11
anchors.fill: parent
onWheel: {
slider.value = wheel.angleDelta.y < 0 ? slider.value - sliderMouseArea.manualStepSize : slider.value + sliderMouseArea.manualStepSize
}
}
} }
} }

View file

@ -389,19 +389,23 @@ QtObject {
} }
Label { Label {
id: maxValueLabel id: maxValueLabel
visible: UM.LayerView.getLayerActivity ? true : false
text: control.maximumValue + 1 text: control.maximumValue + 1
font: control.maximumValue > 998 ? UM.Theme.fonts.small : UM.Theme.fonts.default
transformOrigin: Item.BottomLeft transformOrigin: Item.BottomLeft
rotation: 90 rotation: 90
x: parent.x + parent.width - maxValueLabel.height x: parent.x + parent.width - maxValueLabel.height
y: parent.y y: control.maximumValue > 998 ? parent.y + UM.Theme.sizes.slider_layerview_smalltext_margin.width : parent.y
} }
Label { Label {
id: minValueLabel id: minValueLabel
visible: UM.LayerView.getLayerActivity ? true : false
text: '1' text: '1'
font: control.maximumValue > 998 ? UM.Theme.fonts.small : UM.Theme.fonts.default
transformOrigin: Item.BottomLeft transformOrigin: Item.BottomLeft
rotation: 90 rotation: 90
x: parent.x x: parent.x
y: parent.y y: control.maximumValue > 998 ? parent.y + UM.Theme.sizes.slider_layerview_smalltext_margin.width : parent.y
} }
} }
handle: Rectangle { handle: Rectangle {
@ -412,10 +416,12 @@ QtObject {
Behavior on color { ColorAnimation { duration: 50; } } Behavior on color { ColorAnimation { duration: 50; } }
Label { Label {
id: valueLabel id: valueLabel
visible: UM.LayerView.getLayerActivity ? true : false
text: control.value + 1 text: control.value + 1
anchors.bottom: layerSliderControl.bottom anchors.bottom: layerSliderControl.bottom
anchors.right: layerSliderControl.left anchors.right: layerSliderControl.left
anchors.bottomMargin: parent.width + UM.Theme.sizes.default_margin.width anchors.bottomMargin: parent.width + UM.Theme.sizes.default_margin.width
font: UM.Theme.fonts.default
transformOrigin: Item.BottomRight transformOrigin: Item.BottomRight
rotation: 90 rotation: 90
Rectangle { Rectangle {

View file

@ -155,6 +155,10 @@
"slider_groove": [0.5, 0.5], "slider_groove": [0.5, 0.5],
"slider_handle": [1.5, 1.5], "slider_handle": [1.5, 1.5],
"slider_layerview_background": [6.0, 0.0],
"slider_layerview_smalltext_margin": [0.3, 0.00],
"slider_layerview_background_extension": [0.0, 2.2],
"slider_layerview_margin": [3.0, 3.0],
"checkbox": [1.5, 1.5], "checkbox": [1.5, 1.5],