mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Remove external dependency from SimulationViewMainComponent
Previously, panelTop had to be defined externally whenever SimulationViewMainComponent was used. I renamed it and set a default so the binding by a parent is optional. CURA-6853
This commit is contained in:
parent
f090450bba
commit
4148f56d2b
3 changed files with 15 additions and 5 deletions
|
@ -13,11 +13,18 @@ Item
|
||||||
{
|
{
|
||||||
Loader
|
Loader
|
||||||
{
|
{
|
||||||
property var panelTop: actionPanelWidget.y
|
|
||||||
id: previewMain
|
id: previewMain
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
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
|
||||||
|
{
|
||||||
|
target: previewMain.item
|
||||||
|
property: "layerSliderSafeYMax"
|
||||||
|
value: actionPanelWidget.y
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Cura.ActionPanelWidget
|
Cura.ActionPanelWidget
|
||||||
|
|
|
@ -338,7 +338,6 @@ Item
|
||||||
// set the slider position based on the lower value
|
// set the slider position based on the lower value
|
||||||
function setValue(value)
|
function setValue(value)
|
||||||
{
|
{
|
||||||
print("lower handle set value: " + value)
|
|
||||||
// Normalize values between range, since using arrow keys will create out-of-the-range values
|
// Normalize values between range, since using arrow keys will create out-of-the-range values
|
||||||
value = sliderRoot.normalizeValue(value)
|
value = sliderRoot.normalizeValue(value)
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,11 @@ import Cura 1.0 as Cura
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
property bool is_simulation_playing: false
|
property bool is_simulation_playing: false
|
||||||
|
// By default, the layer slider can extend to the entire height of the parent
|
||||||
|
// 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
|
||||||
|
|
||||||
// A slider which lets users trace a single layer (XY movements)
|
// A slider which lets users trace a single layer (XY movements)
|
||||||
|
@ -179,13 +184,13 @@ Item
|
||||||
id: layerSlider
|
id: layerSlider
|
||||||
|
|
||||||
width: UM.Theme.getSize("slider_handle").width
|
width: UM.Theme.getSize("slider_handle").width
|
||||||
height: preferredHeight + heightMargin * 2 < panelTop ? preferredHeight : panelTop - heightMargin * 2
|
height: preferredHeight + heightMargin * 2 < layerSliderSafeYMax ? preferredHeight : layerSliderSafeYMax - 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
|
verticalCenterOffset: -(parent.height - layerSliderSafeYMax) / 2 // center between parent top and layerSliderSafeYMax
|
||||||
rightMargin: UM.Theme.getSize("default_margin").width
|
rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
bottomMargin: heightMargin
|
bottomMargin: heightMargin
|
||||||
topMargin: heightMargin
|
topMargin: heightMargin
|
||||||
|
@ -216,7 +221,6 @@ 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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue