diff --git a/res/skins/QMLDemo/AuxiliaryUnit.qml b/res/skins/QMLDemo/AuxiliaryUnit.qml index a433cfab3f2..62eb11118f6 100644 --- a/res/skins/QMLDemo/AuxiliaryUnit.qml +++ b/res/skins/QMLDemo/AuxiliaryUnit.qml @@ -35,7 +35,7 @@ Row { anchors.centerIn: parent width: 48 height: width - arcStart: 0 + arcStart: Knob.ArcStart.Minimum group: root.group key: "pregain" color: Theme.gainKnobColor diff --git a/res/skins/QMLDemo/EffectUnit.qml b/res/skins/QMLDemo/EffectUnit.qml index 02b89d26d2a..2bb5206eddf 100644 --- a/res/skins/QMLDemo/EffectUnit.qml +++ b/res/skins/QMLDemo/EffectUnit.qml @@ -63,7 +63,7 @@ Item { anchors.top: parent.top anchors.bottom: parent.bottom anchors.margins: 5 - arcStart: 0 + arcStart: Knob.ArcStart.Minimum width: 40 group: effect.group key: "meta" @@ -93,7 +93,7 @@ Item { anchors.centerIn: parent width: 48 height: 48 - arcStart: 0 + arcStart: Knob.ArcStart.Minimum group: "[EffectRack1_EffectUnit" + unitNumber + "]" key: "super1" color: Theme.effectUnitColor diff --git a/res/skins/QMLDemo/MicrophoneUnit.qml b/res/skins/QMLDemo/MicrophoneUnit.qml index aef83afb799..5a610fc86cc 100644 --- a/res/skins/QMLDemo/MicrophoneUnit.qml +++ b/res/skins/QMLDemo/MicrophoneUnit.qml @@ -35,7 +35,7 @@ Row { anchors.centerIn: parent width: 48 height: width - arcStart: 0 + arcStart: Knob.ArcStart.Minimum group: root.group key: "pregain" color: Theme.gainKnobColor diff --git a/res/skins/QMLDemo/Mixxx/Controls/Knob.qml b/res/skins/QMLDemo/Mixxx/Controls/Knob.qml index 303ef760774..aa986b02ecc 100644 --- a/res/skins/QMLDemo/Mixxx/Controls/Knob.qml +++ b/res/skins/QMLDemo/Mixxx/Controls/Knob.qml @@ -6,6 +6,12 @@ import QtQuick.Shapes 1.12 Item { id: root + enum ArcStart { + Minimum, + Center, + Maximum + } + property real value: min property alias background: background.data property alias foreground: foreground.data @@ -14,8 +20,18 @@ Item { property real wheelStepSize: (root.max - root.min) / 10 property real angle: 130 property bool arc: false + property int arcStart: Knob.Center property real arcRadius: width / 2 - property real arcStart: (max - min) / 2 + readonly property real arcStartValue: { + switch (arcStart) { + case Knob.ArcStart.Minimum: + return min; + case Knob.ArcStart.Maximum: + return max; + default: + return valueCenter; + } + } property real arcOffsetX: 0 property real arcOffsetY: 0 property alias arcColor: arcPath.strokeColor @@ -56,8 +72,8 @@ Item { fillColor: "transparent" PathAngleArc { - startAngle: root.angleFrom(root.arcStart - root.valueCenter) - 90 - sweepAngle: root.angleFrom(root.value - root.arcStart) + startAngle: root.angleFrom(root.arcStartValue - root.valueCenter) - 90 + sweepAngle: root.angleFrom(root.value - root.arcStartValue) radiusX: root.arcRadius radiusY: root.arcRadius centerX: root.width / 2 + root.arcOffsetX