canvu-react 0.4.78 → 0.4.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/native.cjs +26 -2
- package/dist/native.cjs.map +1 -1
- package/dist/native.js +26 -2
- package/dist/native.js.map +1 -1
- package/dist/react.cjs +28 -2
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +28 -2
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/react.cjs
CHANGED
|
@@ -7781,6 +7781,22 @@ var SvgVectorRenderer = class {
|
|
|
7781
7781
|
}
|
|
7782
7782
|
};
|
|
7783
7783
|
|
|
7784
|
+
// src/scene/draw-stroke-memory.ts
|
|
7785
|
+
var DEFAULT_DRAW_STROKE_WIDTH = 10;
|
|
7786
|
+
function resolveDrawStrokeWidthMemory({
|
|
7787
|
+
toolId,
|
|
7788
|
+
previousToolId,
|
|
7789
|
+
currentStrokeWidth,
|
|
7790
|
+
lastDrawStrokeWidth
|
|
7791
|
+
}) {
|
|
7792
|
+
const leavingDrawTool = previousToolId === "draw" && toolId !== "draw";
|
|
7793
|
+
const nextLastDrawStrokeWidth = leavingDrawTool ? currentStrokeWidth : lastDrawStrokeWidth;
|
|
7794
|
+
return {
|
|
7795
|
+
drawStrokeWidth: nextLastDrawStrokeWidth,
|
|
7796
|
+
nextLastDrawStrokeWidth
|
|
7797
|
+
};
|
|
7798
|
+
}
|
|
7799
|
+
|
|
7784
7800
|
// src/react/VectorViewport.tsx
|
|
7785
7801
|
init_link_item();
|
|
7786
7802
|
|
|
@@ -9660,6 +9676,8 @@ var VectorViewport = react.forwardRef(
|
|
|
9660
9676
|
...DEFAULT_STROKE_STYLE,
|
|
9661
9677
|
textFontSize: DEFAULT_TEXT_TOOL_FONT_SIZE
|
|
9662
9678
|
});
|
|
9679
|
+
const lastDrawStrokeWidthRef = react.useRef(DEFAULT_DRAW_STROKE_WIDTH);
|
|
9680
|
+
const previousToolIdRef = react.useRef(null);
|
|
9663
9681
|
const [strokeStyleState, setStrokeStyleState] = react.useState({
|
|
9664
9682
|
...DEFAULT_STROKE_STYLE,
|
|
9665
9683
|
textFontSize: DEFAULT_TEXT_TOOL_FONT_SIZE
|
|
@@ -10732,6 +10750,14 @@ var VectorViewport = react.forwardRef(
|
|
|
10732
10750
|
}, [renderFrame]);
|
|
10733
10751
|
react.useEffect(() => {
|
|
10734
10752
|
const current = strokeStyleRef.current;
|
|
10753
|
+
const { drawStrokeWidth, nextLastDrawStrokeWidth } = resolveDrawStrokeWidthMemory({
|
|
10754
|
+
toolId,
|
|
10755
|
+
previousToolId: previousToolIdRef.current,
|
|
10756
|
+
currentStrokeWidth: current.strokeWidth,
|
|
10757
|
+
lastDrawStrokeWidth: lastDrawStrokeWidthRef.current
|
|
10758
|
+
});
|
|
10759
|
+
lastDrawStrokeWidthRef.current = nextLastDrawStrokeWidth;
|
|
10760
|
+
previousToolIdRef.current = toolId;
|
|
10735
10761
|
if (toolId === "marker") {
|
|
10736
10762
|
setCurrentStrokeStyle({
|
|
10737
10763
|
...current,
|
|
@@ -10742,7 +10768,7 @@ var VectorViewport = react.forwardRef(
|
|
|
10742
10768
|
if (isDefaultMarkerToolStyle(current)) {
|
|
10743
10769
|
setCurrentStrokeStyle({
|
|
10744
10770
|
stroke: DEFAULT_STROKE_STYLE.stroke,
|
|
10745
|
-
strokeWidth: toolId === "draw" ?
|
|
10771
|
+
strokeWidth: toolId === "draw" ? drawStrokeWidth : DEFAULT_STROKE_STYLE.strokeWidth,
|
|
10746
10772
|
strokeDash: current.strokeDash,
|
|
10747
10773
|
textFontSize: current.textFontSize
|
|
10748
10774
|
});
|
|
@@ -10750,7 +10776,7 @@ var VectorViewport = react.forwardRef(
|
|
|
10750
10776
|
}
|
|
10751
10777
|
setCurrentStrokeStyle({
|
|
10752
10778
|
stroke: current.stroke,
|
|
10753
|
-
strokeWidth: toolId === "draw" ?
|
|
10779
|
+
strokeWidth: toolId === "draw" ? drawStrokeWidth : current.strokeWidth,
|
|
10754
10780
|
strokeDash: current.strokeDash,
|
|
10755
10781
|
textFontSize: current.textFontSize
|
|
10756
10782
|
});
|