canvu-react 0.4.58 → 0.4.60
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/chatbot.d.cts +1 -1
- package/dist/chatbot.d.ts +1 -1
- package/dist/native.cjs +51 -3
- package/dist/native.cjs.map +1 -1
- package/dist/native.js +52 -4
- package/dist/native.js.map +1 -1
- package/dist/react.cjs +143 -55
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +143 -55
- package/dist/react.js.map +1 -1
- package/dist/realtime.cjs +31 -18
- package/dist/realtime.cjs.map +1 -1
- package/dist/realtime.d.cts +6 -6
- package/dist/realtime.d.ts +6 -6
- package/dist/realtime.js +31 -18
- package/dist/realtime.js.map +1 -1
- package/dist/{types-BFZpRGyr.d.cts → types--jCoyZIF.d.cts} +35 -4
- package/dist/{types-D2zesNI8.d.ts → types-C_PMen-D.d.ts} +35 -4
- package/package.json +1 -1
package/dist/react.d.cts
CHANGED
|
@@ -4,8 +4,8 @@ import { I as IndexedDbImageStore } from './asset-hydration-F6aM5C7x.cjs';
|
|
|
4
4
|
export { H as HydratedSceneItemsWithAssetsResult, h as hydrateSceneItemsWithAssets } from './asset-hydration-F6aM5C7x.cjs';
|
|
5
5
|
import { V as VectorViewportAssetKind, a as VectorViewportAssetStore } from './asset-store-35ysK28r.cjs';
|
|
6
6
|
export { b as VectorViewportAssetHydrationRequest, c as VectorViewportAssetResolveRequest, d as VectorViewportAssetResolveResult, e as VectorViewportAssetUploadRequest, f as VectorViewportAssetUploadResult } from './asset-store-35ysK28r.cjs';
|
|
7
|
-
import { B as BoardComponentPosition, V as VectorToolDefinition, C as CustomShapePlacementOptions, a as CanvasPlugin, b as VectorSelectionInspector } from './types
|
|
8
|
-
export { c as CanvasPluginComponentProps, d as CanvasPluginContribution, e as CanvasPluginItemsChangeMiddlewareContext, f as CanvasPluginRenderContext, g as CanvuChromeActiveToolStyle, h as CanvuChromeContext, i as CanvuChromeContextValue, j as CanvuChromeSelectionStyleChange, k as CanvuPluginContext, l as CanvuPluginContextValue, m as CanvuPluginViewportSnapshot, P as PlacementPreview, S as SelectModeItemClickDetail, n as SelectModeItemClickResult, o as VectorCanvasSpacePosition, p as
|
|
7
|
+
import { B as BoardComponentPosition, V as VectorToolDefinition, C as CustomShapePlacementOptions, a as CanvasPlugin, b as VectorSelectionInspector } from './types--jCoyZIF.cjs';
|
|
8
|
+
export { c as CanvasPluginComponentProps, d as CanvasPluginContribution, e as CanvasPluginItemsChangeMiddlewareContext, f as CanvasPluginRenderContext, g as CanvuChromeActiveToolStyle, h as CanvuChromeContext, i as CanvuChromeContextValue, j as CanvuChromeSelectionStyleChange, k as CanvuPluginContext, l as CanvuPluginContextValue, m as CanvuPluginViewportSnapshot, P as PlacementPreview, S as SelectModeItemClickDetail, n as SelectModeItemClickResult, o as VectorCanvasSpacePosition, p as VectorItemsChangeInfo, q as VectorItemsChangeMotive, r as VectorSelectionInspectorProps, s as VectorViewport, t as VectorViewportHandle, u as VectorViewportProps, W as WorldPointerDownDetail, v as createCanvuPlugin, w as getBoardPositionStyle, x as useCanvuChromeContext, y as useCanvuDocumentContext, z as useCanvuPluginContext, A as useCanvuPluginContribution, D as useCanvuResolvedTools, E as useCanvuViewportContext } from './types--jCoyZIF.cjs';
|
|
9
9
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
10
10
|
import * as react from 'react';
|
|
11
11
|
import { CSSProperties, ReactNode, ReactElement, SVGProps } from 'react';
|
package/dist/react.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { I as IndexedDbImageStore } from './asset-hydration-BSjiek7Q.js';
|
|
|
4
4
|
export { H as HydratedSceneItemsWithAssetsResult, h as hydrateSceneItemsWithAssets } from './asset-hydration-BSjiek7Q.js';
|
|
5
5
|
import { V as VectorViewportAssetKind, a as VectorViewportAssetStore } from './asset-store-D_FjW_CN.js';
|
|
6
6
|
export { b as VectorViewportAssetHydrationRequest, c as VectorViewportAssetResolveRequest, d as VectorViewportAssetResolveResult, e as VectorViewportAssetUploadRequest, f as VectorViewportAssetUploadResult } from './asset-store-D_FjW_CN.js';
|
|
7
|
-
import { B as BoardComponentPosition, V as VectorToolDefinition, C as CustomShapePlacementOptions, a as CanvasPlugin, b as VectorSelectionInspector } from './types-
|
|
8
|
-
export { c as CanvasPluginComponentProps, d as CanvasPluginContribution, e as CanvasPluginItemsChangeMiddlewareContext, f as CanvasPluginRenderContext, g as CanvuChromeActiveToolStyle, h as CanvuChromeContext, i as CanvuChromeContextValue, j as CanvuChromeSelectionStyleChange, k as CanvuPluginContext, l as CanvuPluginContextValue, m as CanvuPluginViewportSnapshot, P as PlacementPreview, S as SelectModeItemClickDetail, n as SelectModeItemClickResult, o as VectorCanvasSpacePosition, p as
|
|
7
|
+
import { B as BoardComponentPosition, V as VectorToolDefinition, C as CustomShapePlacementOptions, a as CanvasPlugin, b as VectorSelectionInspector } from './types-C_PMen-D.js';
|
|
8
|
+
export { c as CanvasPluginComponentProps, d as CanvasPluginContribution, e as CanvasPluginItemsChangeMiddlewareContext, f as CanvasPluginRenderContext, g as CanvuChromeActiveToolStyle, h as CanvuChromeContext, i as CanvuChromeContextValue, j as CanvuChromeSelectionStyleChange, k as CanvuPluginContext, l as CanvuPluginContextValue, m as CanvuPluginViewportSnapshot, P as PlacementPreview, S as SelectModeItemClickDetail, n as SelectModeItemClickResult, o as VectorCanvasSpacePosition, p as VectorItemsChangeInfo, q as VectorItemsChangeMotive, r as VectorSelectionInspectorProps, s as VectorViewport, t as VectorViewportHandle, u as VectorViewportProps, W as WorldPointerDownDetail, v as createCanvuPlugin, w as getBoardPositionStyle, x as useCanvuChromeContext, y as useCanvuDocumentContext, z as useCanvuPluginContext, A as useCanvuPluginContribution, D as useCanvuResolvedTools, E as useCanvuViewportContext } from './types-C_PMen-D.js';
|
|
9
9
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
10
10
|
import * as react from 'react';
|
|
11
11
|
import { CSSProperties, ReactNode, ReactElement, SVGProps } from 'react';
|
package/dist/react.js
CHANGED
|
@@ -8255,18 +8255,18 @@ var VectorViewport = forwardRef(
|
|
|
8255
8255
|
(middleware) => middleware != null
|
|
8256
8256
|
);
|
|
8257
8257
|
if (!consumerOnItemsChange && middlewares.length === 0) return void 0;
|
|
8258
|
-
const baseNext = (nextItems) => {
|
|
8259
|
-
consumerOnItemsChange?.(nextItems);
|
|
8258
|
+
const baseNext = (nextItems, info) => {
|
|
8259
|
+
consumerOnItemsChange?.(nextItems, info);
|
|
8260
8260
|
};
|
|
8261
8261
|
return middlewares.reduceRight(
|
|
8262
|
-
(next, middleware) => (nextItems) => {
|
|
8262
|
+
(next, middleware) => (nextItems, info) => {
|
|
8263
8263
|
const ctx = {
|
|
8264
8264
|
currentItems: items,
|
|
8265
8265
|
next,
|
|
8266
8266
|
consumerOnItemsChange,
|
|
8267
8267
|
viewportRef: pluginViewportRef
|
|
8268
8268
|
};
|
|
8269
|
-
middleware(nextItems, ctx);
|
|
8269
|
+
middleware(nextItems, ctx, info);
|
|
8270
8270
|
},
|
|
8271
8271
|
baseNext
|
|
8272
8272
|
);
|
|
@@ -8342,7 +8342,7 @@ var VectorViewport = forwardRef(
|
|
|
8342
8342
|
setCanRedo(true);
|
|
8343
8343
|
setCanUndo(stack.length > 0);
|
|
8344
8344
|
isUndoingRef.current = true;
|
|
8345
|
-
onItemsChangeRef.current?.(prev);
|
|
8345
|
+
onItemsChangeRef.current?.(prev, { motive: "undo" });
|
|
8346
8346
|
}, []);
|
|
8347
8347
|
const redo = useCallback(() => {
|
|
8348
8348
|
const stack = redoStackRef.current;
|
|
@@ -8353,7 +8353,7 @@ var VectorViewport = forwardRef(
|
|
|
8353
8353
|
setCanUndo(true);
|
|
8354
8354
|
setCanRedo(stack.length > 0);
|
|
8355
8355
|
isUndoingRef.current = true;
|
|
8356
|
-
onItemsChangeRef.current?.(next);
|
|
8356
|
+
onItemsChangeRef.current?.(next, { motive: "redo" });
|
|
8357
8357
|
}, []);
|
|
8358
8358
|
const [contextMenu, setContextMenu] = useState(null);
|
|
8359
8359
|
const [uncontrolledSel, setUncontrolledSel] = useState([]);
|
|
@@ -8397,12 +8397,12 @@ var VectorViewport = forwardRef(
|
|
|
8397
8397
|
const originalOnItemsChangeRef = useRef(onItemsChange);
|
|
8398
8398
|
originalOnItemsChangeRef.current = onItemsChange;
|
|
8399
8399
|
const changeItems = useCallback(
|
|
8400
|
-
(items2) => {
|
|
8400
|
+
(items2, info) => {
|
|
8401
8401
|
if (!isUndoingRef.current) {
|
|
8402
8402
|
pushUndo();
|
|
8403
8403
|
}
|
|
8404
8404
|
isUndoingRef.current = false;
|
|
8405
|
-
originalOnItemsChangeRef.current?.(items2);
|
|
8405
|
+
originalOnItemsChangeRef.current?.(items2, info);
|
|
8406
8406
|
},
|
|
8407
8407
|
[pushUndo]
|
|
8408
8408
|
);
|
|
@@ -8516,7 +8516,13 @@ var VectorViewport = forwardRef(
|
|
|
8516
8516
|
existing.bounds
|
|
8517
8517
|
)
|
|
8518
8518
|
};
|
|
8519
|
-
change(
|
|
8519
|
+
change(
|
|
8520
|
+
list.map((i) => i.id === item.id ? rebuilt : i),
|
|
8521
|
+
{
|
|
8522
|
+
motive: "asset-hydrate",
|
|
8523
|
+
itemIds: [item.id]
|
|
8524
|
+
}
|
|
8525
|
+
);
|
|
8520
8526
|
}
|
|
8521
8527
|
}
|
|
8522
8528
|
}, 100);
|
|
@@ -8628,7 +8634,8 @@ var VectorViewport = forwardRef(
|
|
|
8628
8634
|
if (item) {
|
|
8629
8635
|
const exists = itemsRef.current.some((it) => it.id === id);
|
|
8630
8636
|
change(
|
|
8631
|
-
exists ? replaceItem(itemsRef.current, id, item) : [...itemsRef.current, item]
|
|
8637
|
+
exists ? replaceItem(itemsRef.current, id, item) : [...itemsRef.current, item],
|
|
8638
|
+
{ motive: "draw", itemIds: [id], toolId: args.tool }
|
|
8632
8639
|
);
|
|
8633
8640
|
patchCurrentStrokeStyle({
|
|
8634
8641
|
stroke: item.stroke ?? DEFAULT_STROKE_STYLE.stroke,
|
|
@@ -9033,7 +9040,10 @@ var VectorViewport = forwardRef(
|
|
|
9033
9040
|
const moved = clones.map(
|
|
9034
9041
|
(it) => moveItemByDelta(it, PASTE_OFFSET_WORLD, PASTE_OFFSET_WORLD)
|
|
9035
9042
|
);
|
|
9036
|
-
change([...itemsRef.current, ...moved]
|
|
9043
|
+
change([...itemsRef.current, ...moved], {
|
|
9044
|
+
motive: "paste",
|
|
9045
|
+
itemIds: moved.map((i) => i.id)
|
|
9046
|
+
});
|
|
9037
9047
|
setEffectiveSelectedIdsRef.current(moved.map((i) => i.id));
|
|
9038
9048
|
}, []);
|
|
9039
9049
|
const duplicateIds = useCallback((ids) => {
|
|
@@ -9045,20 +9055,32 @@ var VectorViewport = forwardRef(
|
|
|
9045
9055
|
const moved = clones.map(
|
|
9046
9056
|
(it) => moveItemByDelta(it, PASTE_OFFSET_WORLD, PASTE_OFFSET_WORLD)
|
|
9047
9057
|
);
|
|
9048
|
-
change([...list, ...moved]
|
|
9058
|
+
change([...list, ...moved], {
|
|
9059
|
+
motive: "duplicate",
|
|
9060
|
+
itemIds: moved.map((i) => i.id)
|
|
9061
|
+
});
|
|
9049
9062
|
setEffectiveSelectedIdsRef.current(moved.map((i) => i.id));
|
|
9050
9063
|
}, []);
|
|
9051
|
-
const deleteIds = useCallback(
|
|
9052
|
-
|
|
9053
|
-
|
|
9054
|
-
|
|
9055
|
-
|
|
9056
|
-
|
|
9057
|
-
|
|
9064
|
+
const deleteIds = useCallback(
|
|
9065
|
+
(ids, motive = "delete") => {
|
|
9066
|
+
const change = onItemsChangeRef.current;
|
|
9067
|
+
if (!change || ids.length === 0) return;
|
|
9068
|
+
const idSet = new Set(ids);
|
|
9069
|
+
change(
|
|
9070
|
+
itemsRef.current.filter((i) => !idSet.has(i.id)),
|
|
9071
|
+
{
|
|
9072
|
+
motive,
|
|
9073
|
+
itemIds: [...ids]
|
|
9074
|
+
}
|
|
9075
|
+
);
|
|
9076
|
+
setEffectiveSelectedIdsRef.current([]);
|
|
9077
|
+
},
|
|
9078
|
+
[]
|
|
9079
|
+
);
|
|
9058
9080
|
const cutIds = useCallback(
|
|
9059
9081
|
(ids) => {
|
|
9060
9082
|
copyIdsToInternalClipboard(ids);
|
|
9061
|
-
deleteIds(ids);
|
|
9083
|
+
deleteIds(ids, "cut");
|
|
9062
9084
|
},
|
|
9063
9085
|
[copyIdsToInternalClipboard, deleteIds]
|
|
9064
9086
|
);
|
|
@@ -9067,7 +9089,8 @@ var VectorViewport = forwardRef(
|
|
|
9067
9089
|
if (!change || ids.length === 0) return;
|
|
9068
9090
|
const idSet = new Set(ids);
|
|
9069
9091
|
change(
|
|
9070
|
-
itemsRef.current.map((it) => idSet.has(it.id) ? { ...it, locked } : it)
|
|
9092
|
+
itemsRef.current.map((it) => idSet.has(it.id) ? { ...it, locked } : it),
|
|
9093
|
+
{ motive: locked ? "lock" : "unlock", itemIds: [...ids] }
|
|
9071
9094
|
);
|
|
9072
9095
|
}, []);
|
|
9073
9096
|
const reorderIds = useCallback(
|
|
@@ -9075,7 +9098,7 @@ var VectorViewport = forwardRef(
|
|
|
9075
9098
|
const change = onItemsChangeRef.current;
|
|
9076
9099
|
if (!change || ids.length === 0) return;
|
|
9077
9100
|
const next = reorderItemsByIds(itemsRef.current, ids, direction);
|
|
9078
|
-
change(next);
|
|
9101
|
+
change(next, { motive: "reorder", itemIds: [...ids] });
|
|
9079
9102
|
setEffectiveSelectedIdsRef.current([...ids]);
|
|
9080
9103
|
},
|
|
9081
9104
|
[]
|
|
@@ -9495,7 +9518,7 @@ var VectorViewport = forwardRef(
|
|
|
9495
9518
|
const out = editingTextIdRef.current === id && next.toolKind === "text" ? applyTextDraftWhileEditing(next, draftTextRef.current) : next;
|
|
9496
9519
|
nextList = replaceItem(nextList, id, out);
|
|
9497
9520
|
}
|
|
9498
|
-
change(nextList);
|
|
9521
|
+
change(nextList, { motive: "style", itemIds: [...ids] });
|
|
9499
9522
|
patchCurrentStrokeStyle(patch);
|
|
9500
9523
|
},
|
|
9501
9524
|
[patchCurrentStrokeStyle]
|
|
@@ -9520,7 +9543,10 @@ var VectorViewport = forwardRef(
|
|
|
9520
9543
|
return;
|
|
9521
9544
|
}
|
|
9522
9545
|
const next = rebuildItemSvg({ ...it, text });
|
|
9523
|
-
change(replaceItem(list, id, next)
|
|
9546
|
+
change(replaceItem(list, id, next), {
|
|
9547
|
+
motive: "text-edit",
|
|
9548
|
+
itemIds: [id]
|
|
9549
|
+
});
|
|
9524
9550
|
editingTextSnapshotRef.current = null;
|
|
9525
9551
|
setEditingTextId(null);
|
|
9526
9552
|
}, []);
|
|
@@ -9532,7 +9558,10 @@ var VectorViewport = forwardRef(
|
|
|
9532
9558
|
const list = itemsRef.current;
|
|
9533
9559
|
const it = list.find((i) => i.id === editId);
|
|
9534
9560
|
if (!it || it.toolKind !== "text") return;
|
|
9535
|
-
change(replaceItem(list, editId, applyTextDraftWhileEditing(it, v))
|
|
9561
|
+
change(replaceItem(list, editId, applyTextDraftWhileEditing(it, v)), {
|
|
9562
|
+
motive: "text-edit",
|
|
9563
|
+
itemIds: [editId]
|
|
9564
|
+
});
|
|
9536
9565
|
}, []);
|
|
9537
9566
|
useEffect(() => {
|
|
9538
9567
|
if (!editingTextId) return;
|
|
@@ -9544,7 +9573,10 @@ var VectorViewport = forwardRef(
|
|
|
9544
9573
|
const id = editingTextIdRef.current;
|
|
9545
9574
|
const snap = editingTextSnapshotRef.current;
|
|
9546
9575
|
if (change && id && snap) {
|
|
9547
|
-
change(replaceItem(itemsRef.current, id, snap)
|
|
9576
|
+
change(replaceItem(itemsRef.current, id, snap), {
|
|
9577
|
+
motive: "text-edit",
|
|
9578
|
+
itemIds: [id]
|
|
9579
|
+
});
|
|
9548
9580
|
}
|
|
9549
9581
|
editingTextSnapshotRef.current = null;
|
|
9550
9582
|
setEditingTextId(null);
|
|
@@ -9591,7 +9623,10 @@ var VectorViewport = forwardRef(
|
|
|
9591
9623
|
onItemsReady: (nextItems) => {
|
|
9592
9624
|
if (nextItems.length === 0) return;
|
|
9593
9625
|
setLoadingSkeletons([]);
|
|
9594
|
-
change([...itemsRef.current, ...nextItems]
|
|
9626
|
+
change([...itemsRef.current, ...nextItems], {
|
|
9627
|
+
motive: "asset-add",
|
|
9628
|
+
itemIds: nextItems.map((item) => item.id)
|
|
9629
|
+
});
|
|
9595
9630
|
setEffectiveSelectedIdsRef.current(nextItems.map((item) => item.id));
|
|
9596
9631
|
}
|
|
9597
9632
|
});
|
|
@@ -9755,7 +9790,13 @@ var VectorViewport = forwardRef(
|
|
|
9755
9790
|
setDraftText(draft);
|
|
9756
9791
|
setEditingTextId(hit.id);
|
|
9757
9792
|
if (change && it && it.toolKind === "text") {
|
|
9758
|
-
change(
|
|
9793
|
+
change(
|
|
9794
|
+
replaceItem(list, hit.id, applyTextDraftWhileEditing(it, draft)),
|
|
9795
|
+
{
|
|
9796
|
+
motive: "text-edit",
|
|
9797
|
+
itemIds: [hit.id]
|
|
9798
|
+
}
|
|
9799
|
+
);
|
|
9759
9800
|
}
|
|
9760
9801
|
}
|
|
9761
9802
|
},
|
|
@@ -10525,7 +10566,7 @@ var VectorViewport = forwardRef(
|
|
|
10525
10566
|
const next = moveItemByDelta(snap, dx, dy);
|
|
10526
10567
|
nextList = replaceItem(nextList, id, next);
|
|
10527
10568
|
}
|
|
10528
|
-
change(nextList);
|
|
10569
|
+
change(nextList, { motive: "move", itemIds: [...st.ids] });
|
|
10529
10570
|
return;
|
|
10530
10571
|
}
|
|
10531
10572
|
if (st.kind === "rotate") {
|
|
@@ -10537,7 +10578,10 @@ var VectorViewport = forwardRef(
|
|
|
10537
10578
|
st.startPointerAngleRad,
|
|
10538
10579
|
angle
|
|
10539
10580
|
);
|
|
10540
|
-
change(replaceItem(list, st.id, next)
|
|
10581
|
+
change(replaceItem(list, st.id, next), {
|
|
10582
|
+
motive: "rotate",
|
|
10583
|
+
itemIds: [st.id]
|
|
10584
|
+
});
|
|
10541
10585
|
return;
|
|
10542
10586
|
}
|
|
10543
10587
|
if (st.kind === "resize") {
|
|
@@ -10545,7 +10589,10 @@ var VectorViewport = forwardRef(
|
|
|
10545
10589
|
x: worldX,
|
|
10546
10590
|
y: worldY
|
|
10547
10591
|
});
|
|
10548
|
-
change(replaceItem(list, st.id, next)
|
|
10592
|
+
change(replaceItem(list, st.id, next), {
|
|
10593
|
+
motive: "resize",
|
|
10594
|
+
itemIds: [st.id]
|
|
10595
|
+
});
|
|
10549
10596
|
return;
|
|
10550
10597
|
}
|
|
10551
10598
|
if (st.kind === "place") {
|
|
@@ -10663,7 +10710,8 @@ var VectorViewport = forwardRef(
|
|
|
10663
10710
|
items: itemsRef.current,
|
|
10664
10711
|
updateItem: (next) => {
|
|
10665
10712
|
onItemsChangeRef.current?.(
|
|
10666
|
-
replaceItem(itemsRef.current, item.id, next)
|
|
10713
|
+
replaceItem(itemsRef.current, item.id, next),
|
|
10714
|
+
{ motive: "custom", itemIds: [item.id] }
|
|
10667
10715
|
);
|
|
10668
10716
|
},
|
|
10669
10717
|
setSelectedIds: (ids) => setEffectiveSelectedIdsRef.current(ids)
|
|
@@ -10737,7 +10785,13 @@ var VectorViewport = forwardRef(
|
|
|
10737
10785
|
const change = onItemsChangeRef.current;
|
|
10738
10786
|
if (change && eraserPreviewIdsRef.current.size > 0) {
|
|
10739
10787
|
const idSet = new Set(eraserPreviewIdsRef.current);
|
|
10740
|
-
change(
|
|
10788
|
+
change(
|
|
10789
|
+
itemsRef.current.filter((i) => !idSet.has(i.id)),
|
|
10790
|
+
{
|
|
10791
|
+
motive: "erase",
|
|
10792
|
+
itemIds: [...idSet]
|
|
10793
|
+
}
|
|
10794
|
+
);
|
|
10741
10795
|
}
|
|
10742
10796
|
eraserPreviewIdsRef.current.clear();
|
|
10743
10797
|
setEraserPreviewIds([]);
|
|
@@ -10780,7 +10834,11 @@ var VectorViewport = forwardRef(
|
|
|
10780
10834
|
bounds: { ...newItem.bounds }
|
|
10781
10835
|
};
|
|
10782
10836
|
const hidden = applyTextDraftWhileEditing(newItem, "");
|
|
10783
|
-
change([...itemsRef.current, hidden]
|
|
10837
|
+
change([...itemsRef.current, hidden], {
|
|
10838
|
+
motive: "text-create",
|
|
10839
|
+
itemIds: [id],
|
|
10840
|
+
toolId: st.tool
|
|
10841
|
+
});
|
|
10784
10842
|
setEffectiveSelectedIdsRef.current([id]);
|
|
10785
10843
|
setEditingTextId(id);
|
|
10786
10844
|
setDraftText("");
|
|
@@ -10835,10 +10893,17 @@ var VectorViewport = forwardRef(
|
|
|
10835
10893
|
...snapB ? { end: snapB.binding } : {}
|
|
10836
10894
|
};
|
|
10837
10895
|
}
|
|
10838
|
-
change(
|
|
10839
|
-
|
|
10840
|
-
|
|
10841
|
-
|
|
10896
|
+
change(
|
|
10897
|
+
[
|
|
10898
|
+
...itemsRef.current,
|
|
10899
|
+
createLineItem(id2, rawArrow, line, "arrow", pen2, arrowBind)
|
|
10900
|
+
],
|
|
10901
|
+
{
|
|
10902
|
+
motive: "place",
|
|
10903
|
+
itemIds: [id2],
|
|
10904
|
+
toolId: st.tool
|
|
10905
|
+
}
|
|
10906
|
+
);
|
|
10842
10907
|
setEffectiveSelectedIdsRef.current([id2]);
|
|
10843
10908
|
return;
|
|
10844
10909
|
}
|
|
@@ -10869,36 +10934,59 @@ var VectorViewport = forwardRef(
|
|
|
10869
10934
|
cpUp.createItem({ id, bounds: br }),
|
|
10870
10935
|
cpUp.toolId
|
|
10871
10936
|
);
|
|
10872
|
-
change(itemsRef.current.concat(item)
|
|
10937
|
+
change(itemsRef.current.concat(item), {
|
|
10938
|
+
motive: "place",
|
|
10939
|
+
itemIds: [id],
|
|
10940
|
+
toolId: st.tool
|
|
10941
|
+
});
|
|
10873
10942
|
if (cpUp.selectAfterCreate !== false) {
|
|
10874
10943
|
setEffectiveSelectedIdsRef.current([id]);
|
|
10875
10944
|
}
|
|
10876
10945
|
return;
|
|
10877
10946
|
}
|
|
10878
10947
|
if (st.tool === "rect") {
|
|
10879
|
-
change([...itemsRef.current, createRectangleItem(id, raw, pen)]
|
|
10948
|
+
change([...itemsRef.current, createRectangleItem(id, raw, pen)], {
|
|
10949
|
+
motive: "place",
|
|
10950
|
+
itemIds: [id],
|
|
10951
|
+
toolId: st.tool
|
|
10952
|
+
});
|
|
10880
10953
|
setEffectiveSelectedIdsRef.current([id]);
|
|
10881
10954
|
} else if (st.tool === "ellipse") {
|
|
10882
|
-
change([...itemsRef.current, createEllipseItem(id, raw, pen)]
|
|
10955
|
+
change([...itemsRef.current, createEllipseItem(id, raw, pen)], {
|
|
10956
|
+
motive: "place",
|
|
10957
|
+
itemIds: [id],
|
|
10958
|
+
toolId: st.tool
|
|
10959
|
+
});
|
|
10883
10960
|
setEffectiveSelectedIdsRef.current([id]);
|
|
10884
10961
|
} else if (st.tool === "architectural-cloud") {
|
|
10885
|
-
change(
|
|
10886
|
-
...itemsRef.current,
|
|
10887
|
-
|
|
10888
|
-
|
|
10962
|
+
change(
|
|
10963
|
+
[...itemsRef.current, createArchitecturalCloudItem(id, raw, pen)],
|
|
10964
|
+
{
|
|
10965
|
+
motive: "place",
|
|
10966
|
+
itemIds: [id],
|
|
10967
|
+
toolId: st.tool
|
|
10968
|
+
}
|
|
10969
|
+
);
|
|
10889
10970
|
setEffectiveSelectedIdsRef.current([id]);
|
|
10890
10971
|
} else if (st.tool === "line" || st.tool === "arrow") {
|
|
10891
10972
|
const line = lineEndpointsToLocal(raw, lineA, lineB);
|
|
10892
|
-
change(
|
|
10893
|
-
|
|
10894
|
-
|
|
10895
|
-
|
|
10896
|
-
|
|
10897
|
-
|
|
10898
|
-
|
|
10899
|
-
|
|
10900
|
-
|
|
10901
|
-
|
|
10973
|
+
change(
|
|
10974
|
+
[
|
|
10975
|
+
...itemsRef.current,
|
|
10976
|
+
createLineItem(
|
|
10977
|
+
id,
|
|
10978
|
+
raw,
|
|
10979
|
+
line,
|
|
10980
|
+
st.tool === "arrow" ? "arrow" : "line",
|
|
10981
|
+
pen
|
|
10982
|
+
)
|
|
10983
|
+
],
|
|
10984
|
+
{
|
|
10985
|
+
motive: "place",
|
|
10986
|
+
itemIds: [id],
|
|
10987
|
+
toolId: st.tool
|
|
10988
|
+
}
|
|
10989
|
+
);
|
|
10902
10990
|
setEffectiveSelectedIdsRef.current([id]);
|
|
10903
10991
|
}
|
|
10904
10992
|
requestAutoResetTool(st.tool);
|