Fix(Communities): Change cursor shape on hovering ColorPicker

Close #7778
This commit is contained in:
MishkaRogachev 2022-10-06 19:06:50 +04:00 committed by Mikhail Rogachev
parent c4496483d3
commit 238e7fa104
2 changed files with 23 additions and 10 deletions

View File

@ -92,23 +92,26 @@ Item {
MouseArea {
id: hueArea
property bool pressedOnGauge: false
property bool hoverOnGauge: false
anchors.fill: parent
hoverEnabled: true
preventStealing: true
onPressed: {
// Check we clicked on gauge
cursorShape: hoverOnGauge ? Qt.PointingHandCursor : Qt.ArrowCursor
onPositionChanged: {
// Check we hovering gauge
let dist = Math.sqrt(Math.pow(width / 2 - mouseX, 2) +
Math.pow(height / 2 - mouseY, 2));
let radius = Math.min(width, height) / 2;
if (dist < radius - thickness || dist > radius)
return;
hoverOnGauge = !(dist < radius - thickness || dist > radius);
pressedOnGauge = true;
pickRootColor();
if (hoverOnGauge && pressed)
pickRootColor();
}
onPressed: {
if (hoverOnGauge)
pickRootColor();
}
onReleased: pressedOnGauge = false
onPositionChanged: if (pressedOnGauge) pickRootColor()
function pickRootColor() {
// Update both colors
@ -151,13 +154,15 @@ Item {
MouseArea {
id: satValArea
anchors.fill: parent
hoverEnabled: true
preventStealing: true
cursorShape: containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor
onPressed: {
d.pickingSatVal = true;
pickColor();
}
onReleased: d.pickingSatVal = false
onPositionChanged: pickColor()
onPositionChanged: if (pressed) pickColor()
function pickColor() {
root.color = pickColorFromSatValRect(mouseX, mouseY);

View File

@ -32,5 +32,13 @@ RadioButton {
border.color: StatusColors.colors['grey3']
}
}
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onPressed: mouse.accepted = false
}
}