@@ -204,22 +204,26 @@ Variants {
204204 ctx .lineTo (stroke .x2 , stroke .y2 )
205205 ctx .stroke ()
206206 } else if (stroke .type === " arrow" ) {
207- var dx = stroke .x2 - stroke .x1
208- var dy = stroke .y2 - stroke .y1
209- var len = Math .sqrt (dx * dx + dy * dy)
207+ var dx = stroke .x2 - stroke .x1
208+ var dy = stroke .y2 - stroke .y1
209+ var len = Math .sqrt (dx * dx + dy * dy)
210210 if (len < 2 ) { ctx .restore (); return }
211+ var angle = Math .atan2 (dy, dx)
212+ var hs = Math .max (stroke .size * 3.5 , 10 )
213+ var hw = Math .PI / 5
214+ var baseFrac = Math .max (0 , 1 - hs / len)
215+ var bx = stroke .x1 + dx * baseFrac
216+ var by = stroke .y1 + dy * baseFrac
211217 ctx .beginPath ()
212218 ctx .moveTo (stroke .x1 , stroke .y1 )
213- ctx .lineTo (stroke . x2 , stroke . y2 )
219+ ctx .lineTo (bx, by )
214220 ctx .stroke ()
215- var angle = Math .atan2 (dy, dx)
216- var hs = Math .max (stroke .size * 4 , 12 )
217221 ctx .beginPath ()
218222 ctx .moveTo (stroke .x2 , stroke .y2 )
219- ctx .lineTo (stroke .x2 - hs * Math .cos (angle - Math . PI / 6 ),
220- stroke .y2 - hs * Math .sin (angle - Math . PI / 6 ))
221- ctx .lineTo (stroke .x2 - hs * Math .cos (angle + Math . PI / 6 ),
222- stroke .y2 - hs * Math .sin (angle + Math . PI / 6 ))
223+ ctx .lineTo (stroke .x2 - hs * Math .cos (angle - hw ),
224+ stroke .y2 - hs * Math .sin (angle - hw ))
225+ ctx .lineTo (stroke .x2 - hs * Math .cos (angle + hw ),
226+ stroke .y2 - hs * Math .sin (angle + hw ))
223227 ctx .closePath ()
224228 ctx .fill ()
225229 } else if (stroke .type === " rect" ) {
@@ -362,6 +366,7 @@ Variants {
362366 Shortcut {
363367 sequence: " Escape"
364368 onActivated: {
369+ if (overlayWin .isSaving ) return
365370 overlayWin .strokes = []
366371 _invalidateCache ()
367372 root .hide ()
@@ -485,16 +490,16 @@ Variants {
485490 }
486491 Rectangle {
487492 visible: overlayWin .isPrimary && root .zoomScale > 1.0
488- x: overlayWin .localX + root .regionW - width - 8
489- y: overlayWin .localY + 8
490- width: zoomBadgeRow .implicitWidth + 12
493+ x: overlayWin .localX + root .regionW - width - Style . marginXS
494+ y: overlayWin .localY + Style . marginXS
495+ width: zoomBadgeRow .implicitWidth + Style . marginS * 2
491496 height: 22
492- radius: 6
497+ radius: Style . radiusS
493498 color: Qt .rgba (0 , 0 , 0 , 0.6 )
494499 Row {
495500 id: zoomBadgeRow
496501 anchors .centerIn : parent
497- spacing: 4
502+ spacing: Style . marginXS
498503 NIcon { icon: " zoom-in" ; color: " #ffffff" }
499504 NText {
500505 text: Math .round (root .zoomScale ) + " × — view only"
@@ -769,14 +774,14 @@ Variants {
769774 height: useVertical ? (toolbarContent .implicitHeight + Style .marginS * 2 ) : 52
770775 readonly property real _autoX: useVertical
771776 ? (spaceRight >= 56
772- ? Math .min (overlayWin .localX + root .regionW + 8 , overlayWin .width - width - 8 )
773- : Math .max (8 , overlayWin .localX - width - 8 ))
774- : Math .max (8 , Math .min (overlayWin .localX + (root .regionW - width) / 2 , overlayWin .width - width - 8 ))
777+ ? Math .min (overlayWin .localX + root .regionW + Style . marginS , overlayWin .width - width - Style . marginS )
778+ : Math .max (Style . marginS , overlayWin .localX - width - Style . marginS ))
779+ : Math .max (Style . marginS , Math .min (overlayWin .localX + (root .regionW - width) / 2 , overlayWin .width - width - Style . marginS ))
775780 readonly property real _autoY: useVertical
776- ? Math .max (8 , Math .min (overlayWin .localY + (root .regionH - height) / 2 , overlayWin .height - height - 8 ))
781+ ? Math .max (Style . marginS , Math .min (overlayWin .localY + (root .regionH - height) / 2 , overlayWin .height - height - Style . marginS ))
777782 : (spaceBelow >= 56
778- ? overlayWin .localY + root .regionH + 8
779- : Math .max (8 , overlayWin .localY - height - 8 ))
783+ ? overlayWin .localY + root .regionH + Style . marginS
784+ : Math .max (Style . marginS , overlayWin .localY - height - Style . marginS ))
780785 x: overlayWin ._tbUserX >= 0
781786 ? Math .max (0 , Math .min (overlayWin .width - width, overlayWin ._tbUserX ))
782787 : _autoX
@@ -790,7 +795,7 @@ Variants {
790795 component ToolbarSeparator: Rectangle {
791796 readonly property bool vertical: toolbar .useVertical
792797 width: vertical ? 28 : 1
793- height: vertical ? 1 : 28
798+ height: vertical ? 1 : 28
794799 color: Color .mOnSurfaceVariant
795800 opacity: 0.3
796801 anchors .horizontalCenter : vertical ? parent .horizontalCenter : undefined
@@ -879,7 +884,7 @@ Variants {
879884 property bool primary: false
880885 height: 36
881886 radius: Style .radiusS
882- width: _sbRow .implicitWidth + 32
887+ width: _sbRow .implicitWidth + Style . marginL
883888 color: sbHover .containsMouse
884889 ? (primary ? Color .mPrimary : Color .mSecondary || Color .mPrimary )
885890 : (primary ? Color .mPrimaryContainer || Color .mSurfaceVariant : Color .mSurfaceVariant )
@@ -912,7 +917,7 @@ Variants {
912917 color: dragMA .containsMouse || dragMA .pressed ? Color .mHover : " transparent"
913918 Column {
914919 anchors .centerIn : parent
915- spacing: 3
920+ spacing: Style . marginXS
916921 visible: ! parent .isVertical
917922 Repeater {
918923 model: 3
@@ -921,7 +926,7 @@ Variants {
921926 }
922927 Row {
923928 anchors .centerIn : parent
924- spacing: 3
929+ spacing: Style . marginXS
925930 visible: parent .isVertical
926931 Repeater {
927932 model: 3
@@ -965,9 +970,9 @@ Variants {
965970 " #44AAFF" , " #CC44FF" , " #FF44CC" , " #FFFFFF" , " #000000"
966971 ]
967972 readonly property var sizeDefs: [
968- { size: 2 , label: " S" },
969- { size: 4 , label: " M" },
970- { size: 7 , label: " L" }
973+ { size: 2 , label: root . mainInstance ? . pluginApi ? . tr ( " annotate.sizeS " ) ?? " S" },
974+ { size: 4 , label: root . mainInstance ? . pluginApi ? . tr ( " annotate.sizeM " ) ?? " M" },
975+ { size: 7 , label: root . mainInstance ? . pluginApi ? . tr ( " annotate.sizeL " ) ?? " L" }
971976 ]
972977 function doUndo () {
973978 if (overlayWin .strokes .length > 0 ) {
@@ -1127,14 +1132,14 @@ Variants {
11271132 color: Color .mSurface
11281133 border .color : Style .capsuleBorderColor || " transparent"
11291134 border .width : Style .capsuleBorderWidth || 1
1130- width: toolbar .useVertical ? (popContent .implicitWidth + 12 ) : (popContent .implicitWidth + 16 )
1131- height: toolbar .useVertical ? (popContent .implicitHeight + 16 ) : (popContent .implicitHeight + 12 )
1135+ width: toolbar .useVertical ? (popContent .implicitWidth + Style . marginS ) : (popContent .implicitWidth + Style . marginM )
1136+ height: toolbar .useVertical ? (popContent .implicitHeight + Style . marginM ) : (popContent .implicitHeight + Style . marginS )
11321137 x: toolbar .useVertical
1133- ? (toolbar .spaceRight >= 56 ? toolbar .x + toolbar .width + 6 : toolbar .x - width - 6 )
1134- : Math .max (8 , Math .min (toolbar .x + (toolbar .width - width) / 2 , overlayWin .width - width - 8 ))
1138+ ? (toolbar .spaceRight >= 56 ? toolbar .x + toolbar .width + Style . marginXS : toolbar .x - width - Style . marginXS )
1139+ : Math .max (Style . marginS , Math .min (toolbar .x + (toolbar .width - width) / 2 , overlayWin .width - width - Style . marginS ))
11351140 y: toolbar .useVertical
1136- ? Math .max (8 , Math .min (toolbar .y + (toolbar .height - height) / 2 , overlayWin .height - height - 8 ))
1137- : (toolbar .spaceAbove >= height + 10 ? toolbar .y - height - 6 : toolbar .y + toolbar .height + 6 )
1141+ ? Math .max (Style . marginS , Math .min (toolbar .y + (toolbar .height - height) / 2 , overlayWin .height - height - Style . marginS ))
1142+ : (toolbar .spaceAbove >= height + Style . marginS ? toolbar .y - height - Style . marginXS : toolbar .y + toolbar .height + Style . marginXS )
11381143 Loader {
11391144 id: popContent
11401145 anchors .centerIn : parent
@@ -1168,7 +1173,7 @@ Variants {
11681173 border .color : overlayWin .drawSize === modelData .size ? Color .mPrimary : " transparent"
11691174 border .width : 1
11701175 Row {
1171- anchors .centerIn : parent; spacing: 3
1176+ anchors .centerIn : parent; spacing: Style . marginXS
11721177 Rectangle { width: modelData .size * 2 ; height: modelData .size * 2 ; radius: modelData .size ; color: overlayWin .drawColor ; anchors .verticalCenter : parent .verticalCenter }
11731178 NText { text: modelData .label ; pointSize: Style .fontSizeXS ; color: Color .mOnSurfaceVariant ; anchors .verticalCenter : parent .verticalCenter }
11741179 }
@@ -1209,7 +1214,7 @@ Variants {
12091214 border .color : overlayWin .drawSize === modelData .size ? Color .mPrimary : " transparent"
12101215 border .width : 1
12111216 Row {
1212- anchors .centerIn : parent; spacing: 3
1217+ anchors .centerIn : parent; spacing: Style . marginXS
12131218 Rectangle { width: modelData .size * 2 ; height: modelData .size * 2 ; radius: modelData .size ; color: overlayWin .drawColor ; anchors .verticalCenter : parent .verticalCenter }
12141219 NText { text: modelData .label ; pointSize: Style .fontSizeXS ; color: Color .mOnSurfaceVariant ; anchors .verticalCenter : parent .verticalCenter }
12151220 }
0 commit comments