new popup system

This commit is contained in:
kossLAN 2025-08-10 23:54:48 -04:00
parent d29234ed84
commit 9cc386b5b5
Signed by: kossLAN
SSH key fingerprint: SHA256:bdV0x+wdQHGJ6LgmstH3KV8OpWY+OOFmJcPcB0wQPV8

View file

@ -30,12 +30,13 @@ Scope {
if (lastActiveItem != null && lastActiveItem != activeItem) { if (lastActiveItem != null && lastActiveItem != activeItem) {
lastActiveItem.targetVisible = false; lastActiveItem.targetVisible = false;
} }
if (activeItem != null)
lastActiveItem = activeItem;
} }
function setItem(item: PopupItem) { function setItem(item: PopupItem) {
if (activeItem != null) {
lastActiveItem = activeItem;
}
activeItem = item; activeItem = item;
} }
@ -90,12 +91,15 @@ Scope {
StyledRectangle { StyledRectangle {
id: parentItem id: parentItem
width: Math.max(1, x2 - x1) width: targetWidth
height: Math.max(1, h) height: targetHeight
x: x1 ?? 0 x: targetX
y: root.gaps y: root.gaps
clip: true clip: true
readonly property var targetWidth: root.shownItem?.implicitWidth ?? 0
readonly property var targetHeight: root.shownItem?.implicitHeight ?? 0
readonly property var targetX: { readonly property var targetX: {
if (root.shownItem == null) { if (root.shownItem == null) {
return 0; return 0;
@ -117,15 +121,6 @@ Scope {
return xPos; return xPos;
} }
readonly property var targetWidth: root.shownItem?.implicitWidth ?? 0
readonly property var targetHeight: root.shownItem?.implicitHeight ?? 0
property var h
property var x1
property var x2
property var largestAnimHeight: 0
Component.onCompleted: { Component.onCompleted: {
root.parentItem = this; root.parentItem = this;
@ -134,30 +129,29 @@ Scope {
} }
} }
SmoothedAnimation on x1 { // TODO: Make a close animation, a little complicated, will need to track if an animation is running
id: x1Anim // and stop unload from occuring until its done, in the LazyLoader.
to: parentItem.targetX
onToChanged: { Behavior on width {
velocity = (Math.max(parentItem.x1, to) - Math.min(parentItem.x1, to)) * 5; enabled: root.lastActiveItem != null
restart(); SmoothedAnimation {
duration: 300
easing.type: Easing.InOutQuad
} }
} }
SmoothedAnimation on x2 { Behavior on height {
id: x2Anim SmoothedAnimation {
to: parentItem.targetX + parentItem.targetWidth duration: 300
onToChanged: { easing.type: Easing.InOutQuad
velocity = (Math.max(parentItem.x2, to) - Math.min(parentItem.x2, to)) * 5;
restart();
} }
} }
SmoothedAnimation on h { Behavior on x {
id: heightAnim enabled: root.lastActiveItem != null
to: parentItem.targetHeight SmoothedAnimation {
onToChanged: { duration: 300
velocity = (Math.max(parentItem.height, to) - Math.min(parentItem.height, to)) * 5; easing.type: Easing.InOutQuad
restart();
} }
} }
} }