feat: visualiser follow shape

Follow shape for outer max as well, also use 9 cookie instead of 12
cookie
This commit is contained in:
2 * r + 2 * t 2026-05-04 19:21:41 +10:00
parent 8425e6f109
commit 69185acd08

View file

@ -3,6 +3,7 @@ pragma ComponentBehavior: Bound
import QtQuick import QtQuick
import QtQuick.Shapes import QtQuick.Shapes
import Quickshell import Quickshell
import M3Shapes
import Caelestia.Config import Caelestia.Config
import Caelestia.Services import Caelestia.Services
import qs.components import qs.components
@ -14,10 +15,6 @@ Item {
readonly property real centerX: width / 2 readonly property real centerX: width / 2
readonly property real centerY: height / 2 readonly property real centerY: height / 2
readonly property real coverMaxRadius: {
const bounds = cover.shape.pathBounds();
return Math.max(bounds.width, bounds.height) / 2;
}
readonly property real spacing: Tokens.spacing.medium readonly property real spacing: Tokens.spacing.medium
readonly property real maxMagnitude: (implicitWidth - cover.implicitWidth) / 2 - spacing readonly property real maxMagnitude: (implicitWidth - cover.implicitWidth) / 2 - spacing
@ -43,13 +40,13 @@ Item {
id: bar id: bar
required property int modelData required property int modelData
readonly property real value: Math.max(1e-3, Math.min(1, Audio.cava.values[modelData])) readonly property real value: Math.max(1e-2, Math.min(1, Audio.cava.values[modelData]))
readonly property real angle: modelData * 2 * Math.PI / GlobalConfig.services.visualiserBars readonly property real angle: modelData * 2 * Math.PI / GlobalConfig.services.visualiserBars
readonly property real dist: root.coverMaxRadius + root.spacing + strokeWidth / 2 + value * root.maxMagnitude readonly property real dist: shapeEdgeDist + value * root.maxMagnitude
readonly property real shapeEdgeDist: { readonly property real shapeEdgeDist: {
cover.shape.rotation; // Update when shape rotation changes cover.shape.rotation; // Update when shape rotation changes
const sDist = cover.shape.distanceAtAngle(modelData * 360 / GlobalConfig.services.visualiserBars); const sDist = cover.shape.distanceAtAngle(modelData * 360 / GlobalConfig.services.visualiserBars + 90);
return sDist + root.spacing + strokeWidth / 2; return sDist + root.spacing + strokeWidth / 2;
} }
readonly property real cos: Math.cos(angle) readonly property real cos: Math.cos(angle)
@ -78,6 +75,7 @@ Item {
id: cover id: cover
anchors.centerIn: parent anchors.centerIn: parent
shape.shape: MaterialShape.Cookie9Sided
implicitWidth: Tokens.sizes.dashboard.mediaCoverArtSize implicitWidth: Tokens.sizes.dashboard.mediaCoverArtSize
implicitHeight: Tokens.sizes.dashboard.mediaCoverArtSize implicitHeight: Tokens.sizes.dashboard.mediaCoverArtSize
} }