left-bar working, bottom bar semi-broken
This commit is contained in:
+37
-6
@@ -10,27 +10,51 @@ Item {
|
||||
|
||||
required property real borderThickness
|
||||
readonly property alias content: content
|
||||
property real offsetScale: y > 0 || content.hasCurrent ? 0 : 1
|
||||
readonly property bool horizontal: position !== "left"
|
||||
// property real offsetScale: y > 0 || content.hasCurrent ? 0 : 1
|
||||
property real offsetScale: {
|
||||
if (content.hasCurrent)
|
||||
return 0;
|
||||
if (position === "top")
|
||||
return y > 0 ? 0 : 1;
|
||||
if (position === "bottom")
|
||||
return 1;
|
||||
return x > 0 ? 0 : 1;
|
||||
}
|
||||
required property string position
|
||||
required property ShellScreen screen
|
||||
|
||||
anchors.bottom: position === "bottom" ? parent.bottom : undefined
|
||||
clip: true
|
||||
implicitHeight: content.implicitHeight * (1 - offsetScale)
|
||||
implicitWidth: content.implicitWidth
|
||||
implicitHeight: horizontal ? content.implicitHeight * (1 - offsetScale) : content.implicitHeight
|
||||
implicitWidth: horizontal ? content.implicitWidth : content.implicitWidth * (1 - offsetScale)
|
||||
visible: width > 0 && height > 0
|
||||
x: {
|
||||
if (!horizontal)
|
||||
return 0;
|
||||
const off = content.currentCenter - borderThickness - content.nonAnimWidth / 2;
|
||||
const diff = parent.width - Math.floor(off + content.nonAnimWidth);
|
||||
if (diff < 0)
|
||||
return off + diff;
|
||||
return Math.floor(Math.max(off, 0));
|
||||
}
|
||||
y: {
|
||||
if (horizontal)
|
||||
return 0;
|
||||
|
||||
const off = content.currentCenter - borderThickness - content.nonAnimHeight / 2;
|
||||
const diff = parent.height - Math.floor(off + content.nonAnimHeight);
|
||||
if (diff < 0)
|
||||
return off + diff;
|
||||
return Math.max(off, 0);
|
||||
}
|
||||
|
||||
Behavior on offsetScale {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
Behavior on x {
|
||||
enabled: root.offsetScale < 1
|
||||
enabled: !root.horizontal || root.offsetScale < 1
|
||||
|
||||
Anim {
|
||||
duration: content.animLength
|
||||
@@ -38,6 +62,8 @@ Item {
|
||||
}
|
||||
}
|
||||
Behavior on y {
|
||||
enabled: root.horizontal || root.offsetScale < 1
|
||||
|
||||
Anim {
|
||||
duration: content.animLength
|
||||
easing.bezierCurve: content.animCurve
|
||||
@@ -47,9 +73,14 @@ Item {
|
||||
Wrapper {
|
||||
id: content
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: root.position === "bottom" ? parent.bottom : undefined
|
||||
anchors.bottomMargin: (-implicitHeight - 5) * root.offsetScale
|
||||
anchors.horizontalCenter: root.horizontal ? parent.horizontalCenter : undefined
|
||||
anchors.left: root.horizontal ? undefined : parent.left
|
||||
anchors.leftMargin: (-implicitWidth - 5) * root.offsetScale
|
||||
anchors.top: root.position === "top" ? parent.top : undefined
|
||||
anchors.topMargin: (-implicitHeight - 5) * root.offsetScale
|
||||
anchors.verticalCenter: root.horizontal ? undefined : parent.verticalCenter
|
||||
offsetScale: root.offsetScale
|
||||
screen: root.screen
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user