feat: improve media slider + actually impl

This commit is contained in:
2 * r + 2 * t 2026-05-04 04:13:57 +10:00
parent a28316ad5a
commit 2ceb2a416f
2 changed files with 12 additions and 4 deletions

View file

@ -22,7 +22,7 @@ Slider {
signal interaction(v: real) signal interaction(v: real)
implicitWidth: 200 implicitWidth: 200
implicitHeight: 8 implicitHeight: 12
contentItem: Item { contentItem: Item {
anchors.fill: parent anchors.fill: parent
@ -64,8 +64,8 @@ Slider {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: Tokens.spacing.extraSmall anchors.leftMargin: Tokens.spacing.extraSmall
implicitWidth: parent.height * 0.75 implicitWidth: 4
implicitHeight: parent.height * (mouse.pressed ? 5 : 4) implicitHeight: parent.height * (mouse.pressed ? 4 : 3)
radius: Tokens.rounding.full radius: Tokens.rounding.full
color: root.fgColour color: root.fgColour
@ -84,7 +84,7 @@ Slider {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
implicitHeight: lineWidth * amplitudeMultiplier * 2 + lineWidth implicitHeight: lineWidth * amplitudeMultiplier * 2 + lineWidth
lineWidth: parent.height - 1 lineWidth: parent.height * (root.wavy ? 0.7 : 1)
amplitudeMultiplier: root.wavy ? 0.5 : 0 amplitudeMultiplier: root.wavy ? 0.5 : 0
startX: x startX: x
fullLength: parent.width - handle.implicitWidth - handle.anchors.leftMargin fullLength: parent.width - handle.implicitWidth - handle.anchors.leftMargin

View file

@ -89,6 +89,14 @@ ColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
value: Players.active ? Players.active.position / (Players.active.length || 1) : 0 value: Players.active ? Players.active.position / (Players.active.length || 1) : 0
enabled: Players.active?.canSeek ?? false enabled: Players.active?.canSeek ?? false
animateWave: Players.active?.isPlaying ?? false
waveFrequency: 5
waveDuration: 2000
onInteraction: value => {
const active = Players.active;
if (active?.canSeek && active?.positionSupported)
active.position = value * active.length;
}
} }
StyledText { StyledText {