mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 02:49:04 +08:00
Merge branch 'CURA-6874_path_slider_layout' of github.com:Ultimaker/Cura
This commit is contained in:
commit
9dccbcdd8e
@ -12,14 +12,18 @@ import Cura 1.0 as Cura
|
||||
Item
|
||||
{
|
||||
|
||||
// An Item whose bounds are guaranteed to be safe for overlays to be placed.
|
||||
// Defaults to parent, ie. the entire available area
|
||||
property var safeArea: parent
|
||||
|
||||
// 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
|
||||
Item
|
||||
{
|
||||
id: childSafeArea
|
||||
x: safeArea.x - parent.x
|
||||
y: safeArea.y - parent.y
|
||||
width: actionPanelWidget.x - x
|
||||
height: actionPanelWidget.y - y
|
||||
}
|
||||
|
||||
Loader
|
||||
@ -29,9 +33,10 @@ Item
|
||||
|
||||
source: UM.Controller.activeView != null && UM.Controller.activeView.mainComponent != null ? UM.Controller.activeView.mainComponent : ""
|
||||
|
||||
onLoaded: {
|
||||
onLoaded:
|
||||
{
|
||||
if (previewMain.item.safeArea !== undefined){
|
||||
previewMain.item.safeArea = Qt.binding(function() { return safeArea });
|
||||
previewMain.item.safeArea = Qt.binding(function() { return childSafeArea });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +56,11 @@ Item
|
||||
return Math.min(Math.max(value, sliderRoot.minimumValue), sliderRoot.maximumValue)
|
||||
}
|
||||
|
||||
onWidthChanged : {
|
||||
// After a width change, the pixel-position of the handle is out of sync with the property value
|
||||
setHandleValue(handleValue)
|
||||
}
|
||||
|
||||
// slider track
|
||||
Rectangle
|
||||
{
|
||||
|
@ -18,7 +18,10 @@ Item
|
||||
|
||||
|
||||
property bool isSimulationPlaying: false
|
||||
readonly property var layerSliderSafeYMax: safeArea.y + safeArea.height
|
||||
readonly property real layerSliderSafeYMin: safeArea.y
|
||||
readonly property real layerSliderSafeYMax: safeArea.y + safeArea.height
|
||||
readonly property real pathSliderSafeXMin: safeArea.x + playButton.width
|
||||
readonly property real pathSliderSafeXMax: safeArea.x + safeArea.width
|
||||
|
||||
visible: UM.SimulationView.layerActivity && CuraApplication.platformActivity
|
||||
|
||||
@ -26,13 +29,21 @@ Item
|
||||
PathSlider
|
||||
{
|
||||
id: pathSlider
|
||||
|
||||
readonly property real preferredWidth: UM.Theme.getSize("slider_layerview_size").height // not a typo, should be as long as layerview slider
|
||||
readonly property real margin: UM.Theme.getSize("default_margin").width
|
||||
readonly property real pathSliderSafeWidth: pathSliderSafeXMax - pathSliderSafeXMin
|
||||
|
||||
height: UM.Theme.getSize("slider_handle").width
|
||||
width: UM.Theme.getSize("slider_layerview_size").height
|
||||
width: preferredWidth + margin * 2 < pathSliderSafeWidth ? preferredWidth : pathSliderSafeWidth - margin * 2
|
||||
|
||||
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: UM.Theme.getSize("default_margin").height
|
||||
anchors.bottomMargin: margin
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.horizontalCenterOffset: -(parent.width - pathSliderSafeXMax - pathSliderSafeXMin) / 2 // center between parent top and layerSliderSafeYMax
|
||||
|
||||
|
||||
visible: !UM.SimulationView.compatibilityMode
|
||||
|
||||
@ -184,16 +195,19 @@ Item
|
||||
{
|
||||
property var preferredHeight: UM.Theme.getSize("slider_layerview_size").height
|
||||
property double heightMargin: UM.Theme.getSize("default_margin").height
|
||||
property double layerSliderSafeHeight: layerSliderSafeYMax - layerSliderSafeYMin
|
||||
//todo incorporate margins in safeHeight?
|
||||
|
||||
id: layerSlider
|
||||
|
||||
width: UM.Theme.getSize("slider_handle").width
|
||||
height: preferredHeight + heightMargin * 2 < layerSliderSafeYMax ? preferredHeight : layerSliderSafeYMax - heightMargin * 2
|
||||
height: preferredHeight + heightMargin * 2 < layerSliderSafeHeight ? preferredHeight : layerSliderSafeHeight - heightMargin * 2
|
||||
|
||||
anchors
|
||||
{
|
||||
right: parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
verticalCenterOffset: -(parent.height - layerSliderSafeYMax) / 2 // center between parent top and layerSliderSafeYMax
|
||||
verticalCenterOffset: -(parent.height - layerSliderSafeYMax - layerSliderSafeYMin) / 2 // center between parent top and layerSliderSafeYMax
|
||||
rightMargin: UM.Theme.getSize("default_margin").width
|
||||
bottomMargin: heightMargin
|
||||
topMargin: heightMargin
|
||||
|
@ -301,6 +301,15 @@ UM.MainWindow
|
||||
}
|
||||
}
|
||||
|
||||
// A hint for the loaded content view. Overlay items / controls can safely be placed in this area
|
||||
Item {
|
||||
id: mainSafeArea
|
||||
anchors.left: viewOrientationControls.right
|
||||
anchors.right: main.right
|
||||
anchors.top: main.top
|
||||
anchors.bottom: main.bottom
|
||||
}
|
||||
|
||||
Loader
|
||||
{
|
||||
// A stage can control this area. If nothing is set, it will therefore show the 3D view.
|
||||
@ -316,6 +325,12 @@ UM.MainWindow
|
||||
}
|
||||
|
||||
source: UM.Controller.activeStage != null ? UM.Controller.activeStage.mainComponent : ""
|
||||
|
||||
onLoaded: {
|
||||
if (main.item.safeArea !== undefined){
|
||||
main.item.safeArea = Qt.binding(function() { return mainSafeArea });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loader
|
||||
|
Loading…
x
Reference in New Issue
Block a user