mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-15 02:37:49 -06:00
Take a more generic approach to safe areas for the SimulationView
Re-implements layer slider positioning CURA-6853
This commit is contained in:
parent
87bbf32597
commit
664ed4a6a6
2 changed files with 21 additions and 7 deletions
|
@ -11,6 +11,17 @@ import Cura 1.0 as Cura
|
||||||
|
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Subtract the actionPanel from the safe area. This way the view won't draw interface elements under/over it
|
||||||
|
Item {
|
||||||
|
id: safeArea
|
||||||
|
visible: false
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: actionPanelWidget.left
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: actionPanelWidget.top
|
||||||
|
}
|
||||||
|
|
||||||
Loader
|
Loader
|
||||||
{
|
{
|
||||||
id: previewMain
|
id: previewMain
|
||||||
|
@ -18,12 +29,11 @@ Item
|
||||||
|
|
||||||
source: UM.Controller.activeView != null && UM.Controller.activeView.mainComponent != null ? UM.Controller.activeView.mainComponent : ""
|
source: UM.Controller.activeView != null && UM.Controller.activeView.mainComponent != null ? UM.Controller.activeView.mainComponent : ""
|
||||||
|
|
||||||
// Indicate that the layer slider should stay above the action panel
|
|
||||||
Binding
|
Binding
|
||||||
{
|
{
|
||||||
target: previewMain.item
|
target: previewMain.item
|
||||||
property: "layerSliderSafeYMax"
|
property: "safeArea"
|
||||||
value: actionPanelWidget.y
|
value:safeArea
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,11 +11,14 @@ import Cura 1.0 as Cura
|
||||||
|
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
|
// An Item whose bounds are guaranteed to be safe for overlays to be placed.
|
||||||
|
// Defaults to parent, ie. the entire available area
|
||||||
|
// eg. the layer slider will not be placed in this area.
|
||||||
|
property var safeArea: parent
|
||||||
|
|
||||||
|
|
||||||
property bool isSimulationPlaying: false
|
property bool isSimulationPlaying: false
|
||||||
// By default, the layer slider can extend to the entire height of the parent
|
readonly property var layerSliderSafeYMax: safeArea.y + safeArea.height
|
||||||
// A parent may bind this property to indicate the bottom of a safe area
|
|
||||||
// for the Layer slider
|
|
||||||
property var layerSliderSafeYMax: parent.height
|
|
||||||
|
|
||||||
visible: UM.SimulationView.layerActivity && CuraApplication.platformActivity
|
visible: UM.SimulationView.layerActivity && CuraApplication.platformActivity
|
||||||
|
|
||||||
|
@ -221,6 +224,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("safeArea: " + safeArea, "layerSliderSafeYMax", layerSliderSafeYMax)
|
||||||
layerSlider.setLowerValue(UM.SimulationView.minimumLayer)
|
layerSlider.setLowerValue(UM.SimulationView.minimumLayer)
|
||||||
layerSlider.setUpperValue(UM.SimulationView.currentLayer)
|
layerSlider.setUpperValue(UM.SimulationView.currentLayer)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue