Fix(Communities): Change cursor shape on hovering ColorPicker
Close #7778
This commit is contained in:
parent
8b6b0493df
commit
adaf4a9ee2
|
@ -92,23 +92,26 @@ Item {
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: hueArea
|
id: hueArea
|
||||||
|
|
||||||
property bool pressedOnGauge: false
|
property bool hoverOnGauge: false
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
preventStealing: true
|
preventStealing: true
|
||||||
onPressed: {
|
cursorShape: hoverOnGauge ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||||
// Check we clicked on gauge
|
onPositionChanged: {
|
||||||
|
// Check we hovering gauge
|
||||||
let dist = Math.sqrt(Math.pow(width / 2 - mouseX, 2) +
|
let dist = Math.sqrt(Math.pow(width / 2 - mouseX, 2) +
|
||||||
Math.pow(height / 2 - mouseY, 2));
|
Math.pow(height / 2 - mouseY, 2));
|
||||||
let radius = Math.min(width, height) / 2;
|
let radius = Math.min(width, height) / 2;
|
||||||
if (dist < radius - thickness || dist > radius)
|
hoverOnGauge = !(dist < radius - thickness || dist > radius);
|
||||||
return;
|
|
||||||
|
|
||||||
pressedOnGauge = true;
|
if (hoverOnGauge && pressed)
|
||||||
pickRootColor();
|
pickRootColor();
|
||||||
|
}
|
||||||
|
onPressed: {
|
||||||
|
if (hoverOnGauge)
|
||||||
|
pickRootColor();
|
||||||
}
|
}
|
||||||
onReleased: pressedOnGauge = false
|
|
||||||
onPositionChanged: if (pressedOnGauge) pickRootColor()
|
|
||||||
|
|
||||||
function pickRootColor() {
|
function pickRootColor() {
|
||||||
// Update both colors
|
// Update both colors
|
||||||
|
@ -151,13 +154,15 @@ Item {
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: satValArea
|
id: satValArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
preventStealing: true
|
preventStealing: true
|
||||||
|
cursorShape: containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||||
onPressed: {
|
onPressed: {
|
||||||
d.pickingSatVal = true;
|
d.pickingSatVal = true;
|
||||||
pickColor();
|
pickColor();
|
||||||
}
|
}
|
||||||
onReleased: d.pickingSatVal = false
|
onReleased: d.pickingSatVal = false
|
||||||
onPositionChanged: pickColor()
|
onPositionChanged: if (pressed) pickColor()
|
||||||
|
|
||||||
function pickColor() {
|
function pickColor() {
|
||||||
root.color = pickColorFromSatValRect(mouseX, mouseY);
|
root.color = pickColorFromSatValRect(mouseX, mouseY);
|
||||||
|
|
|
@ -32,5 +32,13 @@ RadioButton {
|
||||||
border.color: StatusColors.colors['grey3']
|
border.color: StatusColors.colors['grey3']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: mouseArea
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onPressed: mouse.accepted = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue