canvu-react 0.4.78 → 0.4.80
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/dist/realtime.cjs +33 -0
- package/dist/realtime.cjs.map +1 -1
- package/dist/realtime.js +33 -0
- package/dist/realtime.js.map +1 -1
- package/dist/realtimeNative.cjs +33 -0
- package/dist/realtimeNative.cjs.map +1 -1
- package/dist/realtimeNative.js +33 -0
- package/dist/realtimeNative.js.map +1 -1
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -7774,6 +7774,22 @@ var SvgVectorRenderer = class {
|
|
|
7774
7774
|
}
|
|
7775
7775
|
};
|
|
7776
7776
|
|
|
7777
|
+
// src/scene/draw-stroke-memory.ts
|
|
7778
|
+
var DEFAULT_DRAW_STROKE_WIDTH = 10;
|
|
7779
|
+
function resolveDrawStrokeWidthMemory({
|
|
7780
|
+
toolId,
|
|
7781
|
+
previousToolId,
|
|
7782
|
+
currentStrokeWidth,
|
|
7783
|
+
lastDrawStrokeWidth
|
|
7784
|
+
}) {
|
|
7785
|
+
const leavingDrawTool = previousToolId === "draw" && toolId !== "draw";
|
|
7786
|
+
const nextLastDrawStrokeWidth = leavingDrawTool ? currentStrokeWidth : lastDrawStrokeWidth;
|
|
7787
|
+
return {
|
|
7788
|
+
drawStrokeWidth: nextLastDrawStrokeWidth,
|
|
7789
|
+
nextLastDrawStrokeWidth
|
|
7790
|
+
};
|
|
7791
|
+
}
|
|
7792
|
+
|
|
7777
7793
|
// src/react/VectorViewport.tsx
|
|
7778
7794
|
init_link_item();
|
|
7779
7795
|
|
|
@@ -9653,6 +9669,8 @@ var VectorViewport = forwardRef(
|
|
|
9653
9669
|
...DEFAULT_STROKE_STYLE,
|
|
9654
9670
|
textFontSize: DEFAULT_TEXT_TOOL_FONT_SIZE
|
|
9655
9671
|
});
|
|
9672
|
+
const lastDrawStrokeWidthRef = useRef(DEFAULT_DRAW_STROKE_WIDTH);
|
|
9673
|
+
const previousToolIdRef = useRef(null);
|
|
9656
9674
|
const [strokeStyleState, setStrokeStyleState] = useState({
|
|
9657
9675
|
...DEFAULT_STROKE_STYLE,
|
|
9658
9676
|
textFontSize: DEFAULT_TEXT_TOOL_FONT_SIZE
|
|
@@ -10725,6 +10743,14 @@ var VectorViewport = forwardRef(
|
|
|
10725
10743
|
}, [renderFrame]);
|
|
10726
10744
|
useEffect(() => {
|
|
10727
10745
|
const current = strokeStyleRef.current;
|
|
10746
|
+
const { drawStrokeWidth, nextLastDrawStrokeWidth } = resolveDrawStrokeWidthMemory({
|
|
10747
|
+
toolId,
|
|
10748
|
+
previousToolId: previousToolIdRef.current,
|
|
10749
|
+
currentStrokeWidth: current.strokeWidth,
|
|
10750
|
+
lastDrawStrokeWidth: lastDrawStrokeWidthRef.current
|
|
10751
|
+
});
|
|
10752
|
+
lastDrawStrokeWidthRef.current = nextLastDrawStrokeWidth;
|
|
10753
|
+
previousToolIdRef.current = toolId;
|
|
10728
10754
|
if (toolId === "marker") {
|
|
10729
10755
|
setCurrentStrokeStyle({
|
|
10730
10756
|
...current,
|
|
@@ -10735,7 +10761,7 @@ var VectorViewport = forwardRef(
|
|
|
10735
10761
|
if (isDefaultMarkerToolStyle(current)) {
|
|
10736
10762
|
setCurrentStrokeStyle({
|
|
10737
10763
|
stroke: DEFAULT_STROKE_STYLE.stroke,
|
|
10738
|
-
strokeWidth: toolId === "draw" ?
|
|
10764
|
+
strokeWidth: toolId === "draw" ? drawStrokeWidth : DEFAULT_STROKE_STYLE.strokeWidth,
|
|
10739
10765
|
strokeDash: current.strokeDash,
|
|
10740
10766
|
textFontSize: current.textFontSize
|
|
10741
10767
|
});
|
|
@@ -10743,7 +10769,7 @@ var VectorViewport = forwardRef(
|
|
|
10743
10769
|
}
|
|
10744
10770
|
setCurrentStrokeStyle({
|
|
10745
10771
|
stroke: current.stroke,
|
|
10746
|
-
strokeWidth: toolId === "draw" ?
|
|
10772
|
+
strokeWidth: toolId === "draw" ? drawStrokeWidth : current.strokeWidth,
|
|
10747
10773
|
strokeDash: current.strokeDash,
|
|
10748
10774
|
textFontSize: current.textFontSize
|
|
10749
10775
|
});
|