nicer globe

This commit is contained in:
ari committed 2026-10-27 13:35:31 -04:00
1 parent ee1d5a1170
commit 98f34b8328
5 files changed
+205 -21

No files matched your search

+56 -1
View File
@@ -4,7 +4,8 @@ import QtQuick
// closed loop, seen from a little above. The front half shows the outside
// of the strip, the back half shows the inside, so the far windows wrap
// around behind and face the viewer too. With only a few windows they sit
// flat, side by side. The loop sits right of the middle, beside the globe.
// flat, side by side. The loop sits right of the middle, beside the globe,
// with small moons above and below for the workspaces next to this one.
Item {
id: root
@@ -15,9 +16,15 @@ Item {
required property bool expanded
// Shown under the front window, "" for none.
required property string exitHint
// Workspaces shown as moons above and below, from parsed JSON, so
// these stay untyped. null for none.
required property var aboveWorkspace
required property var belowWorkspace
// A window was focused.
signal windowChosen
// A moon was clicked: -1 for the one above, 1 for the one below.
signal neighbourChosen(int delta)
// Windows of the shown workspace, from parsed JSON, so this stays untyped.
readonly property var windows: {
@@ -60,6 +67,9 @@ Item {
readonly property int selectedIndex: root.wrapIndex(root.targetStep)
// Size of the planet, which pops out as the loop opens.
property real planetPop: 1
opacity: root.expanded ? 1 : 0
scale: root.expanded ? 1 : root.theme.loopStartScale
visible: root.opacity > 0
@@ -90,6 +100,21 @@ Item {
}
}
onExpandedChanged: {
if (root.expanded)
popAnim.restart();
}
NumberAnimation {
id: popAnim
target: root
property: "planetPop"
from: root.theme.loopStartScale
to: 1
duration: root.theme.planetPopDuration
easing.type: Easing.OutBack
}
ParallelAnimation {
id: switchAnim
@@ -239,6 +264,34 @@ Item {
text: "No windows on this workspace"
}
// The workspaces next to this one, as moons. Each moon's middle
// sits moonDistance from the loop's middle; its name hangs below.
WorkspaceMoon {
id: aboveMoon
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: -root.theme.moonDistance + (aboveMoon.height - root.theme.moonSize) / 2
z: 3
opacity: root.switchFade
enabled: root.expanded
theme: root.theme
workspace: root.aboveWorkspace
onActivated: root.neighbourChosen(-1)
}
WorkspaceMoon {
id: belowMoon
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: root.theme.moonDistance + (belowMoon.height - root.theme.moonSize) / 2
z: 3
opacity: root.switchFade
enabled: root.expanded
theme: root.theme
workspace: root.belowWorkspace
onActivated: root.neighbourChosen(1)
}
// Zero sized point in the middle. Each ring is pushed down by half
// the lift, unless flat, so it sits in the middle as a whole.
Item {
@@ -263,6 +316,7 @@ Item {
// Its previews are already out, so they should not grow again.
growPreview: false
gather: root.leavingGather
planetGrow: 1
}
WindowRing {
@@ -280,6 +334,7 @@ Item {
live: root.expanded
growPreview: true
gather: root.gather
planetGrow: root.planetPop
onActivated: index => root.activateAt(index)
}