mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 23:46:22 -06:00
Add a collapse button to the Simulation View panel
See https://github.com/Ultimaker/Cura/pull/2732
This commit is contained in:
parent
a42d054505
commit
532331bd44
2 changed files with 172 additions and 140 deletions
|
@ -20,7 +20,9 @@ Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
height: {
|
height: {
|
||||||
if (UM.SimulationView.compatibilityMode) {
|
if (viewSettings.collapsed) {
|
||||||
|
return UM.Theme.getSize("layerview_menu_size_collapsed").height;
|
||||||
|
} else if (UM.SimulationView.compatibilityMode) {
|
||||||
return UM.Theme.getSize("layerview_menu_size_compatibility").height;
|
return UM.Theme.getSize("layerview_menu_size_compatibility").height;
|
||||||
} else if (UM.Preferences.getValue("layerview/layer_view_type") == 0) {
|
} else if (UM.Preferences.getValue("layerview/layer_view_type") == 0) {
|
||||||
return UM.Theme.getSize("layerview_menu_size_material_color_mode").height + UM.SimulationView.extruderCount * (UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("layerview_row_spacing").height)
|
return UM.Theme.getSize("layerview_menu_size_material_color_mode").height + UM.SimulationView.extruderCount * (UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("layerview_row_spacing").height)
|
||||||
|
@ -28,6 +30,7 @@ Item
|
||||||
return UM.Theme.getSize("layerview_menu_size").height + UM.SimulationView.extruderCount * (UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("layerview_row_spacing").height)
|
return UM.Theme.getSize("layerview_menu_size").height + UM.SimulationView.extruderCount * (UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("layerview_row_spacing").height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Behavior on height { NumberAnimation { duration: 100 } }
|
||||||
|
|
||||||
property var buttonTarget: {
|
property var buttonTarget: {
|
||||||
if(parent != null)
|
if(parent != null)
|
||||||
|
@ -40,21 +43,49 @@ Item
|
||||||
|
|
||||||
visible: parent != null ? !parent.parent.monitoringPrint: true
|
visible: parent != null ? !parent.parent.monitoringPrint: true
|
||||||
|
|
||||||
UM.PointingRectangle {
|
Rectangle {
|
||||||
id: layerViewMenu
|
id: layerViewMenu
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
clip: true
|
||||||
z: layerSlider.z - 1
|
z: layerSlider.z - 1
|
||||||
color: UM.Theme.getColor("tool_panel_background")
|
color: UM.Theme.getColor("tool_panel_background")
|
||||||
borderWidth: UM.Theme.getSize("default_lining").width
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
borderColor: UM.Theme.getColor("lining")
|
border.color: UM.Theme.getColor("lining")
|
||||||
arrowSize: 0 // hide arrow until weird issue with first time rendering is fixed
|
|
||||||
|
Button {
|
||||||
|
id: collapseButton
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.topMargin: Math.floor(UM.Theme.getSize("default_margin").height + (UM.Theme.getSize("layerview_row").height - UM.Theme.getSize("default_margin").height) / 2)
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
|
||||||
|
width: UM.Theme.getSize("standard_arrow").width
|
||||||
|
height: UM.Theme.getSize("standard_arrow").height
|
||||||
|
|
||||||
|
onClicked: viewSettings.collapsed = !viewSettings.collapsed
|
||||||
|
|
||||||
|
style: ButtonStyle
|
||||||
|
{
|
||||||
|
background: UM.RecolorImage
|
||||||
|
{
|
||||||
|
width: control.width
|
||||||
|
height: control.height
|
||||||
|
sourceSize.width: width
|
||||||
|
sourceSize.height: width
|
||||||
|
color: UM.Theme.getColor("setting_control_text")
|
||||||
|
source: viewSettings.collapsed ? UM.Theme.getIcon("arrow_left") : UM.Theme.getIcon("arrow_bottom")
|
||||||
|
}
|
||||||
|
label: Label{ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: view_settings
|
id: viewSettings
|
||||||
|
|
||||||
|
property bool collapsed: false
|
||||||
property var extruder_opacities: UM.Preferences.getValue("layerview/extruder_opacities").split("|")
|
property var extruder_opacities: UM.Preferences.getValue("layerview/extruder_opacities").split("|")
|
||||||
property bool show_travel_moves: UM.Preferences.getValue("layerview/show_travel_moves")
|
property bool show_travel_moves: UM.Preferences.getValue("layerview/show_travel_moves")
|
||||||
property bool show_helpers: UM.Preferences.getValue("layerview/show_helpers")
|
property bool show_helpers: UM.Preferences.getValue("layerview/show_helpers")
|
||||||
|
@ -135,7 +166,7 @@ Item
|
||||||
function updateLegends(type_id)
|
function updateLegends(type_id)
|
||||||
{
|
{
|
||||||
// update visibility of legends
|
// update visibility of legends
|
||||||
view_settings.show_legend = UM.SimulationView.compatibilityMode || (type_id == 1);
|
viewSettings.show_legend = UM.SimulationView.compatibilityMode || (type_id == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -165,13 +196,13 @@ Item
|
||||||
{
|
{
|
||||||
layerTypeCombobox.currentIndex = UM.SimulationView.compatibilityMode ? 1 : UM.Preferences.getValue("layerview/layer_view_type");
|
layerTypeCombobox.currentIndex = UM.SimulationView.compatibilityMode ? 1 : UM.Preferences.getValue("layerview/layer_view_type");
|
||||||
layerTypeCombobox.updateLegends(layerTypeCombobox.currentIndex);
|
layerTypeCombobox.updateLegends(layerTypeCombobox.currentIndex);
|
||||||
view_settings.extruder_opacities = UM.Preferences.getValue("layerview/extruder_opacities").split("|");
|
viewSettings.extruder_opacities = UM.Preferences.getValue("layerview/extruder_opacities").split("|");
|
||||||
view_settings.show_travel_moves = UM.Preferences.getValue("layerview/show_travel_moves");
|
viewSettings.show_travel_moves = UM.Preferences.getValue("layerview/show_travel_moves");
|
||||||
view_settings.show_helpers = UM.Preferences.getValue("layerview/show_helpers");
|
viewSettings.show_helpers = UM.Preferences.getValue("layerview/show_helpers");
|
||||||
view_settings.show_skin = UM.Preferences.getValue("layerview/show_skin");
|
viewSettings.show_skin = UM.Preferences.getValue("layerview/show_skin");
|
||||||
view_settings.show_infill = UM.Preferences.getValue("layerview/show_infill");
|
viewSettings.show_infill = UM.Preferences.getValue("layerview/show_infill");
|
||||||
view_settings.only_show_top_layers = UM.Preferences.getValue("view/only_show_top_layers");
|
viewSettings.only_show_top_layers = UM.Preferences.getValue("view/only_show_top_layers");
|
||||||
view_settings.top_layer_count = UM.Preferences.getValue("view/top_layer_count");
|
viewSettings.top_layer_count = UM.Preferences.getValue("view/top_layer_count");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,10 +210,10 @@ Item
|
||||||
model: Cura.ExtrudersModel{}
|
model: Cura.ExtrudersModel{}
|
||||||
CheckBox {
|
CheckBox {
|
||||||
id: extrudersModelCheckBox
|
id: extrudersModelCheckBox
|
||||||
checked: view_settings.extruder_opacities[index] > 0.5 || view_settings.extruder_opacities[index] == undefined || view_settings.extruder_opacities[index] == ""
|
checked: viewSettings.extruder_opacities[index] > 0.5 || viewSettings.extruder_opacities[index] == undefined || viewSettings.extruder_opacities[index] == ""
|
||||||
onClicked: {
|
onClicked: {
|
||||||
view_settings.extruder_opacities[index] = checked ? 1.0 : 0.0
|
viewSettings.extruder_opacities[index] = checked ? 1.0 : 0.0
|
||||||
UM.Preferences.setValue("layerview/extruder_opacities", view_settings.extruder_opacities.join("|"));
|
UM.Preferences.setValue("layerview/extruder_opacities", viewSettings.extruder_opacities.join("|"));
|
||||||
}
|
}
|
||||||
visible: !UM.SimulationView.compatibilityMode
|
visible: !UM.SimulationView.compatibilityMode
|
||||||
enabled: index + 1 <= 4
|
enabled: index + 1 <= 4
|
||||||
|
@ -195,7 +226,7 @@ Item
|
||||||
radius: width / 2
|
radius: width / 2
|
||||||
border.width: UM.Theme.getSize("default_lining").width
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
border.color: UM.Theme.getColor("lining")
|
border.color: UM.Theme.getColor("lining")
|
||||||
visible: !view_settings.show_legend & !view_settings.show_gradient
|
visible: !viewSettings.show_legend & !viewSettings.show_gradient
|
||||||
}
|
}
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height
|
Layout.preferredHeight: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height
|
||||||
|
@ -223,25 +254,25 @@ Item
|
||||||
{
|
{
|
||||||
typesLegendModel.append({
|
typesLegendModel.append({
|
||||||
label: catalog.i18nc("@label", "Show Travels"),
|
label: catalog.i18nc("@label", "Show Travels"),
|
||||||
initialValue: view_settings.show_travel_moves,
|
initialValue: viewSettings.show_travel_moves,
|
||||||
preference: "layerview/show_travel_moves",
|
preference: "layerview/show_travel_moves",
|
||||||
colorId: "layerview_move_combing"
|
colorId: "layerview_move_combing"
|
||||||
});
|
});
|
||||||
typesLegendModel.append({
|
typesLegendModel.append({
|
||||||
label: catalog.i18nc("@label", "Show Helpers"),
|
label: catalog.i18nc("@label", "Show Helpers"),
|
||||||
initialValue: view_settings.show_helpers,
|
initialValue: viewSettings.show_helpers,
|
||||||
preference: "layerview/show_helpers",
|
preference: "layerview/show_helpers",
|
||||||
colorId: "layerview_support"
|
colorId: "layerview_support"
|
||||||
});
|
});
|
||||||
typesLegendModel.append({
|
typesLegendModel.append({
|
||||||
label: catalog.i18nc("@label", "Show Shell"),
|
label: catalog.i18nc("@label", "Show Shell"),
|
||||||
initialValue: view_settings.show_skin,
|
initialValue: viewSettings.show_skin,
|
||||||
preference: "layerview/show_skin",
|
preference: "layerview/show_skin",
|
||||||
colorId: "layerview_inset_0"
|
colorId: "layerview_inset_0"
|
||||||
});
|
});
|
||||||
typesLegendModel.append({
|
typesLegendModel.append({
|
||||||
label: catalog.i18nc("@label", "Show Infill"),
|
label: catalog.i18nc("@label", "Show Infill"),
|
||||||
initialValue: view_settings.show_infill,
|
initialValue: viewSettings.show_infill,
|
||||||
preference: "layerview/show_infill",
|
preference: "layerview/show_infill",
|
||||||
colorId: "layerview_infill"
|
colorId: "layerview_infill"
|
||||||
});
|
});
|
||||||
|
@ -262,7 +293,7 @@ Item
|
||||||
color: UM.Theme.getColor(model.colorId)
|
color: UM.Theme.getColor(model.colorId)
|
||||||
border.width: UM.Theme.getSize("default_lining").width
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
border.color: UM.Theme.getColor("lining")
|
border.color: UM.Theme.getColor("lining")
|
||||||
visible: view_settings.show_legend
|
visible: viewSettings.show_legend
|
||||||
}
|
}
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height
|
Layout.preferredHeight: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height
|
||||||
|
@ -284,7 +315,7 @@ Item
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckBox {
|
CheckBox {
|
||||||
checked: view_settings.only_show_top_layers
|
checked: viewSettings.only_show_top_layers
|
||||||
onClicked: {
|
onClicked: {
|
||||||
UM.Preferences.setValue("view/only_show_top_layers", checked ? 1.0 : 0.0);
|
UM.Preferences.setValue("view/only_show_top_layers", checked ? 1.0 : 0.0);
|
||||||
}
|
}
|
||||||
|
@ -293,7 +324,7 @@ Item
|
||||||
style: UM.Theme.styles.checkbox
|
style: UM.Theme.styles.checkbox
|
||||||
}
|
}
|
||||||
CheckBox {
|
CheckBox {
|
||||||
checked: view_settings.top_layer_count == 5
|
checked: viewSettings.top_layer_count == 5
|
||||||
onClicked: {
|
onClicked: {
|
||||||
UM.Preferences.setValue("view/top_layer_count", checked ? 5 : 1);
|
UM.Preferences.setValue("view/top_layer_count", checked ? 5 : 1);
|
||||||
}
|
}
|
||||||
|
@ -320,7 +351,7 @@ Item
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: label
|
text: label
|
||||||
visible: view_settings.show_legend
|
visible: viewSettings.show_legend
|
||||||
id: typesLegendModelLabel
|
id: typesLegendModelLabel
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
@ -330,7 +361,7 @@ Item
|
||||||
color: UM.Theme.getColor(model.colorId)
|
color: UM.Theme.getColor(model.colorId)
|
||||||
border.width: UM.Theme.getSize("default_lining").width
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
border.color: UM.Theme.getColor("lining")
|
border.color: UM.Theme.getColor("lining")
|
||||||
visible: view_settings.show_legend
|
visible: viewSettings.show_legend
|
||||||
}
|
}
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height
|
Layout.preferredHeight: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height
|
||||||
|
@ -343,7 +374,7 @@ Item
|
||||||
// Text for the minimum, maximum and units for the feedrates and layer thickness
|
// Text for the minimum, maximum and units for the feedrates and layer thickness
|
||||||
Item {
|
Item {
|
||||||
id: gradientLegend
|
id: gradientLegend
|
||||||
visible: view_settings.show_gradient
|
visible: viewSettings.show_gradient
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: UM.Theme.getSize("layerview_row").height
|
height: UM.Theme.getSize("layerview_row").height
|
||||||
anchors {
|
anchors {
|
||||||
|
@ -419,7 +450,7 @@ Item
|
||||||
Rectangle { // In QML 5.9 can be changed by LinearGradient
|
Rectangle { // In QML 5.9 can be changed by LinearGradient
|
||||||
// Invert values because then the bar is rotated 90 degrees
|
// Invert values because then the bar is rotated 90 degrees
|
||||||
id: gradient
|
id: gradient
|
||||||
visible: view_settings.show_gradient
|
visible: viewSettings.show_gradient
|
||||||
anchors.left: parent.right
|
anchors.left: parent.right
|
||||||
height: parent.width
|
height: parent.width
|
||||||
width: UM.Theme.getSize("layerview_row").height * 1.5
|
width: UM.Theme.getSize("layerview_row").height * 1.5
|
||||||
|
@ -450,134 +481,134 @@ Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: slidersBox
|
id: slidersBox
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
visible: UM.SimulationView.layerActivity && CuraApplication.platformActivity
|
visible: UM.SimulationView.layerActivity && CuraApplication.platformActivity
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: parent.bottom
|
||||||
|
topMargin: UM.Theme.getSize("slider_layerview_margin").height
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
|
||||||
|
PathSlider {
|
||||||
|
id: pathSlider
|
||||||
|
|
||||||
|
height: UM.Theme.getSize("slider_handle").width
|
||||||
|
anchors.right: playButton.left
|
||||||
|
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
anchors.left: parent.left
|
||||||
|
visible: !UM.SimulationView.compatibilityMode
|
||||||
|
|
||||||
|
// custom properties
|
||||||
|
handleValue: UM.SimulationView.currentPath
|
||||||
|
maximumValue: UM.SimulationView.numPaths
|
||||||
|
handleSize: UM.Theme.getSize("slider_handle").width
|
||||||
|
trackThickness: UM.Theme.getSize("slider_groove").width
|
||||||
|
trackColor: UM.Theme.getColor("slider_groove")
|
||||||
|
trackBorderColor: UM.Theme.getColor("slider_groove_border")
|
||||||
|
handleColor: UM.Theme.getColor("slider_handle")
|
||||||
|
handleActiveColor: UM.Theme.getColor("slider_handle_active")
|
||||||
|
rangeColor: UM.Theme.getColor("slider_groove_fill")
|
||||||
|
|
||||||
|
// update values when layer data changes
|
||||||
|
Connections {
|
||||||
|
target: UM.SimulationView
|
||||||
|
onMaxPathsChanged: pathSlider.setHandleValue(UM.SimulationView.currentPath)
|
||||||
|
onCurrentPathChanged: pathSlider.setHandleValue(UM.SimulationView.currentPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
// make sure the slider handlers show the correct value after switching views
|
||||||
|
Component.onCompleted: {
|
||||||
|
pathSlider.setHandleValue(UM.SimulationView.currentPath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LayerSlider {
|
||||||
|
id: layerSlider
|
||||||
|
|
||||||
|
width: UM.Theme.getSize("slider_handle").width
|
||||||
|
height: UM.Theme.getSize("layerview_menu_size").height
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
top: parent.bottom
|
top: playButton.bottom
|
||||||
topMargin: UM.Theme.getSize("slider_layerview_margin").height
|
topMargin: UM.Theme.getSize("default_margin").height
|
||||||
left: parent.left
|
right: parent.right
|
||||||
|
rightMargin: UM.Theme.getSize("slider_layerview_margin").width
|
||||||
}
|
}
|
||||||
|
|
||||||
PathSlider {
|
// custom properties
|
||||||
id: pathSlider
|
upperValue: UM.SimulationView.currentLayer
|
||||||
|
lowerValue: UM.SimulationView.minimumLayer
|
||||||
|
maximumValue: UM.SimulationView.numLayers
|
||||||
|
handleSize: UM.Theme.getSize("slider_handle").width
|
||||||
|
trackThickness: UM.Theme.getSize("slider_groove").width
|
||||||
|
trackColor: UM.Theme.getColor("slider_groove")
|
||||||
|
trackBorderColor: UM.Theme.getColor("slider_groove_border")
|
||||||
|
upperHandleColor: UM.Theme.getColor("slider_handle")
|
||||||
|
lowerHandleColor: UM.Theme.getColor("slider_handle")
|
||||||
|
rangeHandleColor: UM.Theme.getColor("slider_groove_fill")
|
||||||
|
handleActiveColor: UM.Theme.getColor("slider_handle_active")
|
||||||
|
handleLabelWidth: UM.Theme.getSize("slider_layerview_background").width
|
||||||
|
|
||||||
height: UM.Theme.getSize("slider_handle").width
|
// update values when layer data changes
|
||||||
anchors.right: playButton.left
|
Connections {
|
||||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
target: UM.SimulationView
|
||||||
anchors.left: parent.left
|
onMaxLayersChanged: layerSlider.setUpperValue(UM.SimulationView.currentLayer)
|
||||||
visible: !UM.SimulationView.compatibilityMode
|
onMinimumLayerChanged: layerSlider.setLowerValue(UM.SimulationView.minimumLayer)
|
||||||
|
onCurrentLayerChanged: layerSlider.setUpperValue(UM.SimulationView.currentLayer)
|
||||||
// custom properties
|
|
||||||
handleValue: UM.SimulationView.currentPath
|
|
||||||
maximumValue: UM.SimulationView.numPaths
|
|
||||||
handleSize: UM.Theme.getSize("slider_handle").width
|
|
||||||
trackThickness: UM.Theme.getSize("slider_groove").width
|
|
||||||
trackColor: UM.Theme.getColor("slider_groove")
|
|
||||||
trackBorderColor: UM.Theme.getColor("slider_groove_border")
|
|
||||||
handleColor: UM.Theme.getColor("slider_handle")
|
|
||||||
handleActiveColor: UM.Theme.getColor("slider_handle_active")
|
|
||||||
rangeColor: UM.Theme.getColor("slider_groove_fill")
|
|
||||||
|
|
||||||
// update values when layer data changes
|
|
||||||
Connections {
|
|
||||||
target: UM.SimulationView
|
|
||||||
onMaxPathsChanged: pathSlider.setHandleValue(UM.SimulationView.currentPath)
|
|
||||||
onCurrentPathChanged: pathSlider.setHandleValue(UM.SimulationView.currentPath)
|
|
||||||
}
|
|
||||||
|
|
||||||
// make sure the slider handlers show the correct value after switching views
|
|
||||||
Component.onCompleted: {
|
|
||||||
pathSlider.setHandleValue(UM.SimulationView.currentPath)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LayerSlider {
|
// make sure the slider handlers show the correct value after switching views
|
||||||
id: layerSlider
|
Component.onCompleted: {
|
||||||
|
layerSlider.setLowerValue(UM.SimulationView.minimumLayer)
|
||||||
|
layerSlider.setUpperValue(UM.SimulationView.currentLayer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
width: UM.Theme.getSize("slider_handle").width
|
// Play simulation button
|
||||||
height: UM.Theme.getSize("layerview_menu_size").height
|
Button {
|
||||||
|
id: playButton
|
||||||
anchors {
|
implicitWidth: Math.floor(UM.Theme.getSize("button").width * 0.75)
|
||||||
top: playButton.bottom
|
implicitHeight: Math.floor(UM.Theme.getSize("button").height * 0.75)
|
||||||
topMargin: UM.Theme.getSize("default_margin").height
|
iconSource: "./resources/simulation_resume.svg"
|
||||||
right: parent.right
|
style: UM.Theme.styles.tool_button
|
||||||
rightMargin: UM.Theme.getSize("slider_layerview_margin").width
|
visible: !UM.SimulationView.compatibilityMode
|
||||||
}
|
anchors {
|
||||||
|
horizontalCenter: layerSlider.horizontalCenter
|
||||||
// custom properties
|
verticalCenter: pathSlider.verticalCenter
|
||||||
upperValue: UM.SimulationView.currentLayer
|
|
||||||
lowerValue: UM.SimulationView.minimumLayer
|
|
||||||
maximumValue: UM.SimulationView.numLayers
|
|
||||||
handleSize: UM.Theme.getSize("slider_handle").width
|
|
||||||
trackThickness: UM.Theme.getSize("slider_groove").width
|
|
||||||
trackColor: UM.Theme.getColor("slider_groove")
|
|
||||||
trackBorderColor: UM.Theme.getColor("slider_groove_border")
|
|
||||||
upperHandleColor: UM.Theme.getColor("slider_handle")
|
|
||||||
lowerHandleColor: UM.Theme.getColor("slider_handle")
|
|
||||||
rangeHandleColor: UM.Theme.getColor("slider_groove_fill")
|
|
||||||
handleActiveColor: UM.Theme.getColor("slider_handle_active")
|
|
||||||
handleLabelWidth: UM.Theme.getSize("slider_layerview_background").width
|
|
||||||
|
|
||||||
// update values when layer data changes
|
|
||||||
Connections {
|
|
||||||
target: UM.SimulationView
|
|
||||||
onMaxLayersChanged: layerSlider.setUpperValue(UM.SimulationView.currentLayer)
|
|
||||||
onMinimumLayerChanged: layerSlider.setLowerValue(UM.SimulationView.minimumLayer)
|
|
||||||
onCurrentLayerChanged: layerSlider.setUpperValue(UM.SimulationView.currentLayer)
|
|
||||||
}
|
|
||||||
|
|
||||||
// make sure the slider handlers show the correct value after switching views
|
|
||||||
Component.onCompleted: {
|
|
||||||
layerSlider.setLowerValue(UM.SimulationView.minimumLayer)
|
|
||||||
layerSlider.setUpperValue(UM.SimulationView.currentLayer)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Play simulation button
|
property var status: 0 // indicates if it's stopped (0) or playing (1)
|
||||||
Button {
|
|
||||||
id: playButton
|
|
||||||
implicitWidth: Math.floor(UM.Theme.getSize("button").width * 0.75)
|
|
||||||
implicitHeight: Math.floor(UM.Theme.getSize("button").height * 0.75)
|
|
||||||
iconSource: "./resources/simulation_resume.svg"
|
|
||||||
style: UM.Theme.styles.tool_button
|
|
||||||
visible: !UM.SimulationView.compatibilityMode
|
|
||||||
anchors {
|
|
||||||
horizontalCenter: layerSlider.horizontalCenter
|
|
||||||
verticalCenter: pathSlider.verticalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
property var status: 0 // indicates if it's stopped (0) or playing (1)
|
onClicked: {
|
||||||
|
switch(status) {
|
||||||
onClicked: {
|
case 0: {
|
||||||
switch(status) {
|
resumeSimulation()
|
||||||
case 0: {
|
break
|
||||||
resumeSimulation()
|
}
|
||||||
break
|
case 1: {
|
||||||
}
|
pauseSimulation()
|
||||||
case 1: {
|
break
|
||||||
pauseSimulation()
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function pauseSimulation() {
|
function pauseSimulation() {
|
||||||
UM.SimulationView.setSimulationRunning(false)
|
UM.SimulationView.setSimulationRunning(false)
|
||||||
iconSource = "./resources/simulation_resume.svg"
|
iconSource = "./resources/simulation_resume.svg"
|
||||||
simulationTimer.stop()
|
simulationTimer.stop()
|
||||||
status = 0
|
status = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
function resumeSimulation() {
|
function resumeSimulation() {
|
||||||
UM.SimulationView.setSimulationRunning(true)
|
UM.SimulationView.setSimulationRunning(true)
|
||||||
iconSource = "./resources/simulation_pause.svg"
|
iconSource = "./resources/simulation_pause.svg"
|
||||||
simulationTimer.start()
|
simulationTimer.start()
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -348,6 +348,7 @@
|
||||||
|
|
||||||
"layerview_menu_size": [15, 20],
|
"layerview_menu_size": [15, 20],
|
||||||
"layerview_menu_size_material_color_mode": [15, 16],
|
"layerview_menu_size_material_color_mode": [15, 16],
|
||||||
|
"layerview_menu_size_collapsed": [15, 6],
|
||||||
"layerview_menu_size_compatibility": [22, 22.0],
|
"layerview_menu_size_compatibility": [22, 22.0],
|
||||||
"layerview_legend_size": [1.0, 1.0],
|
"layerview_legend_size": [1.0, 1.0],
|
||||||
"layerview_row": [11.0, 1.5],
|
"layerview_row": [11.0, 1.5],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue