Small cleanups: reuse Util.clamp in OSD; PanelSlider hover via _hot

OSD reimplemented clamp() inline when Util already has one.

PanelSlider's knob-scale binding read `mouseArea.containsMouse` directly
instead of going through a `_hot` like the other interactive controls
(TextField, NumberField, Dropdown). Mirror them so future style work
has a single property to override.
This commit is contained in:
David Heinemeier Hansson
2026-05-20 20:33:27 +02:00
parent 04e7820ebe
commit 8ed6e302b0
2 changed files with 3 additions and 4 deletions
+2 -1
View File
@@ -28,6 +28,7 @@ Item {
readonly property real range: Math.max(0.0001, maximum - minimum)
readonly property real progress: Math.max(0, Math.min(1, (liveValue - minimum) / range))
readonly property bool _hot: mouseArea.containsMouse || root.dragging
Rectangle {
id: track
@@ -64,7 +65,7 @@ Item {
border.width: Math.max(1, Style.space(2))
anchors.verticalCenter: track.verticalCenter
x: Math.max(0, Math.min(track.width - width, track.width * root.progress - width / 2))
scale: mouseArea.containsMouse || root.dragging ? 1.15 : 1.0
scale: root._hot ? 1.15 : 1.0
Behavior on x {
enabled: !root.dragging