diff --git a/shell/Ui/PanelSlider.qml b/shell/Ui/PanelSlider.qml index 019f3d49..b7ec9495 100644 --- a/shell/Ui/PanelSlider.qml +++ b/shell/Ui/PanelSlider.qml @@ -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 diff --git a/shell/plugins/osd/Osd.qml b/shell/plugins/osd/Osd.qml index 6d431658..ad06180d 100644 --- a/shell/plugins/osd/Osd.qml +++ b/shell/plugins/osd/Osd.qml @@ -15,8 +15,6 @@ Item { property bool hasProgress: true property int duration: 1200 - function clamp(v, min, max) { return Math.max(min, Math.min(max, v)) } - function iconFor(name, percent) { var n = String(name || "").toLowerCase() if (n === "volume-muted" || n === "volume-mute" || n === "muted" || n === "mute") return "" @@ -41,7 +39,7 @@ Item { maxValue = Math.max(1, parseInt(rawMax || "100", 10)) var parsed = parseInt(rawValue || "0", 10) hasProgress = rawValue !== "" && !isNaN(parsed) && rawMessage === "" - value = hasProgress ? clamp(parsed, 0, maxValue) : 0 + value = hasProgress ? Util.clamp(parsed, 0, maxValue) : 0 message = String(rawMessage || (hasProgress ? (rawProgressText || Math.round(value * 100 / maxValue) + "%") : "")) icon = iconFor(iconName, hasProgress ? Math.round(value * 100 / maxValue) : -1) var parsedDuration = parseInt(rawDuration || "1200", 10)