mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 14:19:00 +08:00
Merge pull request #6499 from Ultimaker/CURA-6853_layer_slider_behind_action_panel
Cura 6853 layer slider behind action panel
This commit is contained in:
commit
a376d0e4d1
@ -11,12 +11,30 @@ 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
|
||||||
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 : ""
|
||||||
|
|
||||||
|
Binding
|
||||||
|
{
|
||||||
|
target: previewMain.item
|
||||||
|
property: "safeArea"
|
||||||
|
value:safeArea
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Cura.ActionPanelWidget
|
Cura.ActionPanelWidget
|
||||||
|
@ -176,6 +176,11 @@ Item
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onHeightChanged : {
|
||||||
|
// After a height change, the pixel-position of the lower handle is out of sync with the property value
|
||||||
|
setLowerValue(lowerValue)
|
||||||
|
}
|
||||||
|
|
||||||
// Upper handle
|
// Upper handle
|
||||||
Rectangle
|
Rectangle
|
||||||
{
|
{
|
||||||
@ -333,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)
|
||||||
{
|
{
|
||||||
|
|
||||||
// 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)
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -11,9 +11,18 @@ import Cura 1.0 as Cura
|
|||||||
|
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
property bool is_simulation_playing: false
|
// 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
|
||||||
|
readonly property var layerSliderSafeYMax: safeArea.y + safeArea.height
|
||||||
|
|
||||||
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
|
||||||
@ -58,7 +67,7 @@ Item
|
|||||||
UM.SimpleButton
|
UM.SimpleButton
|
||||||
{
|
{
|
||||||
id: playButton
|
id: playButton
|
||||||
iconSource: !is_simulation_playing ? "./resources/simulation_resume.svg": "./resources/simulation_pause.svg"
|
iconSource: !isSimulationPlaying ? "./resources/simulation_resume.svg": "./resources/simulation_pause.svg"
|
||||||
width: UM.Theme.getSize("small_button").width
|
width: UM.Theme.getSize("small_button").width
|
||||||
height: UM.Theme.getSize("small_button").height
|
height: UM.Theme.getSize("small_button").height
|
||||||
hoverColor: UM.Theme.getColor("slider_handle_active")
|
hoverColor: UM.Theme.getColor("slider_handle_active")
|
||||||
@ -88,7 +97,7 @@ Item
|
|||||||
|
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
if(is_simulation_playing)
|
if(isSimulationPlaying)
|
||||||
{
|
{
|
||||||
pauseSimulation()
|
pauseSimulation()
|
||||||
}
|
}
|
||||||
@ -102,7 +111,7 @@ Item
|
|||||||
{
|
{
|
||||||
UM.SimulationView.setSimulationRunning(false)
|
UM.SimulationView.setSimulationRunning(false)
|
||||||
simulationTimer.stop()
|
simulationTimer.stop()
|
||||||
is_simulation_playing = false
|
isSimulationPlaying = false
|
||||||
layerSlider.manuallyChanged = true
|
layerSlider.manuallyChanged = true
|
||||||
pathSlider.manuallyChanged = true
|
pathSlider.manuallyChanged = true
|
||||||
}
|
}
|
||||||
@ -131,7 +140,7 @@ Item
|
|||||||
|
|
||||||
// When the user plays the simulation, if the path slider is at the end of this layer, we start
|
// When the user plays the simulation, if the path slider is at the end of this layer, we start
|
||||||
// the simulation at the beginning of the current layer.
|
// the simulation at the beginning of the current layer.
|
||||||
if (!is_simulation_playing)
|
if (!isSimulationPlaying)
|
||||||
{
|
{
|
||||||
if (currentPath >= numPaths)
|
if (currentPath >= numPaths)
|
||||||
{
|
{
|
||||||
@ -166,22 +175,28 @@ Item
|
|||||||
}
|
}
|
||||||
// The status must be set here instead of in the resumeSimulation function otherwise it won't work
|
// The status must be set here instead of in the resumeSimulation function otherwise it won't work
|
||||||
// correctly, because part of the logic is in this trigger function.
|
// correctly, because part of the logic is in this trigger function.
|
||||||
is_simulation_playing = true
|
isSimulationPlaying = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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 < layerSliderSafeYMax ? preferredHeight : layerSliderSafeYMax - heightMargin * 2
|
||||||
|
|
||||||
anchors
|
anchors
|
||||||
{
|
{
|
||||||
right: parent.right
|
right: parent.right
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
|
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
|
||||||
|
topMargin: heightMargin
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom properties
|
// Custom properties
|
||||||
|
Loading…
x
Reference in New Issue
Block a user