forked from Shinonome/dots-hyprland
styledslider: make marks with any range
This commit is contained in:
@@ -73,12 +73,13 @@ Slider {
|
|||||||
|
|
||||||
component TrackDot: Rectangle {
|
component TrackDot: Rectangle {
|
||||||
required property real value
|
required property real value
|
||||||
|
property real normalizedValue: (value - root.from) / (root.to - root.from)
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
x: root.handleMargins + (value * root.effectiveDraggingWidth) - (root.trackDotSize / 2)
|
x: root.handleMargins + (normalizedValue * root.effectiveDraggingWidth) - (root.trackDotSize / 2)
|
||||||
width: root.trackDotSize
|
width: root.trackDotSize
|
||||||
height: root.trackDotSize
|
height: root.trackDotSize
|
||||||
radius: Appearance.rounding.full
|
radius: Appearance.rounding.full
|
||||||
color: value > root.visualPosition ? root.dotColor : root.dotColorHighlighted
|
color: normalizedValue > root.visualPosition ? root.dotColor : root.dotColorHighlighted
|
||||||
|
|
||||||
Behavior on color {
|
Behavior on color {
|
||||||
animation: Appearance.animation.elementMoveFast.colorAnimation.createObject(this)
|
animation: Appearance.animation.elementMoveFast.colorAnimation.createObject(this)
|
||||||
|
|||||||
Reference in New Issue
Block a user