mirror of
https://github.com/kossLAN/dots.git
synced 2025-11-04 22:49:50 -05:00
new popup system
This commit is contained in:
parent
d29234ed84
commit
9cc386b5b5
1 changed files with 27 additions and 33 deletions
|
|
@ -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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue