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/native.cjs
CHANGED
|
@@ -5263,6 +5263,22 @@ function resizeItemByHandle(item, start, handle, currentWorld) {
|
|
|
5263
5263
|
return { ...item, x: nb.x, y: nb.y, bounds: nb };
|
|
5264
5264
|
}
|
|
5265
5265
|
|
|
5266
|
+
// src/scene/draw-stroke-memory.ts
|
|
5267
|
+
var DEFAULT_DRAW_STROKE_WIDTH = 10;
|
|
5268
|
+
function resolveDrawStrokeWidthMemory({
|
|
5269
|
+
toolId,
|
|
5270
|
+
previousToolId,
|
|
5271
|
+
currentStrokeWidth,
|
|
5272
|
+
lastDrawStrokeWidth
|
|
5273
|
+
}) {
|
|
5274
|
+
const leavingDrawTool = previousToolId === "draw" && toolId !== "draw";
|
|
5275
|
+
const nextLastDrawStrokeWidth = leavingDrawTool ? currentStrokeWidth : lastDrawStrokeWidth;
|
|
5276
|
+
return {
|
|
5277
|
+
drawStrokeWidth: nextLastDrawStrokeWidth,
|
|
5278
|
+
nextLastDrawStrokeWidth
|
|
5279
|
+
};
|
|
5280
|
+
}
|
|
5281
|
+
|
|
5266
5282
|
// src/native/native-remote-presence-hit-test.ts
|
|
5267
5283
|
var REMOTE_CURSOR_SCREEN_PX2 = 22;
|
|
5268
5284
|
var REMOTE_LABEL_SCREEN_PX2 = 12;
|
|
@@ -5775,6 +5791,7 @@ var NativeVectorViewport = react.forwardRef(function NativeVectorViewport2({
|
|
|
5775
5791
|
const markerStrokeStyleRef = react.useRef({ ...MARKER_TOOL_STYLE });
|
|
5776
5792
|
const styleBeforeMarkerRef = react.useRef({ ...DEFAULT_STROKE_STYLE });
|
|
5777
5793
|
const lastToolIdRef = react.useRef(toolId);
|
|
5794
|
+
const lastDrawStrokeWidthRef = react.useRef(DEFAULT_DRAW_STROKE_WIDTH);
|
|
5778
5795
|
const [strokeStyleState, setStrokeStyleState] = react.useState({
|
|
5779
5796
|
...DEFAULT_STROKE_STYLE
|
|
5780
5797
|
});
|
|
@@ -5805,6 +5822,13 @@ var NativeVectorViewport = react.forwardRef(function NativeVectorViewport2({
|
|
|
5805
5822
|
react.useEffect(() => {
|
|
5806
5823
|
const previousToolId = lastToolIdRef.current;
|
|
5807
5824
|
const current = strokeStyleRef.current;
|
|
5825
|
+
const { drawStrokeWidth, nextLastDrawStrokeWidth } = resolveDrawStrokeWidthMemory({
|
|
5826
|
+
toolId,
|
|
5827
|
+
previousToolId,
|
|
5828
|
+
currentStrokeWidth: current.strokeWidth,
|
|
5829
|
+
lastDrawStrokeWidth: lastDrawStrokeWidthRef.current
|
|
5830
|
+
});
|
|
5831
|
+
lastDrawStrokeWidthRef.current = nextLastDrawStrokeWidth;
|
|
5808
5832
|
let next = current;
|
|
5809
5833
|
if (toolId === "marker") {
|
|
5810
5834
|
if (previousToolId !== "marker") {
|
|
@@ -5816,13 +5840,13 @@ var NativeVectorViewport = react.forwardRef(function NativeVectorViewport2({
|
|
|
5816
5840
|
const restored = styleBeforeMarkerRef.current;
|
|
5817
5841
|
next = {
|
|
5818
5842
|
stroke: restored.stroke,
|
|
5819
|
-
strokeWidth: toolId === "draw"
|
|
5843
|
+
strokeWidth: toolId === "draw" ? drawStrokeWidth : restored.strokeWidth,
|
|
5820
5844
|
...restored.strokeDash != null ? { strokeDash: restored.strokeDash } : {}
|
|
5821
5845
|
};
|
|
5822
5846
|
} else if (toolId === "draw") {
|
|
5823
5847
|
next = {
|
|
5824
5848
|
...current,
|
|
5825
|
-
strokeWidth:
|
|
5849
|
+
strokeWidth: drawStrokeWidth
|
|
5826
5850
|
};
|
|
5827
5851
|
} else if (isDefaultMarkerToolStyle(current)) {
|
|
5828
5852
|
next = {
|