Make the height of the layer slider dynamic

Prevents the action panel from overlapping the layer slider

CURA-6853
This commit is contained in:
Nino van Hooff 2019-10-07 15:22:04 +02:00
parent b78f34db12
commit 5bb23e4c6f
4 changed files with 16 additions and 2 deletions

View file

@ -13,6 +13,7 @@ Item
{ {
Loader Loader
{ {
property var panelTop: actionPanelWidget.y
id: previewMain id: previewMain
anchors.fill: parent anchors.fill: parent

View file

@ -176,6 +176,11 @@ Item
} }
} }
onHeightChanged : {
print("new height:" + height)
//rangeHandle.onHandleDragged()
}
// Upper handle // Upper handle
Rectangle Rectangle
{ {

View file

@ -48,7 +48,7 @@ if TYPE_CHECKING:
catalog = i18nCatalog("cura") catalog = i18nCatalog("cura")
## View used to display g-code paths. ## The preview layer view. It is used to display g-code paths.
class SimulationView(CuraView): class SimulationView(CuraView):
# Must match SimulationViewMenuComponent.qml # Must match SimulationViewMenuComponent.qml
LAYER_VIEW_TYPE_MATERIAL_TYPE = 0 LAYER_VIEW_TYPE_MATERIAL_TYPE = 0

View file

@ -14,6 +14,7 @@ Item
property bool is_simulation_playing: false property bool is_simulation_playing: false
visible: UM.SimulationView.layerActivity && CuraApplication.platformActivity visible: UM.SimulationView.layerActivity && CuraApplication.platformActivity
// A slider which lets users trace a single layer (XY movements)
PathSlider PathSlider
{ {
id: pathSlider id: pathSlider
@ -170,18 +171,24 @@ Item
} }
} }
// Scrolls trough Z layers
LayerSlider LayerSlider
{ {
property var preferredHeight: UM.Theme.getSize("slider_layerview_size").height
property double heightMargin: UM.Theme.getSize("default_margin").height
id: layerSlider id: layerSlider
width: UM.Theme.getSize("slider_handle").width width: UM.Theme.getSize("slider_handle").width
height: UM.Theme.getSize("slider_layerview_size").height height: preferredHeight + heightMargin * 2 < panelTop ? preferredHeight : panelTop - heightMargin * 2
anchors anchors
{ {
right: parent.right right: parent.right
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
verticalCenterOffset: -(parent.height - panelTop) / 2 // center between parent top and panelTop
rightMargin: UM.Theme.getSize("default_margin").width rightMargin: UM.Theme.getSize("default_margin").width
bottomMargin: heightMargin
topMargin: heightMargin
} }
// Custom properties // Custom properties
@ -209,6 +216,7 @@ Item
// Make sure the slider handlers show the correct value after switching views // Make sure the slider handlers show the correct value after switching views
Component.onCompleted: Component.onCompleted:
{ {
print("paneltop", panelTop, "screenscaleFactor")
layerSlider.setLowerValue(UM.SimulationView.minimumLayer) layerSlider.setLowerValue(UM.SimulationView.minimumLayer)
layerSlider.setUpperValue(UM.SimulationView.currentLayer) layerSlider.setUpperValue(UM.SimulationView.currentLayer)
} }