move picker to main panelwindow to reduce vram usage
This commit is contained in:
@@ -59,6 +59,7 @@ Item {
|
||||
}
|
||||
|
||||
anchors.fill: parent
|
||||
enabled: tool !== "none"
|
||||
|
||||
StrokeCanvas {
|
||||
id: canvas
|
||||
@@ -77,15 +78,12 @@ Item {
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
anchors.fill: parent
|
||||
cursorShape: undefined
|
||||
enabled: root.tool !== "none"
|
||||
hoverEnabled: true
|
||||
enabled: root.enabled
|
||||
|
||||
onPositionChanged: e => {
|
||||
const x = e.x;
|
||||
const y = e.y;
|
||||
|
||||
canvas.hoverPoint = Qt.point(x, y);
|
||||
|
||||
if (!pressed)
|
||||
return;
|
||||
|
||||
@@ -125,12 +123,16 @@ Item {
|
||||
const withinYHeight = y > root.selection.y && y < root.selection.y + root.selection.implicitHeight;
|
||||
|
||||
if (withinXWidth && withinYHeight) {
|
||||
canvas.showHover(x, y);
|
||||
if (!drawHandler.pressed)
|
||||
canvas.showHover(x, y);
|
||||
else
|
||||
canvas.showHover(drawHandler.mouseX, drawHandler.mouseY);
|
||||
return Qt.BlankCursor;
|
||||
} else {
|
||||
canvas.hideHover();
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
enabled: root.enabled
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import ZShell.Internal
|
||||
import qs.Services
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
required property int border
|
||||
property color handleBorder: "#3584e4"
|
||||
property color handleFill: "white"
|
||||
property color handleBorder: Colors.palette.m3primary
|
||||
property color handleFill: Colors.palette.m3onPrimary
|
||||
property real hs: 12
|
||||
property real minSize: 24
|
||||
required property real selH
|
||||
@@ -26,6 +28,8 @@ Item {
|
||||
x: selX
|
||||
y: selY
|
||||
|
||||
Component.onDestruction: Cursor.clearOverride()
|
||||
|
||||
DragHandler {
|
||||
id: moveHandler
|
||||
|
||||
@@ -33,6 +37,7 @@ Item {
|
||||
property real accumY: 0
|
||||
|
||||
cursorShape: undefined
|
||||
dragThreshold: 0
|
||||
target: null
|
||||
|
||||
onActiveChanged: {
|
||||
@@ -54,7 +59,7 @@ Item {
|
||||
if (root.tool !== "move")
|
||||
return undefined;
|
||||
|
||||
if (moveHandler.centroid.pressedButtons & Qt.LeftButton)
|
||||
if ((moveHandler.centroid.pressedButtons & Qt.LeftButton) && moveHandler.active)
|
||||
return Qt.ClosedHandCursor;
|
||||
else
|
||||
return Qt.OpenHandCursor;
|
||||
@@ -123,6 +128,8 @@ Item {
|
||||
z: 10
|
||||
|
||||
HoverHandler {
|
||||
id: hover
|
||||
|
||||
cursorShape: {
|
||||
switch (handle.edge) {
|
||||
case "tl":
|
||||
@@ -148,6 +155,7 @@ Item {
|
||||
property real startX
|
||||
property real startY
|
||||
|
||||
dragThreshold: 0
|
||||
grabPermissions: PointerHandler.CanTakeOverFromAnything | PointerHandler.TakeOverForbidden
|
||||
target: null
|
||||
|
||||
@@ -157,8 +165,10 @@ Item {
|
||||
startY = root.y;
|
||||
startW = root.width;
|
||||
startH = root.height;
|
||||
Cursor.setOverride(hover.cursorShape);
|
||||
} else {
|
||||
root.dragFinished();
|
||||
Cursor.clearOverride();
|
||||
}
|
||||
}
|
||||
onTranslationChanged: {
|
||||
|
||||
Reference in New Issue
Block a user