fix: merge two strokecanvas into one + better cursorShape and pointer handling

This commit is contained in:
2026-10-04 13:48:50 +02:00
parent dc99d6677c
commit 5507b99fdc
4 changed files with 110 additions and 87 deletions
+28 -12
View File
@@ -5,6 +5,7 @@ import QtQuick
Item {
id: root
required property int border
property color handleBorder: "#3584e4"
property color handleFill: "white"
property real hs: 12
@@ -13,6 +14,8 @@ Item {
required property real selW
required property real selX
required property real selY
required property Rectangle selection
required property string tool
signal boundsChanged(x: real, y: real, w: real, h: real)
signal dragFinished
@@ -29,6 +32,7 @@ Item {
property real accumX: 0
property real accumY: 0
cursorShape: undefined
target: null
onActiveChanged: {
@@ -45,51 +49,63 @@ Item {
}
}
HoverHandler {
cursorShape: {
if (root.tool !== "move")
return undefined;
if (moveHandler.centroid.pressedButtons & Qt.LeftButton)
return Qt.ClosedHandCursor;
else
return Qt.OpenHandCursor;
}
}
Handle {
edge: "tl"
x: -root.hs / 2
y: -root.hs / 2
x: -(root.hs + root.border) / 2
y: -(root.hs + root.border) / 2
}
Handle {
edge: "t"
x: root.width / 2 - root.hs / 2
y: -root.hs / 2
y: -(root.hs + root.border) / 2
}
Handle {
edge: "tr"
x: root.width - root.hs / 2
y: -root.hs / 2
x: root.width - root.hs / 2 + root.border / 2
y: -(root.hs + root.border) / 2
}
Handle {
edge: "r"
x: root.width - root.hs / 2
x: root.width - root.hs / 2 + root.border / 2
y: root.height / 2 - root.hs / 2
}
Handle {
edge: "br"
x: root.width - root.hs / 2
y: root.height - root.hs / 2
x: root.width - root.hs / 2 + root.border / 2
y: root.height - root.hs / 2 + root.border / 2
}
Handle {
edge: "b"
x: root.width / 2 - root.hs / 2
y: root.height - root.hs / 2
y: root.height - root.hs / 2 + root.border / 2
}
Handle {
edge: "bl"
x: -root.hs / 2
y: root.height - root.hs / 2
x: -(root.hs + root.border) / 2
y: root.height - root.hs / 2 + root.border / 2
}
Handle {
edge: "l"
x: -root.hs / 2
x: -(root.hs + root.border) / 2
y: root.height / 2 - root.hs / 2
}