fixes for drawing
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 9s
Python / lint-format (pull_request) Successful in 14s
Python / test (pull_request) Successful in 29s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m8s

This commit is contained in:
2026-06-20 14:23:15 +02:00
parent a1c148bf70
commit 81eb56e1d0
7 changed files with 56 additions and 39 deletions
+24 -3
View File
@@ -1,9 +1,30 @@
pragma ComponentBehavior: Bound
import Quickshell
import QtQuick
import ZShell.Internal
StrokeCanvas {
Item {
id: root
penColor: "white"
penWidth: 4
readonly property alias content: contentLoader.item
readonly property PersistentProperties drawingState: PersistentProperties {
property color penColor: "white"
property int penWidth: 4
reloadableId: "drawingState"
}
required property PersistentProperties visibilities
Loader {
id: contentLoader
active: root.visibilities.isDrawing
anchors.fill: parent
sourceComponent: StrokeCanvas {
penColor: root.drawingState.penColor
penWidth: root.drawingState.penWidth
}
}
}
+7 -6
View File
@@ -123,13 +123,12 @@ Item {
property bool setInitialPoint: false
acceptedButtons: Qt.LeftButton | Qt.RightButton
enabled: root.visibilities.isDrawing && !root.inLeftPanel(root.panels.drawing, hoverHandler.point.position.x, hoverHandler.point.position.y)
grabPermissions: PointerHandler.CanTakeOverFromAnything | PointerHandler.TakeOverForbidden
enabled: root.visibilities.isDrawing && (!root.inLeftPanel(root.panels.drawing, hoverHandler.point.position.x, hoverHandler.point.position.y) || !root.panels.drawing.expanded)
onActiveChanged: {
if (!active) {
setInitialPoint = false;
root.drawing.endStroke();
root.drawing.content.endStroke();
} else {
root.panels.drawing.expanded = false;
}
@@ -149,17 +148,19 @@ Item {
if (!setInitialPoint) {
setInitialPoint = true;
root.drawing.beginStroke(origX, origY);
root.drawing.content.beginStroke(origX, origY);
return;
}
root.drawing.appendPoint(x, y);
root.drawing.content.appendPoint(x, y);
}
}
HoverHandler {
id: hoverHandler
cursorShape: root.visibilities.isDrawing && !root.inLeftPanel(root.panels.drawing, point.position.x, point.position.y) ? Qt.CrossCursor : undefined
onHoveredChanged: {
if (!hovered) {
if (!root.osdShortcutActive) {
@@ -180,7 +181,7 @@ Item {
const y = point.position.y;
if (root.visibilities.isDrawing) {
if (root.inLeftPanel(root.panels.drawing, x, y))
if (root.inLeftPanel(root.panels.drawing, x, y) && !(drawingHandler.point.pressedButtons & Qt.LeftButton))
root.panels.drawing.expanded = true;
return;
}
+10 -15
View File
@@ -361,23 +361,18 @@ CustomWindow {
}
}
Loader {
id: drawingLoader
Drawing {
id: drawing
active: visibilities.isDrawing
anchors.fill: parent
layer.enabled: true
visibilities: visibilities
z: 2
sourceComponent: Drawing {
id: drawing
layer.enabled: true
layer.effect: MultiEffect {
maskEnabled: true
maskInverted: true
maskSource: maskSource
}
layer.effect: MultiEffect {
maskEnabled: true
maskInverted: true
maskSource: maskSource
}
}
@@ -406,7 +401,7 @@ CustomWindow {
anchors.fill: parent
bar: bar
borderThickness: root.borderLayoutThickness
drawing: drawingLoader.item
drawing: drawing
enabled: true
panels: panels
popouts: panels.popouts
@@ -418,7 +413,7 @@ CustomWindow {
bar: bar
borderThickness: root.borderThickness
drawingItem: drawingLoader.item
drawingItem: drawing
screen: root.screen
visibilities: visibilities