Use PointingRectangle for toolpanel flyouts

This commit is contained in:
fieldOfView 2015-12-01 16:24:07 +01:00
parent 4d29fccb0b
commit 2fa29de4b9
3 changed files with 25 additions and 10 deletions

View File

@ -13,7 +13,7 @@ Item {
width: buttons.width; width: buttons.width;
height: buttons.height height: buttons.height
//property int activeY property int activeY
ColumnLayout { ColumnLayout {
id: buttons; id: buttons;
@ -43,22 +43,25 @@ Item {
anchors.fill: parent; anchors.fill: parent;
onClicked: { onClicked: {
parent.checked ? UM.Controller.setActiveTool(null) : UM.Controller.setActiveTool(model.id); parent.checked ? UM.Controller.setActiveTool(null) : UM.Controller.setActiveTool(model.id);
//base.activeY = parent.y base.activeY = parent.y
} }
} }
} }
} }
} }
Rectangle { UM.PointingRectangle {
id: panelBackground; id: panelBorder;
anchors.left: parent.right; anchors.left: parent.right;
anchors.leftMargin: UM.Theme.sizes.default_margin.width; anchors.leftMargin: UM.Theme.sizes.default_margin.width;
anchors.top: parent.top; anchors.top: base.top;
//y: base.activeY anchors.topMargin: base.activeY
z: buttons.z -1 z: buttons.z -1
target: Qt.point(parent.right, base.activeY + UM.Theme.sizes.button.height/2)
arrowSize: UM.Theme.sizes.default_arrow.width
width: { width: {
if (panel.item && panel.width > 0){ if (panel.item && panel.width > 0){
return Math.max(panel.width + 2 * UM.Theme.sizes.default_margin.width) return Math.max(panel.width + 2 * UM.Theme.sizes.default_margin.width)
@ -72,9 +75,20 @@ Item {
opacity: panel.item ? 1 : 0 opacity: panel.item ? 1 : 0
Behavior on opacity { NumberAnimation { duration: 100 } } Behavior on opacity { NumberAnimation { duration: 100 } }
color: UM.Theme.colors.lining;
//border.width: UM.Theme.sizes.default_lining.width
//border.color: UM.Theme.colors.lining
UM.PointingRectangle {
id: panelBackground;
color: UM.Theme.colors.tool_panel_background; color: UM.Theme.colors.tool_panel_background;
border.width: UM.Theme.sizes.default_lining.width anchors.fill: parent
border.color: UM.Theme.colors.lining anchors.margins: UM.Theme.sizes.default_lining.width
target: Qt.point(-UM.Theme.sizes.default_margin.width, UM.Theme.sizes.button.height/2)
arrowSize: parent.arrowSize
}
Loader { Loader {
id: panel id: panel

View File

@ -165,6 +165,7 @@
"window_margin": [1.0, 1.0], "window_margin": [1.0, 1.0],
"default_margin": [1.0, 1.0], "default_margin": [1.0, 1.0],
"default_lining": [0.08, 0.08], "default_lining": [0.08, 0.08],
"default_arrow": [0.8, 0.8],
"logo": [9.5, 2.0], "logo": [9.5, 2.0],
"sidebar": [30.0, 10.0], "sidebar": [30.0, 10.0],