mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 20:29:05 +08:00
CURA-4234 fix topbar resize issues and removed hard coding numbers
This commit is contained in:
parent
3605edc565
commit
f3a6f50e2c
@ -21,6 +21,22 @@ Rectangle
|
|||||||
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
|
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
|
||||||
property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands
|
property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands
|
||||||
|
|
||||||
|
property int rightMargin: UM.Theme.getSize("sidebar").width + UM.Theme.getSize("default_margin").width;
|
||||||
|
property int allItemsWidth: 0;
|
||||||
|
|
||||||
|
function updateMarginsAndSizes() {
|
||||||
|
if (UM.Preferences.getValue("cura/sidebar_collapse")) {
|
||||||
|
rightMargin = UM.Theme.getSize("default_margin").width;
|
||||||
|
} else {
|
||||||
|
rightMargin = UM.Theme.getSize("sidebar").width + UM.Theme.getSize("default_margin").width;
|
||||||
|
}
|
||||||
|
allItemsWidth = (
|
||||||
|
logo.width + UM.Theme.getSize("topbar_logo_right_margin").width +
|
||||||
|
UM.Theme.getSize("topbar_logo_right_margin").width + stagesMenuContainer.width +
|
||||||
|
UM.Theme.getSize("default_margin").width + viewModeButton.width +
|
||||||
|
rightMargin);
|
||||||
|
}
|
||||||
|
|
||||||
UM.I18nCatalog
|
UM.I18nCatalog
|
||||||
{
|
{
|
||||||
id: catalog
|
id: catalog
|
||||||
@ -44,6 +60,7 @@ Rectangle
|
|||||||
|
|
||||||
Row
|
Row
|
||||||
{
|
{
|
||||||
|
id: stagesMenuContainer
|
||||||
anchors.left: logo.right
|
anchors.left: logo.right
|
||||||
anchors.leftMargin: UM.Theme.getSize("topbar_logo_right_margin").width
|
anchors.leftMargin: UM.Theme.getSize("topbar_logo_right_margin").width
|
||||||
spacing: UM.Theme.getSize("default_margin").width
|
spacing: UM.Theme.getSize("default_margin").width
|
||||||
@ -85,8 +102,8 @@ Rectangle
|
|||||||
anchors
|
anchors
|
||||||
{
|
{
|
||||||
verticalCenter: base.verticalCenter
|
verticalCenter: base.verticalCenter
|
||||||
right: viewModeButton.right
|
right: viewModeButton.left
|
||||||
rightMargin: UM.Theme.getSize("default_margin").width + viewModeButton.width
|
rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
}
|
}
|
||||||
|
|
||||||
// #1 3d view
|
// #1 3d view
|
||||||
@ -98,7 +115,7 @@ Rectangle
|
|||||||
onClicked:{
|
onClicked:{
|
||||||
UM.Controller.rotateView("3d", 0);
|
UM.Controller.rotateView("3d", 0);
|
||||||
}
|
}
|
||||||
visible: base.width > 1100
|
visible: base.width - allItemsWidth - 4 * this.width > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// #2 Front view
|
// #2 Front view
|
||||||
@ -110,7 +127,7 @@ Rectangle
|
|||||||
onClicked:{
|
onClicked:{
|
||||||
UM.Controller.rotateView("home", 0);
|
UM.Controller.rotateView("home", 0);
|
||||||
}
|
}
|
||||||
visible: base.width > 1130
|
visible: base.width - allItemsWidth - 3 * this.width > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// #3 Top view
|
// #3 Top view
|
||||||
@ -122,7 +139,7 @@ Rectangle
|
|||||||
onClicked:{
|
onClicked:{
|
||||||
UM.Controller.rotateView("y", 90);
|
UM.Controller.rotateView("y", 90);
|
||||||
}
|
}
|
||||||
visible: base.width > 1160
|
visible: base.width - allItemsWidth - 2 * this.width > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// #4 Left view
|
// #4 Left view
|
||||||
@ -134,7 +151,7 @@ Rectangle
|
|||||||
onClicked:{
|
onClicked:{
|
||||||
UM.Controller.rotateView("x", 90);
|
UM.Controller.rotateView("x", 90);
|
||||||
}
|
}
|
||||||
visible: base.width > 1190
|
visible: base.width - allItemsWidth - 1 * this.width > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// #5 Left view
|
// #5 Left view
|
||||||
@ -146,14 +163,13 @@ Rectangle
|
|||||||
onClicked:{
|
onClicked:{
|
||||||
UM.Controller.rotateView("x", -90);
|
UM.Controller.rotateView("x", -90);
|
||||||
}
|
}
|
||||||
visible: base.width > 1210
|
visible: base.width - allItemsWidth > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ComboBox
|
ComboBox
|
||||||
{
|
{
|
||||||
id: viewModeButton
|
id: viewModeButton
|
||||||
property int rightMargin: UM.Theme.getSize("sidebar").width + UM.Theme.getSize("default_margin").width;
|
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
@ -161,14 +177,6 @@ Rectangle
|
|||||||
rightMargin: rightMargin
|
rightMargin: rightMargin
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateMargins() {
|
|
||||||
if (UM.Preferences.getValue("cura/sidebar_collapse")) {
|
|
||||||
rightMargin = UM.Theme.getSize("default_margin").width;
|
|
||||||
} else {
|
|
||||||
rightMargin = UM.Theme.getSize("sidebar").width + UM.Theme.getSize("default_margin").width;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
style: UM.Theme.styles.combobox
|
style: UM.Theme.styles.combobox
|
||||||
visible: UM.Controller.activeStage.stageId != "MonitorStage"
|
visible: UM.Controller.activeStage.stageId != "MonitorStage"
|
||||||
|
|
||||||
@ -210,13 +218,6 @@ Rectangle
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expand or collapse sidebar
|
|
||||||
Connections
|
|
||||||
{
|
|
||||||
target: Cura.Actions.expandSidebar
|
|
||||||
onTriggered: viewModeButton.updateMargins()
|
|
||||||
}
|
|
||||||
|
|
||||||
Loader
|
Loader
|
||||||
{
|
{
|
||||||
id: view_panel
|
id: view_panel
|
||||||
@ -233,4 +234,16 @@ Rectangle
|
|||||||
source: UM.ActiveView.valid ? UM.ActiveView.activeViewPanel : "";
|
source: UM.ActiveView.valid ? UM.ActiveView.activeViewPanel : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Expand or collapse sidebar
|
||||||
|
Connections
|
||||||
|
{
|
||||||
|
target: Cura.Actions.expandSidebar
|
||||||
|
onTriggered: updateMarginsAndSizes()
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted:
|
||||||
|
{
|
||||||
|
updateMarginsAndSizes();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user