@inditextech/weave-sdk 3.3.1 → 3.4.0-SNAPSHOT.85.1
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/sdk.js +520 -167
- package/dist/sdk.node.js +520 -167
- package/dist/types.d.ts +168 -50
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +520 -167
- package/dist/types.js.map +1 -1
- package/package.json +2 -3
package/dist/sdk.node.js
CHANGED
|
@@ -15083,6 +15083,11 @@ var WeaveStore = class {
|
|
|
15083
15083
|
getDocument() {
|
|
15084
15084
|
return this.document;
|
|
15085
15085
|
}
|
|
15086
|
+
restartDocument() {
|
|
15087
|
+
this.latestState = { weave: {} };
|
|
15088
|
+
this.state = syncedStore({ weave: {} });
|
|
15089
|
+
this.document = getYjsDoc(this.state);
|
|
15090
|
+
}
|
|
15086
15091
|
loadDocument(roomData) {
|
|
15087
15092
|
yjs_default.applyUpdate(this.document, roomData);
|
|
15088
15093
|
}
|
|
@@ -17958,6 +17963,15 @@ var WeaveContextMenuPlugin = class extends WeavePlugin {
|
|
|
17958
17963
|
initLayer = void 0;
|
|
17959
17964
|
constructor(params) {
|
|
17960
17965
|
super();
|
|
17966
|
+
const { config } = params ?? {};
|
|
17967
|
+
this.config = {
|
|
17968
|
+
xOffset: WEAVE_CONTEXT_MENU_X_OFFSET_DEFAULT,
|
|
17969
|
+
yOffset: WEAVE_CONTEXT_MENU_Y_OFFSET_DEFAULT,
|
|
17970
|
+
...config
|
|
17971
|
+
};
|
|
17972
|
+
this.initialize();
|
|
17973
|
+
}
|
|
17974
|
+
initialize() {
|
|
17961
17975
|
this.timer = null;
|
|
17962
17976
|
this.tapHold = false;
|
|
17963
17977
|
this.contextMenuVisible = false;
|
|
@@ -17967,12 +17981,6 @@ var WeaveContextMenuPlugin = class extends WeavePlugin {
|
|
|
17967
17981
|
time: 0
|
|
17968
17982
|
};
|
|
17969
17983
|
this.tapHoldTimeout = WEAVE_CONTEXT_MENU_TAP_HOLD_TIMEOUT;
|
|
17970
|
-
const { config } = params ?? {};
|
|
17971
|
-
this.config = {
|
|
17972
|
-
xOffset: WEAVE_CONTEXT_MENU_X_OFFSET_DEFAULT,
|
|
17973
|
-
yOffset: WEAVE_CONTEXT_MENU_Y_OFFSET_DEFAULT,
|
|
17974
|
-
...config
|
|
17975
|
-
};
|
|
17976
17984
|
this.pointers = {};
|
|
17977
17985
|
}
|
|
17978
17986
|
getName() {
|
|
@@ -18616,7 +18624,10 @@ const DEFAULT_ADD_NODE_OPTIONS = { emitUserChangeEvent: false };
|
|
|
18616
18624
|
const DEFAULT_UPDATE_NODE_OPTIONS = { emitUserChangeEvent: false };
|
|
18617
18625
|
const DEFAULT_REMOVE_NODE_OPTIONS = { emitUserChangeEvent: false };
|
|
18618
18626
|
const DEFAULT_MOVE_NODE_OPTIONS = { emitUserChangeEvent: false };
|
|
18619
|
-
const WEAVE_DEFAULT_CONFIG = {
|
|
18627
|
+
const WEAVE_DEFAULT_CONFIG = {
|
|
18628
|
+
behaviors: { axisLockThreshold: 5 },
|
|
18629
|
+
performance: { upscale: { enabled: false } }
|
|
18630
|
+
};
|
|
18620
18631
|
|
|
18621
18632
|
//#endregion
|
|
18622
18633
|
//#region src/plugins/users-presence/constants.ts
|
|
@@ -18645,6 +18656,9 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
18645
18656
|
constructor(params) {
|
|
18646
18657
|
super();
|
|
18647
18658
|
this.config = mergeExceptArrays(WEAVE_NODES_SELECTION_DEFAULT_CONFIG, params?.config ?? {});
|
|
18659
|
+
this.initialize();
|
|
18660
|
+
}
|
|
18661
|
+
initialize() {
|
|
18648
18662
|
this.defaultEnabledAnchors = this.config.selection?.enabledAnchors ?? [
|
|
18649
18663
|
"top-left",
|
|
18650
18664
|
"top-center",
|
|
@@ -18808,7 +18822,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
18808
18822
|
nodeHovered = void 0;
|
|
18809
18823
|
}
|
|
18810
18824
|
this.instance.getStage().handleMouseover?.();
|
|
18811
|
-
});
|
|
18825
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
18812
18826
|
const handleTransform = (e) => {
|
|
18813
18827
|
const moved = this.checkMoved(e);
|
|
18814
18828
|
if (moved) this.getContextMenuPlugin()?.cancelLongPressTimer();
|
|
@@ -19223,11 +19237,11 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
19223
19237
|
});
|
|
19224
19238
|
return;
|
|
19225
19239
|
}
|
|
19226
|
-
});
|
|
19240
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
19227
19241
|
stage.container().addEventListener("keyup", (e) => {
|
|
19228
19242
|
if (!(e.ctrlKey || e.metaKey)) this.isCtrlMetaPressed = false;
|
|
19229
19243
|
if (e.code === "Space") this.isSpaceKeyPressed = false;
|
|
19230
|
-
});
|
|
19244
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
19231
19245
|
stage.on("pointerdown", (e) => {
|
|
19232
19246
|
this.setTapStart(e);
|
|
19233
19247
|
this.handledClickOrTap = false;
|
|
@@ -19434,7 +19448,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
19434
19448
|
if (existNode) newSelectedNodes.push(existNode);
|
|
19435
19449
|
}
|
|
19436
19450
|
this.tr.nodes([...newSelectedNodes]);
|
|
19437
|
-
this.tr.forceUpdate();
|
|
19451
|
+
if (newSelectedNodes.length > 0) this.tr.forceUpdate();
|
|
19438
19452
|
this.triggerSelectedNodesEvent();
|
|
19439
19453
|
}
|
|
19440
19454
|
getSelectionPlugin() {
|
|
@@ -19687,6 +19701,9 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
|
|
|
19687
19701
|
super();
|
|
19688
19702
|
this.getImageBase64 = params.getImageBase64;
|
|
19689
19703
|
this.config = mergeExceptArrays(WEAVE_COPY_PASTE_CONFIG_DEFAULT, params?.config);
|
|
19704
|
+
this.initialize();
|
|
19705
|
+
}
|
|
19706
|
+
initialize() {
|
|
19690
19707
|
this.actualInternalPaddingX = 0;
|
|
19691
19708
|
this.actualInternalPaddingY = 0;
|
|
19692
19709
|
this.lastInternalPasteSnapshot = "";
|
|
@@ -19792,7 +19809,7 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
|
|
|
19792
19809
|
this.focusPasteCatcher();
|
|
19793
19810
|
if (!this.enabled) return;
|
|
19794
19811
|
}
|
|
19795
|
-
});
|
|
19812
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
19796
19813
|
if (catcher) catcher.addEventListener("paste", async (e) => {
|
|
19797
19814
|
e.preventDefault();
|
|
19798
19815
|
let items = void 0;
|
|
@@ -19811,7 +19828,7 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
|
|
|
19811
19828
|
return;
|
|
19812
19829
|
}
|
|
19813
19830
|
this.sendExternalPasteEvent(void 0, items);
|
|
19814
|
-
});
|
|
19831
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
19815
19832
|
}
|
|
19816
19833
|
sendExternalPasteEvent(dataList, items) {
|
|
19817
19834
|
const stage = this.instance.getStage();
|
|
@@ -21966,11 +21983,34 @@ var WeaveRegisterManager = class {
|
|
|
21966
21983
|
}
|
|
21967
21984
|
}
|
|
21968
21985
|
}
|
|
21986
|
+
resetNodesHandlers() {
|
|
21987
|
+
for (const nodeHandlerId of Object.keys(this.nodesHandlers)) {
|
|
21988
|
+
const nodeHandler = this.nodesHandlers[nodeHandlerId];
|
|
21989
|
+
nodeHandler.initialize?.();
|
|
21990
|
+
}
|
|
21991
|
+
}
|
|
21992
|
+
resetActionsHandlers() {
|
|
21993
|
+
for (const actionHandlerId of Object.keys(this.actionsHandlers)) {
|
|
21994
|
+
const actionHandler = this.actionsHandlers[actionHandlerId];
|
|
21995
|
+
actionHandler.initialize?.();
|
|
21996
|
+
}
|
|
21997
|
+
}
|
|
21998
|
+
resetPlugins() {
|
|
21999
|
+
for (const pluginId of Object.keys(this.plugins)) {
|
|
22000
|
+
const plugin = this.plugins[pluginId];
|
|
22001
|
+
plugin.initialize?.();
|
|
22002
|
+
}
|
|
22003
|
+
}
|
|
22004
|
+
reset() {
|
|
22005
|
+
this.resetNodesHandlers();
|
|
22006
|
+
this.resetActionsHandlers();
|
|
22007
|
+
this.resetPlugins();
|
|
22008
|
+
}
|
|
21969
22009
|
};
|
|
21970
22010
|
|
|
21971
22011
|
//#endregion
|
|
21972
22012
|
//#region package.json
|
|
21973
|
-
var version = "3.
|
|
22013
|
+
var version = "3.4.0-SNAPSHOT.85.1";
|
|
21974
22014
|
|
|
21975
22015
|
//#endregion
|
|
21976
22016
|
//#region src/managers/setup.ts
|
|
@@ -22087,6 +22127,11 @@ var WeaveStageManager = class {
|
|
|
22087
22127
|
initialZIndex: void 0
|
|
22088
22128
|
};
|
|
22089
22129
|
const stage = new Konva.Stage({ ...props });
|
|
22130
|
+
if (!this.instance.isServerSide()) {
|
|
22131
|
+
const containerParent = stage.container().parentNode;
|
|
22132
|
+
stage.width(containerParent.clientWidth);
|
|
22133
|
+
stage.height(containerParent.clientHeight);
|
|
22134
|
+
}
|
|
22090
22135
|
const realContainer = stage.container();
|
|
22091
22136
|
if (realContainer !== void 0 && realContainer.style?.position !== "relative") realContainer.style.position = "relative";
|
|
22092
22137
|
this.setStage(stage);
|
|
@@ -22395,6 +22440,91 @@ var WeaveExportManager = class {
|
|
|
22395
22440
|
height: imageHeight * pixelRatio
|
|
22396
22441
|
};
|
|
22397
22442
|
}
|
|
22443
|
+
async exportAreaServerSide(area, options) {
|
|
22444
|
+
const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
|
|
22445
|
+
this.getNodesSelectionPlugin()?.disable();
|
|
22446
|
+
this.getNodesDistanceSnappingPlugin()?.disable();
|
|
22447
|
+
this.getNodesEdgeSnappingPlugin()?.disable();
|
|
22448
|
+
this.getStageGridPlugin()?.disable();
|
|
22449
|
+
const stage = this.instance.getStage();
|
|
22450
|
+
const mainLayer = this.instance.getMainLayer();
|
|
22451
|
+
if (!mainLayer) throw new Error("Main layer not found");
|
|
22452
|
+
const originalPosition = {
|
|
22453
|
+
x: stage.x(),
|
|
22454
|
+
y: stage.y()
|
|
22455
|
+
};
|
|
22456
|
+
const originalScale = {
|
|
22457
|
+
x: stage.scaleX(),
|
|
22458
|
+
y: stage.scaleY()
|
|
22459
|
+
};
|
|
22460
|
+
stage.scale({
|
|
22461
|
+
x: 1,
|
|
22462
|
+
y: 1
|
|
22463
|
+
});
|
|
22464
|
+
const bounds = area;
|
|
22465
|
+
const scaleX = stage.scaleX();
|
|
22466
|
+
const scaleY = stage.scaleY();
|
|
22467
|
+
const unscaledBounds = {
|
|
22468
|
+
x: bounds.x / scaleX,
|
|
22469
|
+
y: bounds.y / scaleY,
|
|
22470
|
+
width: bounds.width / scaleX,
|
|
22471
|
+
height: bounds.height / scaleY
|
|
22472
|
+
};
|
|
22473
|
+
const background = new Konva.Rect({
|
|
22474
|
+
x: unscaledBounds.x - padding,
|
|
22475
|
+
y: unscaledBounds.y - padding,
|
|
22476
|
+
width: unscaledBounds.width + 2 * padding,
|
|
22477
|
+
height: unscaledBounds.height + 2 * padding,
|
|
22478
|
+
strokeWidth: 0,
|
|
22479
|
+
fill: backgroundColor
|
|
22480
|
+
});
|
|
22481
|
+
mainLayer.add(background);
|
|
22482
|
+
background.moveToBottom();
|
|
22483
|
+
const backgroundRect = background.getClientRect({ relativeTo: stage });
|
|
22484
|
+
const composites = [];
|
|
22485
|
+
const imageWidth = Math.round(backgroundRect.width);
|
|
22486
|
+
const imageHeight = Math.round(backgroundRect.height);
|
|
22487
|
+
const maxRenderSize = 1920;
|
|
22488
|
+
const cols = Math.ceil(imageWidth / maxRenderSize);
|
|
22489
|
+
const rows = Math.ceil(imageHeight / maxRenderSize);
|
|
22490
|
+
const tileWidth = Math.floor(imageWidth / cols);
|
|
22491
|
+
const tileHeight = Math.floor(imageHeight / rows);
|
|
22492
|
+
for (let y = 0; y < imageHeight; y += tileHeight) for (let x = 0; x < imageWidth; x += tileWidth) {
|
|
22493
|
+
const width = Math.min(tileWidth, imageWidth - x);
|
|
22494
|
+
const height = Math.min(tileHeight, imageHeight - y);
|
|
22495
|
+
const canvas = await mainLayer.toCanvas({
|
|
22496
|
+
x: Math.round(backgroundRect.x) + x,
|
|
22497
|
+
y: Math.round(backgroundRect.y) + y,
|
|
22498
|
+
width,
|
|
22499
|
+
height,
|
|
22500
|
+
mimeType: format,
|
|
22501
|
+
pixelRatio,
|
|
22502
|
+
quality: options.quality ?? 1
|
|
22503
|
+
});
|
|
22504
|
+
let buffer = null;
|
|
22505
|
+
if (globalThis._weave_serverSideBackend === WEAVE_KONVA_BACKEND.CANVAS) buffer = canvas.toBuffer();
|
|
22506
|
+
if (globalThis._weave_serverSideBackend === WEAVE_KONVA_BACKEND.SKIA) buffer = await canvas.toBuffer();
|
|
22507
|
+
if (!buffer) throw new Error("Failed to generate image buffer");
|
|
22508
|
+
composites.push({
|
|
22509
|
+
top: y * pixelRatio,
|
|
22510
|
+
left: x * pixelRatio,
|
|
22511
|
+
input: buffer
|
|
22512
|
+
});
|
|
22513
|
+
}
|
|
22514
|
+
background.destroy();
|
|
22515
|
+
stage.position(originalPosition);
|
|
22516
|
+
stage.scale(originalScale);
|
|
22517
|
+
stage.batchDraw();
|
|
22518
|
+
this.getNodesSelectionPlugin()?.enable();
|
|
22519
|
+
this.getNodesDistanceSnappingPlugin()?.enable();
|
|
22520
|
+
this.getNodesEdgeSnappingPlugin()?.enable();
|
|
22521
|
+
this.getStageGridPlugin()?.enable();
|
|
22522
|
+
return {
|
|
22523
|
+
composites,
|
|
22524
|
+
width: imageWidth * pixelRatio,
|
|
22525
|
+
height: imageHeight * pixelRatio
|
|
22526
|
+
};
|
|
22527
|
+
}
|
|
22398
22528
|
imageToBase64(img, mimeType) {
|
|
22399
22529
|
if (img.naturalWidth === 0 && img.naturalHeight === 0) throw new Error("Image has no content");
|
|
22400
22530
|
const canvas = document.createElement("canvas");
|
|
@@ -22674,7 +22804,12 @@ var WeaveAsyncManager = class {
|
|
|
22674
22804
|
this.instance.emitEvent("onAsyncElementChange");
|
|
22675
22805
|
}, new Map());
|
|
22676
22806
|
}
|
|
22807
|
+
reset() {
|
|
22808
|
+
this.asyncElements.clear();
|
|
22809
|
+
this.asyncElementsLoadedEventEmitted = false;
|
|
22810
|
+
}
|
|
22677
22811
|
checkForAsyncElements(elements) {
|
|
22812
|
+
this.instance.emitEvent("onAsyncElementsIdle");
|
|
22678
22813
|
const amountAsyncResourcesExtracted = this.extractAsyncResources(elements);
|
|
22679
22814
|
if (amountAsyncResourcesExtracted === 0 && !this.asyncElementsLoadedEventEmitted) {
|
|
22680
22815
|
this.instance.emitEvent("onAsyncElementsLoaded");
|
|
@@ -22727,7 +22862,7 @@ var WeaveAsyncManager = class {
|
|
|
22727
22862
|
status: WEAVE_ASYNC_STATUS.LOADING
|
|
22728
22863
|
};
|
|
22729
22864
|
this.asyncElements.set(nodeId, element);
|
|
22730
|
-
this.instance.emitEvent("onAsyncElementsLoading", {
|
|
22865
|
+
if (!this.asyncElementsLoadedEventEmitted) this.instance.emitEvent("onAsyncElementsLoading", {
|
|
22731
22866
|
loaded: this.getAmountAsyncElementsLoaded(),
|
|
22732
22867
|
total: this.getAmountAsyncElements()
|
|
22733
22868
|
});
|
|
@@ -22740,11 +22875,11 @@ var WeaveAsyncManager = class {
|
|
|
22740
22875
|
status: WEAVE_ASYNC_STATUS.LOADED
|
|
22741
22876
|
};
|
|
22742
22877
|
this.asyncElements.set(nodeId, element);
|
|
22743
|
-
this.instance.emitEvent("onAsyncElementsLoading", {
|
|
22744
|
-
loaded: this.getAmountAsyncElementsLoaded(),
|
|
22745
|
-
total: this.getAmountAsyncElements()
|
|
22746
|
-
});
|
|
22747
22878
|
if (!this.asyncElementsLoadedEventEmitted) {
|
|
22879
|
+
this.instance.emitEvent("onAsyncElementsLoading", {
|
|
22880
|
+
loaded: this.getAmountAsyncElementsLoaded(),
|
|
22881
|
+
total: this.getAmountAsyncElements()
|
|
22882
|
+
});
|
|
22748
22883
|
const allLoaded = this.asyncElementsLoaded();
|
|
22749
22884
|
if (allLoaded) {
|
|
22750
22885
|
this.instance.emitEvent("onAsyncElementsLoaded");
|
|
@@ -22869,6 +23004,7 @@ var Weave = class {
|
|
|
22869
23004
|
constructor(weaveConfig, stageConfig) {
|
|
22870
23005
|
globalThis._weave_isServerSide = false;
|
|
22871
23006
|
if (typeof window === "undefined") globalThis._weave_isServerSide = true;
|
|
23007
|
+
this.eventsController = void 0;
|
|
22872
23008
|
this.emitter = new Emittery();
|
|
22873
23009
|
Konva.showWarnings = false;
|
|
22874
23010
|
this.id = v4_default();
|
|
@@ -22914,6 +23050,7 @@ var Weave = class {
|
|
|
22914
23050
|
this.initialized = true;
|
|
22915
23051
|
this.status = WEAVE_INSTANCE_STATUS.RUNNING;
|
|
22916
23052
|
this.emitEvent("onInstanceStatus", this.status);
|
|
23053
|
+
this.emitEvent("onRender");
|
|
22917
23054
|
});
|
|
22918
23055
|
}
|
|
22919
23056
|
setStatus(status) {
|
|
@@ -22938,6 +23075,7 @@ var Weave = class {
|
|
|
22938
23075
|
async start() {
|
|
22939
23076
|
this.moduleLogger.info("Start instance");
|
|
22940
23077
|
if (!this.isServerSide()) {
|
|
23078
|
+
this.eventsController = new AbortController();
|
|
22941
23079
|
if (!window.weave) window.weave = this;
|
|
22942
23080
|
}
|
|
22943
23081
|
this.emitEvent("onRoomLoaded", false);
|
|
@@ -22961,8 +23099,39 @@ var Weave = class {
|
|
|
22961
23099
|
store.setup();
|
|
22962
23100
|
store.connect();
|
|
22963
23101
|
}
|
|
23102
|
+
async switchRoom() {
|
|
23103
|
+
this.moduleLogger.info(`Switching room`);
|
|
23104
|
+
const nodeHandlers = this.registerManager.getNodesHandlers();
|
|
23105
|
+
for (const nodeHandlerKey of Object.keys(nodeHandlers)) {
|
|
23106
|
+
const nodeHandler = nodeHandlers[nodeHandlerKey];
|
|
23107
|
+
nodeHandler?.onDestroyInstance();
|
|
23108
|
+
}
|
|
23109
|
+
const stage = this.getStage();
|
|
23110
|
+
if (stage) stage.destroy();
|
|
23111
|
+
if (this.eventsController) this.eventsController.abort();
|
|
23112
|
+
if (!this.isServerSide()) this.eventsController = new AbortController();
|
|
23113
|
+
this.registerManager.reset();
|
|
23114
|
+
this.asyncManager.reset();
|
|
23115
|
+
this.moduleLogger.info("Switching room instance");
|
|
23116
|
+
if (!this.isServerSide()) {
|
|
23117
|
+
if (!window.weave) window.weave = this;
|
|
23118
|
+
}
|
|
23119
|
+
this.emitEvent("onRoomLoaded", false);
|
|
23120
|
+
this.status = WEAVE_INSTANCE_STATUS.STARTING;
|
|
23121
|
+
this.emitEvent("onInstanceStatus", this.status);
|
|
23122
|
+
this.registerManager.reset();
|
|
23123
|
+
this.status = WEAVE_INSTANCE_STATUS.LOADING_FONTS;
|
|
23124
|
+
this.emitEvent("onInstanceStatus", this.status);
|
|
23125
|
+
await this.fontsManager.loadFonts();
|
|
23126
|
+
this.setupManager.setupLog();
|
|
23127
|
+
this.stageManager.initStage();
|
|
23128
|
+
this.status = WEAVE_INSTANCE_STATUS.CONNECTING_TO_ROOM;
|
|
23129
|
+
this.emitEvent("onInstanceStatus", this.status);
|
|
23130
|
+
this.addEventListener("onStoreConnectionStatusChange", this.handleStoreConnectionStatusChange.bind(this));
|
|
23131
|
+
}
|
|
22964
23132
|
destroy() {
|
|
22965
23133
|
this.moduleLogger.info(`Destroying the instance`);
|
|
23134
|
+
if (this.eventsController) this.eventsController.abort();
|
|
22966
23135
|
this.emitter.clearListeners();
|
|
22967
23136
|
this.status = WEAVE_INSTANCE_STATUS.IDLE;
|
|
22968
23137
|
this.emitEvent("onInstanceStatus", this.status);
|
|
@@ -23432,6 +23601,9 @@ var Weave = class {
|
|
|
23432
23601
|
async exportNodesServerSide(nodes, boundingNodes, options) {
|
|
23433
23602
|
return await this.exportManager.exportNodesServerSide(nodes, boundingNodes, options);
|
|
23434
23603
|
}
|
|
23604
|
+
async exportAreaServerSide(area, options) {
|
|
23605
|
+
return await this.exportManager.exportAreaServerSide(area, options);
|
|
23606
|
+
}
|
|
23435
23607
|
async exportNodes(nodes, boundingNodes, options) {
|
|
23436
23608
|
return await this.exportManager.exportNodesAsImage(nodes, boundingNodes, options);
|
|
23437
23609
|
}
|
|
@@ -23597,6 +23769,9 @@ var Weave = class {
|
|
|
23597
23769
|
getDragProperties() {
|
|
23598
23770
|
return this.dragAndDropManager.getDragProperties();
|
|
23599
23771
|
}
|
|
23772
|
+
getEventsController() {
|
|
23773
|
+
return this.eventsController;
|
|
23774
|
+
}
|
|
23600
23775
|
};
|
|
23601
23776
|
|
|
23602
23777
|
//#endregion
|
|
@@ -23688,6 +23863,7 @@ const downscaleImageFromURL = (url, options) => {
|
|
|
23688
23863
|
//#endregion
|
|
23689
23864
|
//#region src/internal-utils/upscale.ts
|
|
23690
23865
|
const setupUpscaleStage = (instance, stage) => {
|
|
23866
|
+
if (instance.isServerSide()) return;
|
|
23691
23867
|
const config = instance.getConfiguration();
|
|
23692
23868
|
const doUpscale = config.performance?.upscale?.enabled ?? false;
|
|
23693
23869
|
if (doUpscale) {
|
|
@@ -23719,7 +23895,14 @@ const setupUpscaleStage = (instance, stage) => {
|
|
|
23719
23895
|
innerElement.style.transformOrigin = "0 0";
|
|
23720
23896
|
innerElement.style.transform = `scale(${scaleToCover})`;
|
|
23721
23897
|
}
|
|
23722
|
-
} else
|
|
23898
|
+
} else {
|
|
23899
|
+
const realContainer = stage.container();
|
|
23900
|
+
const containerWidth = realContainer.offsetWidth;
|
|
23901
|
+
const containerHeight = realContainer.offsetHeight;
|
|
23902
|
+
stage.width(containerWidth);
|
|
23903
|
+
stage.height(containerHeight);
|
|
23904
|
+
stage.setAttrs({ upscaleScale: 1 });
|
|
23905
|
+
}
|
|
23723
23906
|
};
|
|
23724
23907
|
|
|
23725
23908
|
//#endregion
|
|
@@ -23730,6 +23913,7 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23730
23913
|
wheelMousePressed = false;
|
|
23731
23914
|
isCmdCtrlPressed = false;
|
|
23732
23915
|
globalEventsInitialized = false;
|
|
23916
|
+
initialize = void 0;
|
|
23733
23917
|
onRender(props) {
|
|
23734
23918
|
const stage = new Konva.Stage({
|
|
23735
23919
|
...props,
|
|
@@ -23748,10 +23932,10 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23748
23932
|
container.setAttribute("tabindex", "0");
|
|
23749
23933
|
stage.container().addEventListener("focus", () => {
|
|
23750
23934
|
this.stageFocused = true;
|
|
23751
|
-
});
|
|
23935
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
23752
23936
|
stage.container().addEventListener("blur", () => {
|
|
23753
23937
|
this.stageFocused = false;
|
|
23754
|
-
});
|
|
23938
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
23755
23939
|
}
|
|
23756
23940
|
Konva.Stage.prototype.mode = function(mode) {
|
|
23757
23941
|
if (typeof mode !== "undefined") this._mode = mode;
|
|
@@ -23821,7 +24005,7 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23821
24005
|
const selectedNode = transformer.nodes()[0];
|
|
23822
24006
|
selectedNode.fire("onCmdCtrlPressed");
|
|
23823
24007
|
}
|
|
23824
|
-
});
|
|
24008
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
23825
24009
|
window.addEventListener("keyup", (e) => {
|
|
23826
24010
|
if (!(e.ctrlKey || e.metaKey)) {
|
|
23827
24011
|
this.isCmdCtrlPressed = false;
|
|
@@ -23832,7 +24016,7 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23832
24016
|
const selectedNode = transformer.nodes()[0];
|
|
23833
24017
|
selectedNode.fire("onCmdCtrlReleased");
|
|
23834
24018
|
}
|
|
23835
|
-
});
|
|
24019
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
23836
24020
|
this.globalEventsInitialized = true;
|
|
23837
24021
|
}
|
|
23838
24022
|
isOnlyCtrlOrMeta(event) {
|
|
@@ -23852,6 +24036,7 @@ const WEAVE_LAYER_NODE_TYPE = "layer";
|
|
|
23852
24036
|
//#region src/nodes/layer/layer.ts
|
|
23853
24037
|
var WeaveLayerNode = class extends WeaveNode {
|
|
23854
24038
|
nodeType = WEAVE_LAYER_NODE_TYPE;
|
|
24039
|
+
initialize = void 0;
|
|
23855
24040
|
onRender(props) {
|
|
23856
24041
|
const layer = new Konva.Layer({ ...props });
|
|
23857
24042
|
layer.canMoveToContainer = function() {
|
|
@@ -23899,6 +24084,7 @@ const WEAVE_GROUP_NODE_TYPE = "group";
|
|
|
23899
24084
|
//#region src/nodes/group/group.ts
|
|
23900
24085
|
var WeaveGroupNode = class extends WeaveNode {
|
|
23901
24086
|
nodeType = WEAVE_GROUP_NODE_TYPE;
|
|
24087
|
+
initialize = void 0;
|
|
23902
24088
|
constructor(params) {
|
|
23903
24089
|
super();
|
|
23904
24090
|
const { config } = params ?? {};
|
|
@@ -23991,6 +24177,7 @@ const WEAVE_RECTANGLE_NODE_TYPE = "rectangle";
|
|
|
23991
24177
|
//#region src/nodes/rectangle/rectangle.ts
|
|
23992
24178
|
var WeaveRectangleNode = class extends WeaveNode {
|
|
23993
24179
|
nodeType = WEAVE_RECTANGLE_NODE_TYPE;
|
|
24180
|
+
initialize = void 0;
|
|
23994
24181
|
constructor(params) {
|
|
23995
24182
|
super();
|
|
23996
24183
|
const { config } = params ?? {};
|
|
@@ -24034,6 +24221,7 @@ const WEAVE_ELLIPSE_NODE_TYPE = "ellipse";
|
|
|
24034
24221
|
//#region src/nodes/ellipse/ellipse.ts
|
|
24035
24222
|
var WeaveEllipseNode = class extends WeaveNode {
|
|
24036
24223
|
nodeType = WEAVE_ELLIPSE_NODE_TYPE;
|
|
24224
|
+
initialize = void 0;
|
|
24037
24225
|
constructor(params) {
|
|
24038
24226
|
super();
|
|
24039
24227
|
const { config } = params ?? {};
|
|
@@ -24179,13 +24367,16 @@ var WeaveLineNode = class extends WeaveNode {
|
|
|
24179
24367
|
constructor(params) {
|
|
24180
24368
|
super();
|
|
24181
24369
|
this.config = mergeExceptArrays(WEAVE_LINE_NODE_DEFAULT_CONFIG, params?.config ?? {});
|
|
24182
|
-
this.handleNodeChanges = null;
|
|
24183
|
-
this.handleZoomChanges = null;
|
|
24184
24370
|
this.snapper = new GreedySnapper({
|
|
24185
24371
|
snapAngles: this.config.snapAngles.angles,
|
|
24186
24372
|
activateThreshold: this.config.snapAngles.activateThreshold,
|
|
24187
24373
|
releaseThreshold: this.config.snapAngles.releaseThreshold
|
|
24188
24374
|
});
|
|
24375
|
+
this.initialize();
|
|
24376
|
+
}
|
|
24377
|
+
initialize() {
|
|
24378
|
+
this.handleNodeChanges = null;
|
|
24379
|
+
this.handleZoomChanges = null;
|
|
24189
24380
|
}
|
|
24190
24381
|
onRender(props) {
|
|
24191
24382
|
const line = new Konva.Line({
|
|
@@ -24490,17 +24681,19 @@ const TEXT_LAYOUT = {
|
|
|
24490
24681
|
//#region src/nodes/text/text.ts
|
|
24491
24682
|
var WeaveTextNode = class extends WeaveNode {
|
|
24492
24683
|
nodeType = WEAVE_TEXT_NODE_TYPE;
|
|
24493
|
-
editing = false;
|
|
24494
|
-
textAreaSuperContainer = null;
|
|
24495
|
-
textAreaContainer = null;
|
|
24496
|
-
textArea = null;
|
|
24497
|
-
eventsInitialized = false;
|
|
24498
|
-
isCtrlMetaPressed = false;
|
|
24499
24684
|
constructor(params) {
|
|
24500
24685
|
super();
|
|
24501
24686
|
const { config } = params ?? {};
|
|
24502
24687
|
this.config = (0, import_lodash.merge)({}, WEAVE_TEXT_NODE_DEFAULT_CONFIG, config);
|
|
24688
|
+
this.initialize();
|
|
24689
|
+
}
|
|
24690
|
+
initialize() {
|
|
24503
24691
|
this.keyPressHandler = void 0;
|
|
24692
|
+
this.eventsInitialized = false;
|
|
24693
|
+
this.isCtrlMetaPressed = false;
|
|
24694
|
+
this.textAreaSuperContainer = null;
|
|
24695
|
+
this.textAreaContainer = null;
|
|
24696
|
+
this.textArea = null;
|
|
24504
24697
|
this.editing = false;
|
|
24505
24698
|
this.textArea = null;
|
|
24506
24699
|
}
|
|
@@ -24508,10 +24701,10 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24508
24701
|
if (!this.eventsInitialized && !globalThis._weave_isServerSide) {
|
|
24509
24702
|
window.addEventListener("keydown", (e) => {
|
|
24510
24703
|
if (e.ctrlKey || e.metaKey) this.isCtrlMetaPressed = true;
|
|
24511
|
-
});
|
|
24704
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24512
24705
|
window.addEventListener("keyup", (e) => {
|
|
24513
24706
|
if (!(e.ctrlKey || e.metaKey)) this.isCtrlMetaPressed = false;
|
|
24514
|
-
});
|
|
24707
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24515
24708
|
this.eventsInitialized = true;
|
|
24516
24709
|
}
|
|
24517
24710
|
}
|
|
@@ -24539,7 +24732,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24539
24732
|
onAdd() {
|
|
24540
24733
|
if (!this.instance.isServerSide() && !this.keyPressHandler) {
|
|
24541
24734
|
this.keyPressHandler = this.handleKeyPress.bind(this);
|
|
24542
|
-
window.addEventListener("keypress", this.keyPressHandler);
|
|
24735
|
+
window.addEventListener("keypress", this.keyPressHandler, { signal: this.instance.getEventsController()?.signal });
|
|
24543
24736
|
}
|
|
24544
24737
|
}
|
|
24545
24738
|
onRender(props) {
|
|
@@ -24693,7 +24886,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24693
24886
|
});
|
|
24694
24887
|
if (!this.instance.isServerSide() && !this.keyPressHandler) {
|
|
24695
24888
|
this.keyPressHandler = this.handleKeyPress.bind(this);
|
|
24696
|
-
window.addEventListener("keypress", this.keyPressHandler);
|
|
24889
|
+
window.addEventListener("keypress", this.keyPressHandler, { signal: this.instance.getEventsController()?.signal });
|
|
24697
24890
|
}
|
|
24698
24891
|
return text;
|
|
24699
24892
|
}
|
|
@@ -24952,17 +25145,17 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24952
25145
|
this.textAreaSuperContainer.scrollTop = 0;
|
|
24953
25146
|
this.textAreaSuperContainer.scrollLeft = 0;
|
|
24954
25147
|
}
|
|
24955
|
-
});
|
|
25148
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24956
25149
|
this.textAreaContainer.addEventListener("scroll", () => {
|
|
24957
25150
|
if (!this.textAreaContainer) return;
|
|
24958
25151
|
this.textAreaContainer.scrollTop = 0;
|
|
24959
25152
|
this.textAreaContainer.scrollLeft = 0;
|
|
24960
|
-
});
|
|
25153
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24961
25154
|
this.textArea.addEventListener("scroll", () => {
|
|
24962
25155
|
if (!this.textArea) return;
|
|
24963
25156
|
this.textArea.scrollTop = 0;
|
|
24964
25157
|
this.textArea.scrollLeft = 0;
|
|
24965
|
-
});
|
|
25158
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24966
25159
|
const rotation = textNode.getAbsoluteRotation();
|
|
24967
25160
|
if (rotation) {
|
|
24968
25161
|
const transform = "rotate(" + rotation + "deg)";
|
|
@@ -25011,8 +25204,8 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
25011
25204
|
this.textAreaDomResize(textNode);
|
|
25012
25205
|
}
|
|
25013
25206
|
};
|
|
25014
|
-
this.textArea.addEventListener("keydown", handleKeyDown);
|
|
25015
|
-
this.textArea.addEventListener("keyup", handleKeyUp);
|
|
25207
|
+
this.textArea.addEventListener("keydown", handleKeyDown, { signal: this.instance.getEventsController()?.signal });
|
|
25208
|
+
this.textArea.addEventListener("keyup", handleKeyUp, { signal: this.instance.getEventsController()?.signal });
|
|
25016
25209
|
this.textArea.tabIndex = 1;
|
|
25017
25210
|
this.textArea.focus();
|
|
25018
25211
|
const handleOutsideClick = (e) => {
|
|
@@ -25038,7 +25231,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
25038
25231
|
}
|
|
25039
25232
|
};
|
|
25040
25233
|
setTimeout(() => {
|
|
25041
|
-
window.addEventListener("pointerup", handleOutsideClick);
|
|
25234
|
+
window.addEventListener("pointerup", handleOutsideClick, { signal: this.instance.getEventsController()?.signal });
|
|
25042
25235
|
}, 0);
|
|
25043
25236
|
this.instance.getStage().mode(WEAVE_STAGE_TEXT_EDITION_MODE);
|
|
25044
25237
|
this.editing = true;
|
|
@@ -25372,7 +25565,7 @@ var WeaveImageCrop = class WeaveImageCrop {
|
|
|
25372
25565
|
utilityLayer?.add(this.transformer);
|
|
25373
25566
|
this.transformer?.forceUpdate();
|
|
25374
25567
|
this.cropGroup.show();
|
|
25375
|
-
window.addEventListener("keydown", this.handleHide);
|
|
25568
|
+
window.addEventListener("keydown", this.handleHide, { signal: this.instance.getEventsController()?.signal });
|
|
25376
25569
|
if (options.cmdCtrl.triggered) {
|
|
25377
25570
|
utilityLayer?.hide();
|
|
25378
25571
|
const stage = this.instance.getStage();
|
|
@@ -25822,24 +26015,21 @@ const isAllowedUrl = (value) => {
|
|
|
25822
26015
|
//#endregion
|
|
25823
26016
|
//#region src/nodes/image/image.ts
|
|
25824
26017
|
var WeaveImageNode = class extends WeaveNode {
|
|
25825
|
-
imageBitmapCache = {};
|
|
25826
|
-
imageSource = {};
|
|
25827
|
-
imageFallback = {};
|
|
25828
|
-
imageState = {};
|
|
25829
|
-
imageTryoutAttempts = {};
|
|
25830
|
-
imageTryoutIds = {};
|
|
25831
26018
|
nodeType = WEAVE_IMAGE_NODE_TYPE;
|
|
25832
26019
|
cursorsFallback = { loading: "wait" };
|
|
25833
26020
|
cursors = {};
|
|
25834
26021
|
constructor(params) {
|
|
25835
26022
|
super();
|
|
25836
26023
|
const { config } = params ?? {};
|
|
26024
|
+
this.config = mergeExceptArrays(WEAVE_IMAGE_DEFAULT_CONFIG, config);
|
|
26025
|
+
this.initialize();
|
|
26026
|
+
}
|
|
26027
|
+
initialize() {
|
|
25837
26028
|
this.tapStart = {
|
|
25838
26029
|
x: 0,
|
|
25839
26030
|
y: 0,
|
|
25840
26031
|
time: 0
|
|
25841
26032
|
};
|
|
25842
|
-
this.config = mergeExceptArrays(WEAVE_IMAGE_DEFAULT_CONFIG, config);
|
|
25843
26033
|
this.imageCrop = null;
|
|
25844
26034
|
this.imageBitmapCache = {};
|
|
25845
26035
|
this.imageSource = {};
|
|
@@ -26058,7 +26248,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26058
26248
|
};
|
|
26059
26249
|
this.updateImageCrop(image);
|
|
26060
26250
|
} else {
|
|
26061
|
-
this.updatePlaceholderSize(image
|
|
26251
|
+
this.updatePlaceholderSize(image);
|
|
26062
26252
|
this.loadImage(imageProps, image, true);
|
|
26063
26253
|
}
|
|
26064
26254
|
if (this.config.performance.cache.enabled) image.on("transformend", () => {
|
|
@@ -26445,7 +26635,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26445
26635
|
}
|
|
26446
26636
|
this.loadAsyncElement(id);
|
|
26447
26637
|
preloadFunction(id, realImageURL ?? "", {
|
|
26448
|
-
onLoad: () => {
|
|
26638
|
+
onLoad: async () => {
|
|
26449
26639
|
if (useFallback) this.imageTryoutIds[id] = setTimeout(() => {
|
|
26450
26640
|
const node = this.instance.getStage().findOne(`#${id}`);
|
|
26451
26641
|
if (node) {
|
|
@@ -26496,7 +26686,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26496
26686
|
error: false
|
|
26497
26687
|
};
|
|
26498
26688
|
this.updateImageCrop(image);
|
|
26499
|
-
this.resolveAsyncElement(id);
|
|
26689
|
+
if (!useFallback) this.resolveAsyncElement(id);
|
|
26500
26690
|
this.cacheNode(image);
|
|
26501
26691
|
}
|
|
26502
26692
|
},
|
|
@@ -26537,13 +26727,9 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26537
26727
|
}
|
|
26538
26728
|
}, loadTryout);
|
|
26539
26729
|
}
|
|
26540
|
-
updatePlaceholderSize(image
|
|
26730
|
+
updatePlaceholderSize(image) {
|
|
26541
26731
|
const imageAttrs = image.getAttrs();
|
|
26542
26732
|
if (!this.imageState[imageAttrs.id ?? ""]?.loaded) return;
|
|
26543
|
-
if (!imageAttrs.adding && !imageAttrs.cropInfo) {
|
|
26544
|
-
imagePlaceholder.width(imageAttrs.uncroppedImage.width);
|
|
26545
|
-
imagePlaceholder.height(imageAttrs.uncroppedImage.height);
|
|
26546
|
-
}
|
|
26547
26733
|
}
|
|
26548
26734
|
updateImageCrop(image) {
|
|
26549
26735
|
const imageAttrs = image.getAttrs();
|
|
@@ -26677,6 +26863,7 @@ const WEAVE_STAR_NODE_TYPE = "star";
|
|
|
26677
26863
|
//#region src/nodes/star/star.ts
|
|
26678
26864
|
var WeaveStarNode = class extends WeaveNode {
|
|
26679
26865
|
nodeType = WEAVE_STAR_NODE_TYPE;
|
|
26866
|
+
initialize = void 0;
|
|
26680
26867
|
constructor(params) {
|
|
26681
26868
|
super();
|
|
26682
26869
|
const { config } = params ?? {};
|
|
@@ -26762,6 +26949,7 @@ const WEAVE_ARROW_NODE_TYPE = "arrow";
|
|
|
26762
26949
|
//#region src/nodes/arrow/arrow.ts
|
|
26763
26950
|
var WeaveArrowNode = class extends WeaveNode {
|
|
26764
26951
|
nodeType = WEAVE_ARROW_NODE_TYPE;
|
|
26952
|
+
initialize = void 0;
|
|
26765
26953
|
constructor(params) {
|
|
26766
26954
|
super();
|
|
26767
26955
|
const { config } = params ?? {};
|
|
@@ -26818,6 +27006,7 @@ const WEAVE_REGULAR_POLYGON_NODE_TYPE = "regular-polygon";
|
|
|
26818
27006
|
//#region src/nodes/regular-polygon/regular-polygon.ts
|
|
26819
27007
|
var WeaveRegularPolygonNode = class extends WeaveNode {
|
|
26820
27008
|
nodeType = WEAVE_REGULAR_POLYGON_NODE_TYPE;
|
|
27009
|
+
initialize = void 0;
|
|
26821
27010
|
constructor(params) {
|
|
26822
27011
|
super();
|
|
26823
27012
|
const { config } = params ?? {};
|
|
@@ -26931,6 +27120,7 @@ var GroupFrame = class extends Konva.Group {
|
|
|
26931
27120
|
//#region src/nodes/frame/frame.ts
|
|
26932
27121
|
var WeaveFrameNode = class extends WeaveNode {
|
|
26933
27122
|
nodeType = WEAVE_FRAME_NODE_TYPE;
|
|
27123
|
+
initialize = void 0;
|
|
26934
27124
|
constructor(params) {
|
|
26935
27125
|
super();
|
|
26936
27126
|
const { config } = params ?? {};
|
|
@@ -27231,6 +27421,7 @@ const WEAVE_STROKE_NODE_DEFAULT_CONFIG = {
|
|
|
27231
27421
|
//#region src/nodes/stroke/stroke.ts
|
|
27232
27422
|
var WeaveStrokeNode = class extends WeaveNode {
|
|
27233
27423
|
nodeType = WEAVE_STROKE_NODE_TYPE;
|
|
27424
|
+
initialize = void 0;
|
|
27234
27425
|
constructor(params) {
|
|
27235
27426
|
super();
|
|
27236
27427
|
const { config } = params ?? {};
|
|
@@ -27807,8 +27998,6 @@ var WeaveSquareLineTipManager = class extends WeaveBaseLineTipManager {
|
|
|
27807
27998
|
//#endregion
|
|
27808
27999
|
//#region src/nodes/stroke-single/stroke-single.ts
|
|
27809
28000
|
var WeaveStrokeSingleNode = class extends WeaveNode {
|
|
27810
|
-
startHandle = null;
|
|
27811
|
-
endHandle = null;
|
|
27812
28001
|
nodeType = WEAVE_STROKE_SINGLE_NODE_TYPE;
|
|
27813
28002
|
tipManagers = {
|
|
27814
28003
|
[WEAVE_STROKE_SINGLE_NODE_TIP_TYPE.ARROW]: new WeaveArrowLineTipManager(),
|
|
@@ -27819,24 +28008,29 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
|
|
|
27819
28008
|
constructor(params) {
|
|
27820
28009
|
super();
|
|
27821
28010
|
this.config = mergeExceptArrays(WEAVE_STROKE_SINGLE_NODE_DEFAULT_CONFIG, params?.config ?? {});
|
|
27822
|
-
this.handleNodeChanges = null;
|
|
27823
|
-
this.handleZoomChanges = null;
|
|
27824
|
-
this.shiftPressed = false;
|
|
27825
28011
|
this.snapper = new GreedySnapper({
|
|
27826
28012
|
snapAngles: this.config.snapAngles.angles,
|
|
27827
28013
|
activateThreshold: this.config.snapAngles.activateThreshold,
|
|
27828
28014
|
releaseThreshold: this.config.snapAngles.releaseThreshold
|
|
27829
28015
|
});
|
|
28016
|
+
this.initialize();
|
|
28017
|
+
}
|
|
28018
|
+
initialize() {
|
|
27830
28019
|
this.eventsInitialized = false;
|
|
28020
|
+
this.startHandle = null;
|
|
28021
|
+
this.endHandle = null;
|
|
28022
|
+
this.handleNodeChanges = null;
|
|
28023
|
+
this.handleZoomChanges = null;
|
|
28024
|
+
this.shiftPressed = false;
|
|
27831
28025
|
}
|
|
27832
28026
|
initEvents() {
|
|
27833
28027
|
if (this.eventsInitialized) return;
|
|
27834
28028
|
window.addEventListener("keydown", (e) => {
|
|
27835
28029
|
if (e.key === "Shift") this.shiftPressed = true;
|
|
27836
|
-
});
|
|
28030
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
27837
28031
|
window.addEventListener("keyup", (e) => {
|
|
27838
28032
|
if (e.key === "Shift") this.shiftPressed = false;
|
|
27839
|
-
});
|
|
28033
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
27840
28034
|
this.eventsInitialized = true;
|
|
27841
28035
|
}
|
|
27842
28036
|
onRender(props) {
|
|
@@ -28323,6 +28517,9 @@ var WeaveCommentNode = class extends WeaveNode {
|
|
|
28323
28517
|
constructor(params) {
|
|
28324
28518
|
super();
|
|
28325
28519
|
this.config = mergeExceptArrays(WEAVE_COMMENT_NODE_DEFAULTS, params.config);
|
|
28520
|
+
this.initialize();
|
|
28521
|
+
}
|
|
28522
|
+
initialize() {
|
|
28326
28523
|
this.commentDomVisibleId = null;
|
|
28327
28524
|
this.commentDomVisible = false;
|
|
28328
28525
|
this.commentDomAction = null;
|
|
@@ -28951,10 +29148,6 @@ const WEAVE_VIDEO_DEFAULT_CONFIG = {
|
|
|
28951
29148
|
//#endregion
|
|
28952
29149
|
//#region src/nodes/video/video.ts
|
|
28953
29150
|
var WeaveVideoNode = class extends WeaveNode {
|
|
28954
|
-
videoState = {};
|
|
28955
|
-
videoSourceFrameId = {};
|
|
28956
|
-
videoSource = {};
|
|
28957
|
-
videoPlaceholder = {};
|
|
28958
29151
|
nodeType = WEAVE_VIDEO_NODE_TYPE;
|
|
28959
29152
|
constructor(params) {
|
|
28960
29153
|
super();
|
|
@@ -28967,6 +29160,13 @@ var WeaveVideoNode = class extends WeaveNode {
|
|
|
28967
29160
|
this.videoIconImage.src = this.config.style.icon.dataURL;
|
|
28968
29161
|
}
|
|
28969
29162
|
}
|
|
29163
|
+
initialize() {
|
|
29164
|
+
this.videoState = {};
|
|
29165
|
+
this.videoSource = {};
|
|
29166
|
+
this.videoSourceFrameId = {};
|
|
29167
|
+
this.videoPlaceholder = {};
|
|
29168
|
+
this.videoIconImage = void 0;
|
|
29169
|
+
}
|
|
28970
29170
|
async loadPlaceholder(params, video) {
|
|
28971
29171
|
const videoProps = params;
|
|
28972
29172
|
const { id } = videoProps;
|
|
@@ -29461,6 +29661,7 @@ const WEAVE_MEASURE_NODE_DEFAULT_CONFIG = { style: {
|
|
|
29461
29661
|
var WeaveMeasureNode = class extends WeaveNode {
|
|
29462
29662
|
nodeType = WEAVE_MEASURE_NODE_TYPE;
|
|
29463
29663
|
handlePointCircleRadius = 6;
|
|
29664
|
+
initialize = void 0;
|
|
29464
29665
|
constructor(params) {
|
|
29465
29666
|
super();
|
|
29466
29667
|
this.config = mergeExceptArrays(WEAVE_MEASURE_NODE_DEFAULT_CONFIG, params?.config ?? {});
|
|
@@ -30751,6 +30952,7 @@ var WeaveConnectorNode = class extends WeaveNode {
|
|
|
30751
30952
|
[WEAVE_CONNECTOR_NODE_DECORATOR_TYPE.DOT]: setupNodeDecoratorDot,
|
|
30752
30953
|
[WEAVE_CONNECTOR_NODE_DECORATOR_TYPE.ARROW]: setupNodeDecoratorArrow
|
|
30753
30954
|
};
|
|
30955
|
+
initialize = void 0;
|
|
30754
30956
|
constructor(params) {
|
|
30755
30957
|
super();
|
|
30756
30958
|
this.config = mergeExceptArrays(WEAVE_CONNECTOR_NODE_DEFAULT_CONFIG, params?.config);
|
|
@@ -31501,10 +31703,6 @@ const WEAVE_STAGE_ZOOM_DEFAULT_CONFIG = {
|
|
|
31501
31703
|
var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
31502
31704
|
getLayerName = void 0;
|
|
31503
31705
|
initLayer = void 0;
|
|
31504
|
-
pinching = false;
|
|
31505
|
-
zooming = false;
|
|
31506
|
-
isTrackpad = false;
|
|
31507
|
-
zoomVelocity = 0;
|
|
31508
31706
|
zoomInertiaType = WEAVE_STAGE_ZOOM_TYPE.MOUSE_WHEEL;
|
|
31509
31707
|
defaultStep = 3;
|
|
31510
31708
|
constructor(params) {
|
|
@@ -31512,8 +31710,13 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31512
31710
|
const { config } = params ?? {};
|
|
31513
31711
|
this.config = mergeExceptArrays(WEAVE_STAGE_ZOOM_DEFAULT_CONFIG, config);
|
|
31514
31712
|
if (!this.config.zoomSteps.includes(this.config.defaultZoom)) throw new Error(`Default zoom ${this.config.defaultZoom} is not in zoom steps`);
|
|
31713
|
+
this.initialize();
|
|
31714
|
+
}
|
|
31715
|
+
initialize() {
|
|
31515
31716
|
this.pinching = false;
|
|
31717
|
+
this.zooming = false;
|
|
31516
31718
|
this.isTrackpad = false;
|
|
31719
|
+
this.zoomVelocity = 0;
|
|
31517
31720
|
this.isCtrlOrMetaPressed = false;
|
|
31518
31721
|
this.updatedMinimumZoom = false;
|
|
31519
31722
|
this.actualStep = this.config.zoomSteps.findIndex((step) => step === this.config.defaultZoom);
|
|
@@ -31800,6 +32003,15 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31800
32003
|
if (box.width === 0 || box.height === 0) return;
|
|
31801
32004
|
this.fitToElements(box, finalOptions);
|
|
31802
32005
|
}
|
|
32006
|
+
fitToArea(area, options) {
|
|
32007
|
+
const finalOptions = mergeExceptArrays({
|
|
32008
|
+
smartZoom: false,
|
|
32009
|
+
overrideZoom: true
|
|
32010
|
+
}, options);
|
|
32011
|
+
if (!this.enabled) return;
|
|
32012
|
+
if (area.width === 0 || area.height === 0) return;
|
|
32013
|
+
this.fitToElements(area, finalOptions);
|
|
32014
|
+
}
|
|
31803
32015
|
enable() {
|
|
31804
32016
|
this.enabled = true;
|
|
31805
32017
|
}
|
|
@@ -31818,10 +32030,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31818
32030
|
initEvents() {
|
|
31819
32031
|
window.addEventListener("keydown", (e) => {
|
|
31820
32032
|
if (e.ctrlKey || e.metaKey) this.isCtrlOrMetaPressed = true;
|
|
31821
|
-
});
|
|
32033
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
31822
32034
|
window.addEventListener("keyup", (e) => {
|
|
31823
32035
|
if (!(e.ctrlKey || e.metaKey)) this.isCtrlOrMetaPressed = false;
|
|
31824
|
-
});
|
|
32036
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
31825
32037
|
const stage = this.instance.getStage();
|
|
31826
32038
|
let lastCenter = null;
|
|
31827
32039
|
let lastDist = 0;
|
|
@@ -31846,7 +32058,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31846
32058
|
return;
|
|
31847
32059
|
}
|
|
31848
32060
|
}
|
|
31849
|
-
}, {
|
|
32061
|
+
}, {
|
|
32062
|
+
passive: false,
|
|
32063
|
+
signal: this.instance.getEventsController()?.signal
|
|
32064
|
+
});
|
|
31850
32065
|
stage.getContent().addEventListener("touchmove", (e) => {
|
|
31851
32066
|
e.preventDefault();
|
|
31852
32067
|
if (e.touches.length === 2) {
|
|
@@ -31886,12 +32101,18 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31886
32101
|
lastDist = dist;
|
|
31887
32102
|
lastCenter = newCenter;
|
|
31888
32103
|
}
|
|
31889
|
-
}, {
|
|
32104
|
+
}, {
|
|
32105
|
+
passive: false,
|
|
32106
|
+
signal: this.instance.getEventsController()?.signal
|
|
32107
|
+
});
|
|
31890
32108
|
stage.getContent().addEventListener("touchend", () => {
|
|
31891
32109
|
this.pinching = false;
|
|
31892
32110
|
lastDist = 0;
|
|
31893
32111
|
lastCenter = null;
|
|
31894
|
-
}, {
|
|
32112
|
+
}, {
|
|
32113
|
+
passive: false,
|
|
32114
|
+
signal: this.instance.getEventsController()?.signal
|
|
32115
|
+
});
|
|
31895
32116
|
let doZoom = false;
|
|
31896
32117
|
const handleWheelImmediate = (e) => {
|
|
31897
32118
|
const performZoom = this.isCtrlOrMetaPressed || !this.isCtrlOrMetaPressed && e.ctrlKey && e.deltaMode === 0;
|
|
@@ -31909,7 +32130,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31909
32130
|
e.preventDefault();
|
|
31910
32131
|
doZoom = true;
|
|
31911
32132
|
};
|
|
31912
|
-
window.addEventListener("wheel", handleWheelImmediate, {
|
|
32133
|
+
window.addEventListener("wheel", handleWheelImmediate, {
|
|
32134
|
+
signal: this.instance.getEventsController()?.signal,
|
|
32135
|
+
passive: false
|
|
32136
|
+
});
|
|
31913
32137
|
const handleWheel = (e) => {
|
|
31914
32138
|
if (!doZoom) return;
|
|
31915
32139
|
const delta = e.deltaY > 0 ? 1 : -1;
|
|
@@ -31922,7 +32146,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31922
32146
|
}
|
|
31923
32147
|
};
|
|
31924
32148
|
const throttledHandleWheel = (0, import_lodash.throttle)(handleWheel, DEFAULT_THROTTLE_MS);
|
|
31925
|
-
window.addEventListener("wheel", throttledHandleWheel, {
|
|
32149
|
+
window.addEventListener("wheel", throttledHandleWheel, {
|
|
32150
|
+
signal: this.instance.getEventsController()?.signal,
|
|
32151
|
+
passive: true
|
|
32152
|
+
});
|
|
31926
32153
|
}
|
|
31927
32154
|
getInertiaScale() {
|
|
31928
32155
|
const stage = this.instance.getStage();
|
|
@@ -31980,6 +32207,7 @@ const ZOOM_OUT_TOOL_ACTION_NAME = "zoomOutTool";
|
|
|
31980
32207
|
//#region src/actions/zoom-out-tool/zoom-out-tool.ts
|
|
31981
32208
|
var WeaveZoomOutToolAction = class extends WeaveAction {
|
|
31982
32209
|
onPropsChange = void 0;
|
|
32210
|
+
initialize = void 0;
|
|
31983
32211
|
getName() {
|
|
31984
32212
|
return ZOOM_OUT_TOOL_ACTION_NAME;
|
|
31985
32213
|
}
|
|
@@ -32014,6 +32242,10 @@ const ZOOM_IN_TOOL_ACTION_NAME = "zoomInTool";
|
|
|
32014
32242
|
//#region src/actions/zoom-in-tool/zoom-in-tool.ts
|
|
32015
32243
|
var WeaveZoomInToolAction = class extends WeaveAction {
|
|
32016
32244
|
onPropsChange = void 0;
|
|
32245
|
+
initialize = void 0;
|
|
32246
|
+
constructor() {
|
|
32247
|
+
super();
|
|
32248
|
+
}
|
|
32017
32249
|
getName() {
|
|
32018
32250
|
return ZOOM_IN_TOOL_ACTION_NAME;
|
|
32019
32251
|
}
|
|
@@ -32048,6 +32280,10 @@ const FIT_TO_SCREEN_TOOL_ACTION_NAME = "fitToScreenTool";
|
|
|
32048
32280
|
//#region src/actions/fit-to-screen-tool/fit-to-screen-tool.ts
|
|
32049
32281
|
var WeaveFitToScreenToolAction = class extends WeaveAction {
|
|
32050
32282
|
onPropsChange = void 0;
|
|
32283
|
+
initialize = void 0;
|
|
32284
|
+
constructor() {
|
|
32285
|
+
super();
|
|
32286
|
+
}
|
|
32051
32287
|
getName() {
|
|
32052
32288
|
return FIT_TO_SCREEN_TOOL_ACTION_NAME;
|
|
32053
32289
|
}
|
|
@@ -32081,6 +32317,10 @@ const FIT_TO_SELECTION_TOOL_ACTION_NAME = "fitToSelectionTool";
|
|
|
32081
32317
|
//#region src/actions/fit-to-selection-tool/fit-to-selection-tool.ts
|
|
32082
32318
|
var WeaveFitToSelectionToolAction = class extends WeaveAction {
|
|
32083
32319
|
onPropsChange = void 0;
|
|
32320
|
+
initialize = void 0;
|
|
32321
|
+
constructor() {
|
|
32322
|
+
super();
|
|
32323
|
+
}
|
|
32084
32324
|
getName() {
|
|
32085
32325
|
return FIT_TO_SELECTION_TOOL_ACTION_NAME;
|
|
32086
32326
|
}
|
|
@@ -32123,6 +32363,9 @@ var WeaveMoveToolAction = class extends WeaveAction {
|
|
|
32123
32363
|
onInit = void 0;
|
|
32124
32364
|
constructor() {
|
|
32125
32365
|
super();
|
|
32366
|
+
this.initialize();
|
|
32367
|
+
}
|
|
32368
|
+
initialize() {
|
|
32126
32369
|
this.initialized = false;
|
|
32127
32370
|
this.state = MOVE_TOOL_STATE.IDLE;
|
|
32128
32371
|
}
|
|
@@ -32136,7 +32379,7 @@ var WeaveMoveToolAction = class extends WeaveAction {
|
|
|
32136
32379
|
this.cancelAction();
|
|
32137
32380
|
return;
|
|
32138
32381
|
}
|
|
32139
|
-
});
|
|
32382
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32140
32383
|
stage.on("pointerdown", () => {
|
|
32141
32384
|
if ([MOVE_TOOL_ACTION_NAME].includes(this.instance.getActiveAction() ?? "")) stage.container().style.cursor = "grabbing";
|
|
32142
32385
|
});
|
|
@@ -32195,6 +32438,9 @@ var WeaveSelectionToolAction = class extends WeaveAction {
|
|
|
32195
32438
|
onInit = void 0;
|
|
32196
32439
|
constructor() {
|
|
32197
32440
|
super();
|
|
32441
|
+
this.initialize();
|
|
32442
|
+
}
|
|
32443
|
+
initialize() {
|
|
32198
32444
|
this.initialized = false;
|
|
32199
32445
|
this.state = SELECTION_TOOL_STATE.IDLE;
|
|
32200
32446
|
}
|
|
@@ -32258,6 +32504,9 @@ var WeaveEraserToolAction = class extends WeaveAction {
|
|
|
32258
32504
|
onInit = void 0;
|
|
32259
32505
|
constructor() {
|
|
32260
32506
|
super();
|
|
32507
|
+
this.initialize();
|
|
32508
|
+
}
|
|
32509
|
+
initialize() {
|
|
32261
32510
|
this.initialized = false;
|
|
32262
32511
|
this.erasing = false;
|
|
32263
32512
|
this.state = ERASER_TOOL_STATE.IDLE;
|
|
@@ -32291,7 +32540,7 @@ var WeaveEraserToolAction = class extends WeaveAction {
|
|
|
32291
32540
|
this.cancelAction();
|
|
32292
32541
|
return;
|
|
32293
32542
|
}
|
|
32294
|
-
});
|
|
32543
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32295
32544
|
this.initialized = true;
|
|
32296
32545
|
}
|
|
32297
32546
|
setState(state) {
|
|
@@ -32358,6 +32607,9 @@ var WeaveRectangleToolAction = class extends WeaveAction {
|
|
|
32358
32607
|
onInit = void 0;
|
|
32359
32608
|
constructor() {
|
|
32360
32609
|
super();
|
|
32610
|
+
this.initialize();
|
|
32611
|
+
}
|
|
32612
|
+
initialize() {
|
|
32361
32613
|
this.pointers = new Map();
|
|
32362
32614
|
this.initialized = false;
|
|
32363
32615
|
this.state = RECTANGLE_TOOL_STATE.IDLE;
|
|
@@ -32393,7 +32645,7 @@ var WeaveRectangleToolAction = class extends WeaveAction {
|
|
|
32393
32645
|
this.cancelAction();
|
|
32394
32646
|
return;
|
|
32395
32647
|
}
|
|
32396
|
-
});
|
|
32648
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32397
32649
|
stage.on("pointermove", () => {
|
|
32398
32650
|
if (this.state === RECTANGLE_TOOL_STATE.IDLE) return;
|
|
32399
32651
|
this.setCursor();
|
|
@@ -32567,6 +32819,9 @@ var WeaveEllipseToolAction = class extends WeaveAction {
|
|
|
32567
32819
|
onInit = void 0;
|
|
32568
32820
|
constructor() {
|
|
32569
32821
|
super();
|
|
32822
|
+
this.initialize();
|
|
32823
|
+
}
|
|
32824
|
+
initialize() {
|
|
32570
32825
|
this.pointers = new Map();
|
|
32571
32826
|
this.initialized = false;
|
|
32572
32827
|
this.state = ELLIPSE_TOOL_STATE.IDLE;
|
|
@@ -32602,7 +32857,7 @@ var WeaveEllipseToolAction = class extends WeaveAction {
|
|
|
32602
32857
|
this.cancelAction();
|
|
32603
32858
|
return;
|
|
32604
32859
|
}
|
|
32605
|
-
});
|
|
32860
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32606
32861
|
stage.on("pointerdown", (e) => {
|
|
32607
32862
|
this.setTapStart(e);
|
|
32608
32863
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -32783,6 +33038,9 @@ var WeavePenToolAction = class extends WeaveAction {
|
|
|
32783
33038
|
onInit = void 0;
|
|
32784
33039
|
constructor() {
|
|
32785
33040
|
super();
|
|
33041
|
+
this.initialize();
|
|
33042
|
+
}
|
|
33043
|
+
initialize() {
|
|
32786
33044
|
this.pointers = new Map();
|
|
32787
33045
|
this.initialized = false;
|
|
32788
33046
|
this.state = PEN_TOOL_STATE.IDLE;
|
|
@@ -32818,7 +33076,7 @@ var WeavePenToolAction = class extends WeaveAction {
|
|
|
32818
33076
|
this.cancelAction();
|
|
32819
33077
|
return;
|
|
32820
33078
|
}
|
|
32821
|
-
});
|
|
33079
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32822
33080
|
stage.on("pointerdown", (e) => {
|
|
32823
33081
|
this.setTapStart(e);
|
|
32824
33082
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -33055,6 +33313,9 @@ var WeaveLineToolAction = class extends WeaveAction {
|
|
|
33055
33313
|
constructor(params) {
|
|
33056
33314
|
super();
|
|
33057
33315
|
this.config = mergeExceptArrays(LINE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
|
|
33316
|
+
this.initialize();
|
|
33317
|
+
}
|
|
33318
|
+
initialize() {
|
|
33058
33319
|
this.pointers = new Map();
|
|
33059
33320
|
this.initialized = false;
|
|
33060
33321
|
this.state = LINE_TOOL_STATE.IDLE;
|
|
@@ -33099,13 +33360,13 @@ var WeaveLineToolAction = class extends WeaveAction {
|
|
|
33099
33360
|
this.snappedAngle = null;
|
|
33100
33361
|
this.shiftPressed = true;
|
|
33101
33362
|
}
|
|
33102
|
-
});
|
|
33363
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33103
33364
|
window.addEventListener("keyup", (e) => {
|
|
33104
33365
|
if (e.key === "Shift" && this.instance.getActiveAction() === LINE_TOOL_ACTION_NAME) {
|
|
33105
33366
|
this.snappedAngle = null;
|
|
33106
33367
|
this.shiftPressed = false;
|
|
33107
33368
|
}
|
|
33108
|
-
});
|
|
33369
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33109
33370
|
stage.on("pointerdown", (e) => {
|
|
33110
33371
|
this.setTapStart(e);
|
|
33111
33372
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -33320,6 +33581,9 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
33320
33581
|
constructor(params) {
|
|
33321
33582
|
super();
|
|
33322
33583
|
this.config = mergeExceptArrays(BRUSH_TOOL_DEFAULT_CONFIG, params?.config ?? {});
|
|
33584
|
+
this.initialize();
|
|
33585
|
+
}
|
|
33586
|
+
initialize() {
|
|
33323
33587
|
this.initialized = false;
|
|
33324
33588
|
this.state = BRUSH_TOOL_STATE.INACTIVE;
|
|
33325
33589
|
this.strokeId = null;
|
|
@@ -33348,7 +33612,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
33348
33612
|
const stage = this.instance.getStage();
|
|
33349
33613
|
window.addEventListener("keyup", (e) => {
|
|
33350
33614
|
if (e.code === "Space" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) this.isSpacePressed = false;
|
|
33351
|
-
});
|
|
33615
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33352
33616
|
window.addEventListener("keydown", (e) => {
|
|
33353
33617
|
if (e.code === "Enter" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) {
|
|
33354
33618
|
e.stopPropagation();
|
|
@@ -33364,7 +33628,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
33364
33628
|
e.stopPropagation();
|
|
33365
33629
|
this.cancelAction();
|
|
33366
33630
|
}
|
|
33367
|
-
});
|
|
33631
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33368
33632
|
const handlePointerDown = (e) => {
|
|
33369
33633
|
if (this.state === BRUSH_TOOL_STATE.INACTIVE) return;
|
|
33370
33634
|
if (this.state !== BRUSH_TOOL_STATE.IDLE) return;
|
|
@@ -33573,6 +33837,9 @@ var WeaveTextToolAction = class extends WeaveAction {
|
|
|
33573
33837
|
onInit = void 0;
|
|
33574
33838
|
constructor() {
|
|
33575
33839
|
super();
|
|
33840
|
+
this.initialize();
|
|
33841
|
+
}
|
|
33842
|
+
initialize() {
|
|
33576
33843
|
this.initialized = false;
|
|
33577
33844
|
this.state = TEXT_TOOL_STATE.IDLE;
|
|
33578
33845
|
this.textId = null;
|
|
@@ -33602,7 +33869,7 @@ var WeaveTextToolAction = class extends WeaveAction {
|
|
|
33602
33869
|
this.cancelAction();
|
|
33603
33870
|
return;
|
|
33604
33871
|
}
|
|
33605
|
-
});
|
|
33872
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33606
33873
|
stage.on("pointermove", () => {
|
|
33607
33874
|
if (this.state === TEXT_TOOL_STATE.IDLE) return;
|
|
33608
33875
|
this.setCursor();
|
|
@@ -33730,6 +33997,9 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
33730
33997
|
constructor(params) {
|
|
33731
33998
|
super();
|
|
33732
33999
|
this.config = mergeExceptArrays(WEAVE_IMAGE_TOOL_CONFIG_DEFAULT, params?.config ?? {});
|
|
34000
|
+
this.initialize();
|
|
34001
|
+
}
|
|
34002
|
+
initialize() {
|
|
33733
34003
|
this.pointers = new Map();
|
|
33734
34004
|
this.initialized = false;
|
|
33735
34005
|
this.imageId = null;
|
|
@@ -33773,7 +34043,7 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
33773
34043
|
this.cancelAction();
|
|
33774
34044
|
return;
|
|
33775
34045
|
}
|
|
33776
|
-
});
|
|
34046
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33777
34047
|
stage.on("pointerdown", (e) => {
|
|
33778
34048
|
this.setTapStart(e);
|
|
33779
34049
|
if (this.ignorePointerEvents) return;
|
|
@@ -34170,6 +34440,9 @@ var WeaveImagesToolAction = class extends WeaveAction {
|
|
|
34170
34440
|
constructor(params) {
|
|
34171
34441
|
super();
|
|
34172
34442
|
this.config = mergeExceptArrays(WEAVE_IMAGES_TOOL_DEFAULT_CONFIG, params ?? {});
|
|
34443
|
+
this.initialize();
|
|
34444
|
+
}
|
|
34445
|
+
initialize() {
|
|
34173
34446
|
this.pointers = new Map();
|
|
34174
34447
|
this.initialized = false;
|
|
34175
34448
|
this.tempPointerFeedbackNode = null;
|
|
@@ -34216,7 +34489,7 @@ var WeaveImagesToolAction = class extends WeaveAction {
|
|
|
34216
34489
|
const stage = this.instance.getStage();
|
|
34217
34490
|
stage.container().addEventListener("keydown", (e) => {
|
|
34218
34491
|
if (e.key === "Escape" && this.instance.getActiveAction() === WEAVE_IMAGES_TOOL_ACTION_NAME) this.cancelAction();
|
|
34219
|
-
});
|
|
34492
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
34220
34493
|
stage.on("pointerdown", (e) => {
|
|
34221
34494
|
this.setTapStart(e);
|
|
34222
34495
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -34598,6 +34871,9 @@ var WeaveStarToolAction = class extends WeaveAction {
|
|
|
34598
34871
|
onInit = void 0;
|
|
34599
34872
|
constructor() {
|
|
34600
34873
|
super();
|
|
34874
|
+
this.initialize();
|
|
34875
|
+
}
|
|
34876
|
+
initialize() {
|
|
34601
34877
|
this.pointers = new Map();
|
|
34602
34878
|
this.initialized = false;
|
|
34603
34879
|
this.state = STAR_TOOL_STATE.IDLE;
|
|
@@ -34634,7 +34910,7 @@ var WeaveStarToolAction = class extends WeaveAction {
|
|
|
34634
34910
|
this.cancelAction();
|
|
34635
34911
|
return;
|
|
34636
34912
|
}
|
|
34637
|
-
});
|
|
34913
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
34638
34914
|
stage.on("pointerdown", (e) => {
|
|
34639
34915
|
this.setTapStart(e);
|
|
34640
34916
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -34799,8 +35075,8 @@ var WeaveStarToolAction = class extends WeaveAction {
|
|
|
34799
35075
|
|
|
34800
35076
|
//#endregion
|
|
34801
35077
|
//#region src/actions/arrow-tool/constants.ts
|
|
34802
|
-
const
|
|
34803
|
-
const
|
|
35078
|
+
const WEAVE_ARROW_TOOL_ACTION_NAME = "arrowTool";
|
|
35079
|
+
const WEAVE_ARROW_TOOL_STATE = {
|
|
34804
35080
|
["IDLE"]: "idle",
|
|
34805
35081
|
["ADDING"]: "adding",
|
|
34806
35082
|
["DEFINING_SIZE"]: "definingSize",
|
|
@@ -34816,9 +35092,12 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34816
35092
|
onInit = void 0;
|
|
34817
35093
|
constructor() {
|
|
34818
35094
|
super();
|
|
35095
|
+
this.initialize();
|
|
35096
|
+
}
|
|
35097
|
+
initialize() {
|
|
34819
35098
|
this.pointers = new Map();
|
|
34820
35099
|
this.initialized = false;
|
|
34821
|
-
this.state =
|
|
35100
|
+
this.state = WEAVE_ARROW_TOOL_STATE.IDLE;
|
|
34822
35101
|
this.arrowId = null;
|
|
34823
35102
|
this.tempArrowId = null;
|
|
34824
35103
|
this.tempMainArrowNode = null;
|
|
@@ -34831,7 +35110,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34831
35110
|
this.props = this.initProps();
|
|
34832
35111
|
}
|
|
34833
35112
|
getName() {
|
|
34834
|
-
return
|
|
35113
|
+
return WEAVE_ARROW_TOOL_ACTION_NAME;
|
|
34835
35114
|
}
|
|
34836
35115
|
initProps() {
|
|
34837
35116
|
return {
|
|
@@ -34848,40 +35127,37 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34848
35127
|
setupEvents() {
|
|
34849
35128
|
const stage = this.instance.getStage();
|
|
34850
35129
|
window.addEventListener("keydown", (e) => {
|
|
34851
|
-
if (e.code === "Enter" && this.instance.getActiveAction() ===
|
|
35130
|
+
if (e.code === "Enter" && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
|
|
34852
35131
|
this.cancelAction();
|
|
34853
35132
|
return;
|
|
34854
35133
|
}
|
|
34855
|
-
if (e.code === "Escape" && this.instance.getActiveAction() ===
|
|
34856
|
-
|
|
34857
|
-
return;
|
|
34858
|
-
}
|
|
34859
|
-
});
|
|
35134
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) this.cancelAction();
|
|
35135
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
34860
35136
|
stage.on("pointerdown", (e) => {
|
|
34861
35137
|
this.setTapStart(e);
|
|
34862
35138
|
this.pointers.set(e.evt.pointerId, {
|
|
34863
35139
|
x: e.evt.clientX,
|
|
34864
35140
|
y: e.evt.clientY
|
|
34865
35141
|
});
|
|
34866
|
-
if (this.pointers.size === 2 && this.instance.getActiveAction() ===
|
|
34867
|
-
this.state =
|
|
35142
|
+
if (this.pointers.size === 2 && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
|
|
35143
|
+
this.state = WEAVE_ARROW_TOOL_STATE.ADDING;
|
|
34868
35144
|
return;
|
|
34869
35145
|
}
|
|
34870
|
-
if (!this.tempMainArrowNode && this.state ===
|
|
34871
|
-
if (this.tempMainArrowNode && this.state ===
|
|
35146
|
+
if (!this.tempMainArrowNode && this.state === WEAVE_ARROW_TOOL_STATE.ADDING) this.handleAdding();
|
|
35147
|
+
if (this.tempMainArrowNode && this.state === WEAVE_ARROW_TOOL_STATE.ADDING) this.state = WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE;
|
|
34872
35148
|
});
|
|
34873
35149
|
stage.on("pointermove", () => {
|
|
34874
|
-
if (this.state ===
|
|
35150
|
+
if (this.state === WEAVE_ARROW_TOOL_STATE.IDLE) return;
|
|
34875
35151
|
this.setCursor();
|
|
34876
|
-
if (this.pointers.size === 2 && this.instance.getActiveAction() ===
|
|
34877
|
-
this.state =
|
|
35152
|
+
if (this.pointers.size === 2 && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
|
|
35153
|
+
this.state = WEAVE_ARROW_TOOL_STATE.ADDING;
|
|
34878
35154
|
return;
|
|
34879
35155
|
}
|
|
34880
|
-
if (this.state ===
|
|
35156
|
+
if (this.state === WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) this.handleMovement();
|
|
34881
35157
|
});
|
|
34882
35158
|
stage.on("pointerup", (e) => {
|
|
34883
35159
|
this.pointers.delete(e.evt.pointerId);
|
|
34884
|
-
if (this.state ===
|
|
35160
|
+
if (this.state === WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) this.handleSettingSize();
|
|
34885
35161
|
});
|
|
34886
35162
|
this.initialized = true;
|
|
34887
35163
|
}
|
|
@@ -34895,7 +35171,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34895
35171
|
this.tempPoint = void 0;
|
|
34896
35172
|
this.tempNextPoint = void 0;
|
|
34897
35173
|
this.clickPoint = null;
|
|
34898
|
-
this.setState(
|
|
35174
|
+
this.setState(WEAVE_ARROW_TOOL_STATE.ADDING);
|
|
34899
35175
|
}
|
|
34900
35176
|
handleAdding() {
|
|
34901
35177
|
const stage = this.instance.getStage();
|
|
@@ -34946,7 +35222,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34946
35222
|
this.measureContainer?.add(this.tempNextPoint);
|
|
34947
35223
|
this.tempPoint.moveToTop();
|
|
34948
35224
|
this.tempNextPoint.moveToTop();
|
|
34949
|
-
this.setState(
|
|
35225
|
+
this.setState(WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE);
|
|
34950
35226
|
}
|
|
34951
35227
|
}
|
|
34952
35228
|
handleSettingSize() {
|
|
@@ -34973,11 +35249,11 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34973
35249
|
y: mousePoint.y,
|
|
34974
35250
|
points: [0, 0]
|
|
34975
35251
|
});
|
|
34976
|
-
this.setState(
|
|
35252
|
+
this.setState(WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE);
|
|
34977
35253
|
}
|
|
34978
35254
|
}
|
|
34979
35255
|
handleMovement() {
|
|
34980
|
-
if (this.state !==
|
|
35256
|
+
if (this.state !== WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) return;
|
|
34981
35257
|
if (this.arrowId && this.tempArrowNode && this.measureContainer && this.tempNextPoint) {
|
|
34982
35258
|
const { mousePoint } = this.instance.getMousePointerRelativeToContainer(this.measureContainer);
|
|
34983
35259
|
this.tempArrowNode.setAttrs({
|
|
@@ -35044,7 +35320,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
35044
35320
|
this.container = void 0;
|
|
35045
35321
|
this.measureContainer = void 0;
|
|
35046
35322
|
this.clickPoint = null;
|
|
35047
|
-
this.setState(
|
|
35323
|
+
this.setState(WEAVE_ARROW_TOOL_STATE.IDLE);
|
|
35048
35324
|
}
|
|
35049
35325
|
setCursor() {
|
|
35050
35326
|
const stage = this.instance.getStage();
|
|
@@ -35088,13 +35364,15 @@ const WEAVE_STROKE_TOOL_DEFAULT_CONFIG = { snapAngles: {
|
|
|
35088
35364
|
var WeaveStrokeToolAction = class extends WeaveAction {
|
|
35089
35365
|
initialized = false;
|
|
35090
35366
|
initialCursor = null;
|
|
35091
|
-
snappedAngle = null;
|
|
35092
35367
|
shiftPressed = false;
|
|
35093
35368
|
onPropsChange = void 0;
|
|
35094
35369
|
onInit = void 0;
|
|
35095
35370
|
constructor(params) {
|
|
35096
35371
|
super();
|
|
35097
35372
|
this.config = mergeExceptArrays(WEAVE_STROKE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
|
|
35373
|
+
this.initialize();
|
|
35374
|
+
}
|
|
35375
|
+
initialize() {
|
|
35098
35376
|
this.pointers = new Map();
|
|
35099
35377
|
this.initialized = false;
|
|
35100
35378
|
this.state = WEAVE_STROKE_TOOL_STATE.IDLE;
|
|
@@ -35103,7 +35381,6 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35103
35381
|
this.tempLineId = null;
|
|
35104
35382
|
this.tempLineNode = null;
|
|
35105
35383
|
this.container = void 0;
|
|
35106
|
-
this.snappedAngle = null;
|
|
35107
35384
|
this.measureContainer = void 0;
|
|
35108
35385
|
this.clickPoint = null;
|
|
35109
35386
|
this.snapper = new GreedySnapper({
|
|
@@ -35116,6 +35393,9 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35116
35393
|
getName() {
|
|
35117
35394
|
return WEAVE_STROKE_TOOL_ACTION_NAME;
|
|
35118
35395
|
}
|
|
35396
|
+
getNames() {
|
|
35397
|
+
return [WEAVE_STROKE_TOOL_ACTION_NAME, ...WEAVE_STROKE_TOOL_ACTION_NAME_ALIASES];
|
|
35398
|
+
}
|
|
35119
35399
|
hasAliases() {
|
|
35120
35400
|
return true;
|
|
35121
35401
|
}
|
|
@@ -35134,32 +35414,26 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35134
35414
|
setupEvents() {
|
|
35135
35415
|
const stage = this.instance.getStage();
|
|
35136
35416
|
window.addEventListener("keydown", (e) => {
|
|
35137
|
-
if (e.code === "Enter" && this.instance.getActiveAction()
|
|
35417
|
+
if (e.code === "Enter" && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
|
|
35138
35418
|
this.cancelAction();
|
|
35139
35419
|
return;
|
|
35140
35420
|
}
|
|
35141
|
-
if (e.code === "Escape" && this.instance.getActiveAction()
|
|
35421
|
+
if (e.code === "Escape" && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
|
|
35142
35422
|
this.cancelAction();
|
|
35143
35423
|
return;
|
|
35144
35424
|
}
|
|
35145
|
-
if (e.key === "Shift" && this.instance.getActiveAction()
|
|
35146
|
-
|
|
35147
|
-
this.shiftPressed = true;
|
|
35148
|
-
}
|
|
35149
|
-
});
|
|
35425
|
+
if (e.key === "Shift" && this.getNames().includes(this.instance.getActiveAction() ?? "")) this.shiftPressed = true;
|
|
35426
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35150
35427
|
window.addEventListener("keyup", (e) => {
|
|
35151
|
-
if (e.key === "Shift" && this.instance.getActiveAction()
|
|
35152
|
-
|
|
35153
|
-
this.shiftPressed = false;
|
|
35154
|
-
}
|
|
35155
|
-
});
|
|
35428
|
+
if (e.key === "Shift" && this.getNames().includes(this.instance.getActiveAction() ?? "")) this.shiftPressed = false;
|
|
35429
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35156
35430
|
stage.on("pointerdown", (e) => {
|
|
35157
35431
|
this.setTapStart(e);
|
|
35158
35432
|
this.pointers.set(e.evt.pointerId, {
|
|
35159
35433
|
x: e.evt.clientX,
|
|
35160
35434
|
y: e.evt.clientY
|
|
35161
35435
|
});
|
|
35162
|
-
if (this.pointers.size === 2 && this.instance.getActiveAction()
|
|
35436
|
+
if (this.pointers.size === 2 && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
|
|
35163
35437
|
this.state = WEAVE_STROKE_TOOL_STATE.ADDING;
|
|
35164
35438
|
return;
|
|
35165
35439
|
}
|
|
@@ -35169,7 +35443,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35169
35443
|
stage.on("pointermove", () => {
|
|
35170
35444
|
if (this.state === WEAVE_STROKE_TOOL_STATE.IDLE) return;
|
|
35171
35445
|
this.setCursor();
|
|
35172
|
-
if (this.pointers.size === 2 && this.instance.getActiveAction()
|
|
35446
|
+
if (this.pointers.size === 2 && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
|
|
35173
35447
|
this.state = WEAVE_STROKE_TOOL_STATE.ADDING;
|
|
35174
35448
|
return;
|
|
35175
35449
|
}
|
|
@@ -35187,7 +35461,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35187
35461
|
addLine() {
|
|
35188
35462
|
this.setCursor();
|
|
35189
35463
|
this.setFocusStage();
|
|
35190
|
-
this.instance.emitEvent("onAddingStroke", { actionName: this.instance.getActiveAction() ??
|
|
35464
|
+
this.instance.emitEvent("onAddingStroke", { actionName: this.instance.getActiveAction() ?? "not-defined" });
|
|
35191
35465
|
this.shiftPressed = false;
|
|
35192
35466
|
this.clickPoint = null;
|
|
35193
35467
|
this.setState(WEAVE_STROKE_TOOL_STATE.ADDING);
|
|
@@ -35295,7 +35569,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35295
35569
|
});
|
|
35296
35570
|
delete finalLine.props.dragBoundFunc;
|
|
35297
35571
|
this.instance.addNode(finalLine, this.container?.getAttrs().id);
|
|
35298
|
-
this.instance.emitEvent("onAddedStroke", { actionName: this.instance.getActiveAction() ??
|
|
35572
|
+
this.instance.emitEvent("onAddedStroke", { actionName: this.instance.getActiveAction() ?? "not-defined" });
|
|
35299
35573
|
nodeCreated = true;
|
|
35300
35574
|
}
|
|
35301
35575
|
}
|
|
@@ -35345,6 +35619,9 @@ var WeaveRegularPolygonToolAction = class extends WeaveAction {
|
|
|
35345
35619
|
onInit = void 0;
|
|
35346
35620
|
constructor() {
|
|
35347
35621
|
super();
|
|
35622
|
+
this.initialize();
|
|
35623
|
+
}
|
|
35624
|
+
initialize() {
|
|
35348
35625
|
this.pointers = new Map();
|
|
35349
35626
|
this.initialized = false;
|
|
35350
35627
|
this.state = REGULAR_POLYGON_TOOL_STATE.IDLE;
|
|
@@ -35379,7 +35656,7 @@ var WeaveRegularPolygonToolAction = class extends WeaveAction {
|
|
|
35379
35656
|
this.cancelAction();
|
|
35380
35657
|
return;
|
|
35381
35658
|
}
|
|
35382
|
-
});
|
|
35659
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35383
35660
|
stage.on("pointerdown", (e) => {
|
|
35384
35661
|
this.setTapStart(e);
|
|
35385
35662
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -35553,6 +35830,9 @@ var WeaveFrameToolAction = class extends WeaveAction {
|
|
|
35553
35830
|
onInit = void 0;
|
|
35554
35831
|
constructor() {
|
|
35555
35832
|
super();
|
|
35833
|
+
this.initialize();
|
|
35834
|
+
}
|
|
35835
|
+
initialize() {
|
|
35556
35836
|
this.initialized = false;
|
|
35557
35837
|
this.state = FRAME_TOOL_STATE.IDLE;
|
|
35558
35838
|
this.frameId = null;
|
|
@@ -35580,7 +35860,7 @@ var WeaveFrameToolAction = class extends WeaveAction {
|
|
|
35580
35860
|
this.cancelAction();
|
|
35581
35861
|
return;
|
|
35582
35862
|
}
|
|
35583
|
-
});
|
|
35863
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35584
35864
|
stage.on("pointermove", () => {
|
|
35585
35865
|
if (this.state === FRAME_TOOL_STATE.IDLE) return;
|
|
35586
35866
|
this.setCursor();
|
|
@@ -35682,6 +35962,10 @@ var WeaveExportStageToolAction = class extends WeaveAction {
|
|
|
35682
35962
|
};
|
|
35683
35963
|
onPropsChange = void 0;
|
|
35684
35964
|
onInit = void 0;
|
|
35965
|
+
initialize = void 0;
|
|
35966
|
+
constructor() {
|
|
35967
|
+
super();
|
|
35968
|
+
}
|
|
35685
35969
|
getName() {
|
|
35686
35970
|
return EXPORT_STAGE_TOOL_ACTION_NAME;
|
|
35687
35971
|
}
|
|
@@ -35729,6 +36013,10 @@ var WeaveExportNodesToolAction = class extends WeaveAction {
|
|
|
35729
36013
|
};
|
|
35730
36014
|
onPropsChange = void 0;
|
|
35731
36015
|
onInit = void 0;
|
|
36016
|
+
initialize = void 0;
|
|
36017
|
+
constructor() {
|
|
36018
|
+
super();
|
|
36019
|
+
}
|
|
35732
36020
|
getName() {
|
|
35733
36021
|
return EXPORT_NODES_TOOL_ACTION_NAME;
|
|
35734
36022
|
}
|
|
@@ -35781,6 +36069,9 @@ var WeaveAlignNodesToolAction = class extends WeaveAction {
|
|
|
35781
36069
|
onInit = void 0;
|
|
35782
36070
|
constructor() {
|
|
35783
36071
|
super();
|
|
36072
|
+
this.initialize();
|
|
36073
|
+
}
|
|
36074
|
+
initialize() {
|
|
35784
36075
|
this.initialized = false;
|
|
35785
36076
|
this.state = ALIGN_NODES_TOOL_STATE.IDLE;
|
|
35786
36077
|
}
|
|
@@ -36030,6 +36321,9 @@ var WeaveCommentToolAction = class extends WeaveAction {
|
|
|
36030
36321
|
super();
|
|
36031
36322
|
const { config } = params ?? {};
|
|
36032
36323
|
this.config = mergeExceptArrays(WEAVE_COMMENT_TOOL_DEFAULT_CONFIG, config);
|
|
36324
|
+
this.initialize();
|
|
36325
|
+
}
|
|
36326
|
+
initialize() {
|
|
36033
36327
|
this.pointers = new Map();
|
|
36034
36328
|
this.initialized = false;
|
|
36035
36329
|
this.state = WEAVE_COMMENT_TOOL_STATE.IDLE;
|
|
@@ -36107,7 +36401,7 @@ var WeaveCommentToolAction = class extends WeaveAction {
|
|
|
36107
36401
|
return;
|
|
36108
36402
|
}
|
|
36109
36403
|
if (e.code === "Escape" && this.state === WEAVE_COMMENT_TOOL_STATE.CREATING_COMMENT) this.setState(WEAVE_COMMENT_TOOL_STATE.ADDING);
|
|
36110
|
-
});
|
|
36404
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
36111
36405
|
stage.on("pointermove", (e) => {
|
|
36112
36406
|
if (this.state === WEAVE_COMMENT_TOOL_STATE.IDLE) return;
|
|
36113
36407
|
if (commentNodeHandler?.isCommentViewing()) {
|
|
@@ -36258,6 +36552,9 @@ var WeaveVideoToolAction = class extends WeaveAction {
|
|
|
36258
36552
|
update = void 0;
|
|
36259
36553
|
constructor() {
|
|
36260
36554
|
super();
|
|
36555
|
+
this.initialize();
|
|
36556
|
+
}
|
|
36557
|
+
initialize() {
|
|
36261
36558
|
this.pointers = new Map();
|
|
36262
36559
|
this.initialized = false;
|
|
36263
36560
|
this.state = VIDEO_TOOL_STATE.IDLE;
|
|
@@ -36304,7 +36601,7 @@ var WeaveVideoToolAction = class extends WeaveAction {
|
|
|
36304
36601
|
this.cancelAction();
|
|
36305
36602
|
return;
|
|
36306
36603
|
}
|
|
36307
|
-
});
|
|
36604
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
36308
36605
|
stage.on("pointerdown", (e) => {
|
|
36309
36606
|
this.setTapStart(e);
|
|
36310
36607
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -36437,6 +36734,9 @@ var WeaveMeasureToolAction = class extends WeaveAction {
|
|
|
36437
36734
|
constructor(params) {
|
|
36438
36735
|
super();
|
|
36439
36736
|
this.config = mergeExceptArrays(WEAVE_MEASURE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
|
|
36737
|
+
this.initialize();
|
|
36738
|
+
}
|
|
36739
|
+
initialize() {
|
|
36440
36740
|
this.initialized = false;
|
|
36441
36741
|
this.state = MEASURE_TOOL_STATE.IDLE;
|
|
36442
36742
|
this.measureId = null;
|
|
@@ -36463,7 +36763,7 @@ var WeaveMeasureToolAction = class extends WeaveAction {
|
|
|
36463
36763
|
const stage = this.instance.getStage();
|
|
36464
36764
|
window.addEventListener("keydown", (e) => {
|
|
36465
36765
|
if (e.code === "Escape" && this.instance.getActiveAction() === MEASURE_TOOL_ACTION_NAME) this.cancelAction();
|
|
36466
|
-
});
|
|
36766
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
36467
36767
|
stage.on("pointermove", () => {
|
|
36468
36768
|
if (this.state === MEASURE_TOOL_STATE.IDLE) return;
|
|
36469
36769
|
if (this.state === MEASURE_TOOL_STATE.SET_TO) {
|
|
@@ -36733,6 +37033,9 @@ var WeaveConnectorToolAction = class extends WeaveAction {
|
|
|
36733
37033
|
constructor(params) {
|
|
36734
37034
|
super();
|
|
36735
37035
|
this.config = mergeExceptArrays(CONNECTOR_TOOL_DEFAULT_CONFIG, params?.config);
|
|
37036
|
+
this.initialize();
|
|
37037
|
+
}
|
|
37038
|
+
initialize() {
|
|
36736
37039
|
this.pointers = new Map();
|
|
36737
37040
|
this.initialized = false;
|
|
36738
37041
|
this.tempLineNode = null;
|
|
@@ -36771,7 +37074,7 @@ var WeaveConnectorToolAction = class extends WeaveAction {
|
|
|
36771
37074
|
return;
|
|
36772
37075
|
}
|
|
36773
37076
|
if (e.code === "Escape" && this.instance.getActiveAction() === CONNECTOR_TOOL_ACTION_NAME) this.cancelAction();
|
|
36774
|
-
});
|
|
37077
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
36775
37078
|
let nodeHovered = void 0;
|
|
36776
37079
|
stage.on("pointermove", () => {
|
|
36777
37080
|
if (!(this.state === CONNECTOR_TOOL_STATE.SELECTING_INITIAL || this.state === CONNECTOR_TOOL_STATE.SELECTING_FINAL)) return;
|
|
@@ -37086,16 +37389,9 @@ var WeaveConnectorToolAction = class extends WeaveAction {
|
|
|
37086
37389
|
//#endregion
|
|
37087
37390
|
//#region src/plugins/stage-grid/stage-grid.ts
|
|
37088
37391
|
var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
37089
|
-
actStageZoomX = 1;
|
|
37090
|
-
actStageZoomY = 1;
|
|
37091
|
-
actStagePosX = 0;
|
|
37092
|
-
actStagePosY = 0;
|
|
37093
37392
|
constructor(params) {
|
|
37094
37393
|
super();
|
|
37095
37394
|
const { config } = params ?? {};
|
|
37096
|
-
this.moveToolActive = false;
|
|
37097
|
-
this.isMouseMiddleButtonPressed = false;
|
|
37098
|
-
this.isSpaceKeyPressed = false;
|
|
37099
37395
|
this.config = {
|
|
37100
37396
|
type: WEAVE_GRID_DEFAULT_TYPE,
|
|
37101
37397
|
gridColor: WEAVE_GRID_DEFAULT_COLOR,
|
|
@@ -37104,7 +37400,17 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37104
37400
|
gridDotMaxDotsPerAxis: WEAVE_GRID_DEFAULT_DOT_MAX_DOTS_PER_AXIS,
|
|
37105
37401
|
...config
|
|
37106
37402
|
};
|
|
37403
|
+
this.initialize();
|
|
37404
|
+
}
|
|
37405
|
+
initialize() {
|
|
37406
|
+
this.moveToolActive = false;
|
|
37407
|
+
this.isMouseMiddleButtonPressed = false;
|
|
37408
|
+
this.isSpaceKeyPressed = false;
|
|
37107
37409
|
this.forceStageChange = false;
|
|
37410
|
+
this.actStagePosX = 0;
|
|
37411
|
+
this.actStagePosY = 0;
|
|
37412
|
+
this.actStageZoomX = 1;
|
|
37413
|
+
this.actStageZoomY = 1;
|
|
37108
37414
|
}
|
|
37109
37415
|
getName() {
|
|
37110
37416
|
return WEAVE_STAGE_GRID_PLUGIN_KEY;
|
|
@@ -37129,10 +37435,10 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37129
37435
|
const stage = this.instance.getStage();
|
|
37130
37436
|
window.addEventListener("keydown", (e) => {
|
|
37131
37437
|
if (e.code === "Space") this.isSpaceKeyPressed = true;
|
|
37132
|
-
});
|
|
37438
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37133
37439
|
window.addEventListener("keyup", (e) => {
|
|
37134
37440
|
if (e.code === "Space") this.isSpaceKeyPressed = false;
|
|
37135
|
-
});
|
|
37441
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37136
37442
|
this.instance.addEventListener("onStageMove", () => {
|
|
37137
37443
|
this.onRender();
|
|
37138
37444
|
});
|
|
@@ -37366,15 +37672,14 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37366
37672
|
//#endregion
|
|
37367
37673
|
//#region src/plugins/stage-panning/stage-panning.ts
|
|
37368
37674
|
var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
37369
|
-
panning = false;
|
|
37370
|
-
currentPointer = null;
|
|
37371
|
-
stageScrollInterval = void 0;
|
|
37372
|
-
panEdgeTargets = {};
|
|
37373
37675
|
getLayerName = void 0;
|
|
37374
37676
|
initLayer = void 0;
|
|
37375
37677
|
constructor(params) {
|
|
37376
37678
|
super();
|
|
37377
37679
|
this.config = mergeExceptArrays(WEAVE_STAGE_PANNING_DEFAULT_CONFIG, params?.config ?? {});
|
|
37680
|
+
this.initialize();
|
|
37681
|
+
}
|
|
37682
|
+
initialize() {
|
|
37378
37683
|
this.pointers = new Map();
|
|
37379
37684
|
this.panning = false;
|
|
37380
37685
|
this.isDragging = false;
|
|
@@ -37386,6 +37691,9 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37386
37691
|
this.isCtrlOrMetaPressed = false;
|
|
37387
37692
|
this.isSpaceKeyPressed = false;
|
|
37388
37693
|
this.previousPointer = null;
|
|
37694
|
+
this.currentPointer = null;
|
|
37695
|
+
this.stageScrollInterval = void 0;
|
|
37696
|
+
this.panEdgeTargets = {};
|
|
37389
37697
|
}
|
|
37390
37698
|
getName() {
|
|
37391
37699
|
return WEAVE_STAGE_PANNING_KEY;
|
|
@@ -37419,7 +37727,7 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37419
37727
|
this.isSpaceKeyPressed = true;
|
|
37420
37728
|
this.setCursor();
|
|
37421
37729
|
}
|
|
37422
|
-
});
|
|
37730
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37423
37731
|
window.addEventListener("keyup", (e) => {
|
|
37424
37732
|
if (e.key === "Meta" || e.key === "Control") this.isCtrlOrMetaPressed = false;
|
|
37425
37733
|
if (e.code === "Space") {
|
|
@@ -37430,7 +37738,7 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37430
37738
|
this.isSpaceKeyPressed = false;
|
|
37431
37739
|
this.disableMove();
|
|
37432
37740
|
}
|
|
37433
|
-
});
|
|
37741
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37434
37742
|
let lastPos = null;
|
|
37435
37743
|
stage.on("pointerdown", (e) => {
|
|
37436
37744
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -37503,7 +37811,10 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37503
37811
|
this.instance.emitEvent("onStageMove");
|
|
37504
37812
|
};
|
|
37505
37813
|
const handleWheelThrottled = (0, import_lodash.throttle)(handleWheel, WEAVE_STAGE_PANNING_THROTTLE_MS);
|
|
37506
|
-
window.addEventListener("wheel", handleWheelThrottled, {
|
|
37814
|
+
window.addEventListener("wheel", handleWheelThrottled, {
|
|
37815
|
+
passive: true,
|
|
37816
|
+
signal: this.instance.getEventsController()?.signal
|
|
37817
|
+
});
|
|
37507
37818
|
stage.on("dragstart", (e) => {
|
|
37508
37819
|
const duration = 1e3 / 60;
|
|
37509
37820
|
if (this.panEdgeTargets[e.target.getAttrs().id ?? ""] !== void 0) return;
|
|
@@ -37561,7 +37872,10 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37561
37872
|
stage.container().style.setProperty("-webkit-user-drag", "none");
|
|
37562
37873
|
stage.getContent().addEventListener("touchmove", function(e) {
|
|
37563
37874
|
e.preventDefault();
|
|
37564
|
-
}, {
|
|
37875
|
+
}, {
|
|
37876
|
+
passive: false,
|
|
37877
|
+
signal: this.instance.getEventsController()?.signal
|
|
37878
|
+
});
|
|
37565
37879
|
}
|
|
37566
37880
|
isPanning() {
|
|
37567
37881
|
return this.panning;
|
|
@@ -37639,6 +37953,9 @@ var WeaveStageMinimapPlugin = class extends WeavePlugin {
|
|
|
37639
37953
|
constructor(params) {
|
|
37640
37954
|
super();
|
|
37641
37955
|
this.config = mergeExceptArrays(STAGE_MINIMAP_DEFAULT_CONFIG, params.config);
|
|
37956
|
+
this.initialize();
|
|
37957
|
+
}
|
|
37958
|
+
initialize() {
|
|
37642
37959
|
this.initialized = false;
|
|
37643
37960
|
}
|
|
37644
37961
|
getName() {
|
|
@@ -37816,6 +38133,7 @@ const WEAVE_STAGE_RESIZE_KEY = "stageResize";
|
|
|
37816
38133
|
var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
37817
38134
|
getLayerName = void 0;
|
|
37818
38135
|
initLayer = void 0;
|
|
38136
|
+
initialize = void 0;
|
|
37819
38137
|
getName() {
|
|
37820
38138
|
return WEAVE_STAGE_RESIZE_KEY;
|
|
37821
38139
|
}
|
|
@@ -37835,6 +38153,10 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
|
37835
38153
|
const pluginInstance = plugins[pluginId];
|
|
37836
38154
|
pluginInstance.onRender?.();
|
|
37837
38155
|
}
|
|
38156
|
+
this.instance.emitEvent("onStageResize", {
|
|
38157
|
+
width: stage.width(),
|
|
38158
|
+
height: stage.height()
|
|
38159
|
+
});
|
|
37838
38160
|
}
|
|
37839
38161
|
}
|
|
37840
38162
|
onInit() {
|
|
@@ -37843,7 +38165,7 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
|
37843
38165
|
}, DEFAULT_THROTTLE_MS);
|
|
37844
38166
|
window.addEventListener("resize", () => {
|
|
37845
38167
|
throttledResize();
|
|
37846
|
-
});
|
|
38168
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37847
38169
|
const resizeObserver = new ResizeObserver(() => {
|
|
37848
38170
|
throttledResize();
|
|
37849
38171
|
});
|
|
@@ -37861,10 +38183,12 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
|
37861
38183
|
//#endregion
|
|
37862
38184
|
//#region src/plugins/nodes-multi-selection-feedback/nodes-multi-selection-feedback.ts
|
|
37863
38185
|
var WeaveNodesMultiSelectionFeedbackPlugin = class extends WeavePlugin {
|
|
37864
|
-
selectedHalos = {};
|
|
37865
38186
|
constructor(params) {
|
|
37866
38187
|
super();
|
|
37867
38188
|
this.config = mergeExceptArrays(WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_DEFAULT_CONFIG, params?.config ?? {});
|
|
38189
|
+
this.initialize();
|
|
38190
|
+
}
|
|
38191
|
+
initialize() {
|
|
37868
38192
|
this.selectedHalos = {};
|
|
37869
38193
|
}
|
|
37870
38194
|
getName() {
|
|
@@ -38030,12 +38354,14 @@ var WeaveNodesMultiSelectionFeedbackPlugin = class extends WeavePlugin {
|
|
|
38030
38354
|
//#endregion
|
|
38031
38355
|
//#region src/plugins/connected-users/connected-users.ts
|
|
38032
38356
|
var WeaveConnectedUsersPlugin = class extends WeavePlugin {
|
|
38033
|
-
connectedUsers = {};
|
|
38034
38357
|
getLayerName = void 0;
|
|
38035
38358
|
constructor(params) {
|
|
38036
38359
|
super();
|
|
38037
38360
|
const { config } = params ?? {};
|
|
38038
38361
|
this.config = config;
|
|
38362
|
+
this.initialize();
|
|
38363
|
+
}
|
|
38364
|
+
initialize() {
|
|
38039
38365
|
this.connectedUsers = {};
|
|
38040
38366
|
}
|
|
38041
38367
|
getName() {
|
|
@@ -38082,6 +38408,9 @@ var WeaveUsersSelectionPlugin = class extends WeavePlugin {
|
|
|
38082
38408
|
this.config = config;
|
|
38083
38409
|
this.config.getUser = memoize(this.config.getUser);
|
|
38084
38410
|
this.config.getUserColor = memoize(this.config.getUserColor);
|
|
38411
|
+
this.initialize();
|
|
38412
|
+
}
|
|
38413
|
+
initialize() {
|
|
38085
38414
|
this.usersSelection = {};
|
|
38086
38415
|
}
|
|
38087
38416
|
getName() {
|
|
@@ -38274,6 +38603,9 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
38274
38603
|
this.config.getUser = memoize(this.config.getUser);
|
|
38275
38604
|
this.config.getUserBackgroundColor = memoize(this.config.getUserBackgroundColor);
|
|
38276
38605
|
this.config.getUserForegroundColor = memoize(this.config.getUserForegroundColor);
|
|
38606
|
+
this.initialize();
|
|
38607
|
+
}
|
|
38608
|
+
initialize() {
|
|
38277
38609
|
this.usersPointers = {};
|
|
38278
38610
|
this.usersOperations = {};
|
|
38279
38611
|
}
|
|
@@ -38484,6 +38816,9 @@ var WeaveUsersPresencePlugin = class extends WeavePlugin {
|
|
|
38484
38816
|
super();
|
|
38485
38817
|
const { config } = params;
|
|
38486
38818
|
this.config = mergeExceptArrays(WEAVE_USERS_PRESENCE_CONFIG_DEFAULT_PROPS, config);
|
|
38819
|
+
this.initialize();
|
|
38820
|
+
}
|
|
38821
|
+
initialize() {
|
|
38487
38822
|
this.userPresence = {};
|
|
38488
38823
|
}
|
|
38489
38824
|
getName() {
|
|
@@ -38559,6 +38894,9 @@ var WeaveStageDropAreaPlugin = class extends WeavePlugin {
|
|
|
38559
38894
|
initLayer = void 0;
|
|
38560
38895
|
constructor() {
|
|
38561
38896
|
super();
|
|
38897
|
+
this.initialize();
|
|
38898
|
+
}
|
|
38899
|
+
initialize() {
|
|
38562
38900
|
this.enabled = true;
|
|
38563
38901
|
}
|
|
38564
38902
|
getName() {
|
|
@@ -38572,14 +38910,20 @@ var WeaveStageDropAreaPlugin = class extends WeavePlugin {
|
|
|
38572
38910
|
stage.container().addEventListener("dragover", (e) => {
|
|
38573
38911
|
e.preventDefault();
|
|
38574
38912
|
e.stopPropagation();
|
|
38575
|
-
});
|
|
38913
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
38576
38914
|
stage.container().addEventListener("drop", (e) => {
|
|
38577
38915
|
e.preventDefault();
|
|
38578
38916
|
e.stopPropagation();
|
|
38579
38917
|
this.instance.emitEvent("onStageDrop", e);
|
|
38918
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
38919
|
+
window.addEventListener("dragover", (e) => e.preventDefault(), {
|
|
38920
|
+
signal: this.instance.getEventsController()?.signal,
|
|
38921
|
+
passive: false
|
|
38922
|
+
});
|
|
38923
|
+
window.addEventListener("drop", (e) => e.preventDefault(), {
|
|
38924
|
+
signal: this.instance.getEventsController()?.signal,
|
|
38925
|
+
passive: false
|
|
38580
38926
|
});
|
|
38581
|
-
window.addEventListener("dragover", (e) => e.preventDefault(), { passive: false });
|
|
38582
|
-
window.addEventListener("drop", (e) => e.preventDefault(), { passive: false });
|
|
38583
38927
|
}
|
|
38584
38928
|
enable() {
|
|
38585
38929
|
this.enabled = true;
|
|
@@ -38598,6 +38942,9 @@ var WeaveNodesEdgeSnappingPlugin = class extends WeavePlugin {
|
|
|
38598
38942
|
this.guideLineConfig = config?.guideLine ?? GUIDE_LINE_DEFAULT_CONFIG;
|
|
38599
38943
|
this.dragSnappingThreshold = config?.dragSnappingThreshold ?? GUIDE_LINE_DRAG_SNAPPING_THRESHOLD;
|
|
38600
38944
|
this.transformSnappingThreshold = config?.transformSnappingThreshold ?? GUIDE_LINE_TRANSFORM_SNAPPING_THRESHOLD;
|
|
38945
|
+
this.initialize();
|
|
38946
|
+
}
|
|
38947
|
+
initialize() {
|
|
38601
38948
|
this.enabled = true;
|
|
38602
38949
|
}
|
|
38603
38950
|
getName() {
|
|
@@ -38974,6 +39321,9 @@ var WeaveNodesDistanceSnappingPlugin = class extends WeavePlugin {
|
|
|
38974
39321
|
this.enterSnappingTolerance = config?.enterSnappingTolerance ?? GUIDE_ENTER_SNAPPING_TOLERANCE;
|
|
38975
39322
|
this.exitSnappingTolerance = config?.exitSnappingTolerance ?? GUIDE_EXIT_SNAPPING_TOLERANCE;
|
|
38976
39323
|
this.uiConfig = mergeExceptArrays(GUIDE_DISTANCE_LINE_DEFAULT_CONFIG, config?.ui);
|
|
39324
|
+
this.initialize();
|
|
39325
|
+
}
|
|
39326
|
+
initialize() {
|
|
38977
39327
|
this.enabled = true;
|
|
38978
39328
|
}
|
|
38979
39329
|
getName() {
|
|
@@ -39620,12 +39970,14 @@ var WeaveNodesDistanceSnappingPlugin = class extends WeavePlugin {
|
|
|
39620
39970
|
//#endregion
|
|
39621
39971
|
//#region src/plugins/comments-renderer/comments-renderer.ts
|
|
39622
39972
|
var WeaveCommentsRendererPlugin = class extends WeavePlugin {
|
|
39623
|
-
comments = [];
|
|
39624
39973
|
getLayerName = void 0;
|
|
39625
39974
|
constructor(params) {
|
|
39626
39975
|
super();
|
|
39627
39976
|
const { config } = params ?? {};
|
|
39628
39977
|
this.config = config;
|
|
39978
|
+
this.initialize();
|
|
39979
|
+
}
|
|
39980
|
+
initialize() {
|
|
39629
39981
|
this.comments = [];
|
|
39630
39982
|
}
|
|
39631
39983
|
getName() {
|
|
@@ -39716,6 +40068,7 @@ const WEAVE_STAGE_KEYBOARD_MOVE_DEFAULT_CONFIG = { movementDelta: 5 };
|
|
|
39716
40068
|
var WeaveStageKeyboardMovePlugin = class extends WeavePlugin {
|
|
39717
40069
|
getLayerName = void 0;
|
|
39718
40070
|
initLayer = void 0;
|
|
40071
|
+
initialize = void 0;
|
|
39719
40072
|
constructor(params) {
|
|
39720
40073
|
super();
|
|
39721
40074
|
this.config = mergeExceptArrays(WEAVE_STAGE_KEYBOARD_MOVE_DEFAULT_CONFIG, params?.config ?? {});
|
|
@@ -39754,7 +40107,7 @@ var WeaveStageKeyboardMovePlugin = class extends WeavePlugin {
|
|
|
39754
40107
|
if (e.code === "ArrowLeft" && e.shiftKey) this.handleNodesMovement("left");
|
|
39755
40108
|
if (e.code === "ArrowRight" && e.shiftKey) this.handleNodesMovement("right");
|
|
39756
40109
|
if (e.code === "ArrowDown" && e.shiftKey) this.handleNodesMovement("down");
|
|
39757
|
-
});
|
|
40110
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
39758
40111
|
}
|
|
39759
40112
|
enable() {
|
|
39760
40113
|
this.enabled = true;
|
|
@@ -39776,4 +40129,4 @@ const setupCanvasBackend = async () => {
|
|
|
39776
40129
|
};
|
|
39777
40130
|
|
|
39778
40131
|
//#endregion
|
|
39779
|
-
export { ALIGN_NODES_ALIGN_TO, ALIGN_NODES_TOOL_ACTION_NAME, ALIGN_NODES_TOOL_STATE,
|
|
40132
|
+
export { ALIGN_NODES_ALIGN_TO, ALIGN_NODES_TOOL_ACTION_NAME, ALIGN_NODES_TOOL_STATE, BRUSH_TOOL_ACTION_NAME, BRUSH_TOOL_DEFAULT_CONFIG, BRUSH_TOOL_STATE, CONNECTOR_TOOL_ACTION_NAME, CONNECTOR_TOOL_DEFAULT_CONFIG, CONNECTOR_TOOL_STATE, COPY_PASTE_NODES_PLUGIN_STATE, ELLIPSE_TOOL_ACTION_NAME, ELLIPSE_TOOL_STATE, ERASER_TOOL_ACTION_NAME, ERASER_TOOL_STATE, FRAME_TOOL_ACTION_NAME, FRAME_TOOL_STATE, GUIDE_DISTANCE_LINE_DEFAULT_CONFIG, GUIDE_ENTER_SNAPPING_TOLERANCE, GUIDE_EXIT_SNAPPING_TOLERANCE, GUIDE_HORIZONTAL_LINE_NAME, GUIDE_LINE_DEFAULT_CONFIG, GUIDE_LINE_DRAG_SNAPPING_THRESHOLD, GUIDE_LINE_NAME, GUIDE_LINE_TRANSFORM_SNAPPING_THRESHOLD, GUIDE_ORIENTATION, GUIDE_VERTICAL_LINE_NAME, LINE_TOOL_ACTION_NAME, LINE_TOOL_DEFAULT_CONFIG, LINE_TOOL_STATE, MEASURE_TOOL_ACTION_NAME, MEASURE_TOOL_STATE, MOVE_TOOL_ACTION_NAME, MOVE_TOOL_STATE, NODE_SNAP, NODE_SNAP_HORIZONTAL, NODE_SNAP_VERTICAL, PEN_TOOL_ACTION_NAME, PEN_TOOL_STATE, RECTANGLE_TOOL_ACTION_NAME, RECTANGLE_TOOL_STATE, REGULAR_POLYGON_TOOL_ACTION_NAME, REGULAR_POLYGON_TOOL_STATE, SELECTION_TOOL_ACTION_NAME, SELECTION_TOOL_STATE, STAGE_MINIMAP_DEFAULT_CONFIG, STAR_TOOL_ACTION_NAME, STAR_TOOL_STATE, TEXT_LAYOUT, TEXT_TOOL_ACTION_NAME, TEXT_TOOL_STATE, VIDEO_TOOL_ACTION_NAME, VIDEO_TOOL_STATE, WEAVE_ARROW_NODE_TYPE, WEAVE_ARROW_TOOL_ACTION_NAME, WEAVE_ARROW_TOOL_STATE, WEAVE_COMMENTS_RENDERER_KEY, WEAVE_COMMENTS_TOOL_LAYER_ID, WEAVE_COMMENT_CREATE_ACTION, WEAVE_COMMENT_NODE_ACTION, WEAVE_COMMENT_NODE_DEFAULTS, WEAVE_COMMENT_NODE_TYPE, WEAVE_COMMENT_STATUS, WEAVE_COMMENT_TOOL_ACTION_NAME, WEAVE_COMMENT_TOOL_DEFAULT_CONFIG, WEAVE_COMMENT_TOOL_STATE, WEAVE_COMMENT_VIEW_ACTION, WEAVE_CONNECTOR_NODE_ANCHOR_ORIGIN, WEAVE_CONNECTOR_NODE_DECORATOR_TYPE, WEAVE_CONNECTOR_NODE_DEFAULT_CONFIG, WEAVE_CONNECTOR_NODE_LINE_ORIGIN, WEAVE_CONNECTOR_NODE_LINE_TYPE, WEAVE_CONNECTOR_NODE_TYPE, WEAVE_COPY_PASTE_CONFIG_DEFAULT, WEAVE_COPY_PASTE_NODES_KEY, WEAVE_COPY_PASTE_PASTE_CATCHER_ID, WEAVE_COPY_PASTE_PASTE_MODES, WEAVE_DEFAULT_USER_INFO_FUNCTION, WEAVE_ELLIPSE_NODE_TYPE, WEAVE_FRAME_DEFAULT_BACKGROUND_COLOR, WEAVE_FRAME_NODE_DEFAULT_CONFIG, WEAVE_FRAME_NODE_DEFAULT_PROPS, WEAVE_FRAME_NODE_TYPE, WEAVE_GRID_DEFAULT_COLOR, WEAVE_GRID_DEFAULT_DOT_MAX_DOTS_PER_AXIS, WEAVE_GRID_DEFAULT_MAJOR_DOT_RATIO, WEAVE_GRID_DEFAULT_MAJOR_EVERY, WEAVE_GRID_DEFAULT_MAJOR_LINE_RATIO, WEAVE_GRID_DEFAULT_ORIGIN_COLOR, WEAVE_GRID_DEFAULT_RADIUS, WEAVE_GRID_DEFAULT_SIZE, WEAVE_GRID_DEFAULT_STROKE, WEAVE_GRID_DEFAULT_TYPE, WEAVE_GRID_LAYER_ID, WEAVE_GRID_TYPES, WEAVE_GROUP_NODE_TYPE, WEAVE_IMAGES_TOOL_ACTION_NAME, WEAVE_IMAGES_TOOL_DEFAULT_CONFIG, WEAVE_IMAGES_TOOL_STATE, WEAVE_IMAGES_TOOL_UPLOAD_TYPE, WEAVE_IMAGE_CROP_ANCHOR_POSITION, WEAVE_IMAGE_CROP_END_TYPE, WEAVE_IMAGE_DEFAULT_CONFIG, WEAVE_IMAGE_NODE_TYPE, WEAVE_IMAGE_TOOL_ACTION_NAME, WEAVE_IMAGE_TOOL_CONFIG_DEFAULT, WEAVE_IMAGE_TOOL_STATE, WEAVE_IMAGE_TOOL_UPLOAD_TYPE, WEAVE_LAYER_NODE_TYPE, WEAVE_LINE_NODE_DEFAULT_CONFIG, WEAVE_LINE_NODE_TYPE, WEAVE_MEASURE_NODE_DEFAULT_CONFIG, WEAVE_MEASURE_NODE_TYPE, WEAVE_MEASURE_TOOL_DEFAULT_CONFIG, WEAVE_NODES_DISTANCE_SNAPPING_PLUGIN_KEY, WEAVE_NODES_EDGE_SNAPPING_PLUGIN_KEY, WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_DEFAULT_CONFIG, WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_KEY, WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_LAYER_ID, WEAVE_NODES_SELECTION_DEFAULT_CONFIG, WEAVE_NODES_SELECTION_KEY, WEAVE_NODES_SELECTION_LAYER_ID, WEAVE_RECTANGLE_NODE_TYPE, WEAVE_REGULAR_POLYGON_NODE_TYPE, WEAVE_STAGE_DEFAULT_MODE, WEAVE_STAGE_DROP_AREA_KEY, WEAVE_STAGE_GRID_PLUGIN_KEY, WEAVE_STAGE_IMAGE_CROPPING_MODE, WEAVE_STAGE_KEYBOARD_MOVE_DEFAULT_CONFIG, WEAVE_STAGE_KEYBOARD_MOVE_KEY, WEAVE_STAGE_MINIMAP_KEY, WEAVE_STAGE_NODE_TYPE, WEAVE_STAGE_PANNING_DEFAULT_CONFIG, WEAVE_STAGE_PANNING_KEY, WEAVE_STAGE_PANNING_THROTTLE_MS, WEAVE_STAGE_TEXT_EDITION_MODE, WEAVE_STAGE_ZOOM_DEFAULT_CONFIG, WEAVE_STAGE_ZOOM_KEY, WEAVE_STAGE_ZOOM_TYPE, WEAVE_STAR_NODE_TYPE, WEAVE_STROKE_NODE_DEFAULT_CONFIG, WEAVE_STROKE_NODE_TYPE, WEAVE_STROKE_SINGLE_NODE_DEFAULT_CONFIG, WEAVE_STROKE_SINGLE_NODE_TIP_SIDE, WEAVE_STROKE_SINGLE_NODE_TIP_TYPE, WEAVE_STROKE_SINGLE_NODE_TYPE, WEAVE_STROKE_TOOL_ACTION_NAME, WEAVE_STROKE_TOOL_ACTION_NAME_ALIASES, WEAVE_STROKE_TOOL_DEFAULT_CONFIG, WEAVE_STROKE_TOOL_STATE, WEAVE_TEXT_NODE_DEFAULT_CONFIG, WEAVE_TEXT_NODE_TYPE, WEAVE_USERS_POINTERS_CONFIG_DEFAULT_PROPS, WEAVE_USERS_POINTERS_KEY, WEAVE_USERS_PRESENCE_CONFIG_DEFAULT_PROPS, WEAVE_USERS_PRESENCE_PLUGIN_KEY, WEAVE_USERS_SELECTION_KEY, WEAVE_USER_POINTER_KEY, WEAVE_USER_PRESENCE_KEY, WEAVE_USER_SELECTION_KEY, WEAVE_VIDEO_DEFAULT_CONFIG, WEAVE_VIDEO_NODE_TYPE, Weave, WeaveAction, WeaveAlignNodesToolAction, WeaveArrowNode, WeaveArrowToolAction, WeaveBrushToolAction, WeaveCommentNode, WeaveCommentToolAction, WeaveCommentsRendererPlugin, WeaveConnectedUsersPlugin, WeaveConnectorNode, WeaveConnectorToolAction, WeaveContextMenuPlugin, WeaveCopyPasteNodesPlugin, WeaveEllipseNode, WeaveEllipseToolAction, WeaveEraserToolAction, WeaveExportNodesToolAction, WeaveExportStageToolAction, WeaveFitToScreenToolAction, WeaveFitToSelectionToolAction, WeaveFrameNode, WeaveFrameToolAction, WeaveGroupNode, WeaveImageNode, WeaveImageToolAction, WeaveImagesToolAction, WeaveLayerNode, WeaveLineNode, WeaveLineToolAction, WeaveMeasureNode, WeaveMeasureToolAction, WeaveMoveToolAction, WeaveNode, WeaveNodesDistanceSnappingPlugin, WeaveNodesEdgeSnappingPlugin, WeaveNodesMultiSelectionFeedbackPlugin, WeaveNodesSelectionPlugin, WeavePenToolAction, WeavePlugin, WeaveRectangleNode, WeaveRectangleToolAction, WeaveRegularPolygonNode, WeaveRegularPolygonToolAction, WeaveRenderer, WeaveSelectionToolAction, WeaveStageDropAreaPlugin, WeaveStageGridPlugin, WeaveStageKeyboardMovePlugin, WeaveStageMinimapPlugin, WeaveStageNode, WeaveStagePanningPlugin, WeaveStageResizePlugin, WeaveStageZoomPlugin, WeaveStarNode, WeaveStarToolAction, WeaveStore, WeaveStrokeNode, WeaveStrokeSingleNode, WeaveStrokeToolAction, WeaveTextNode, WeaveTextToolAction, WeaveUsersPointersPlugin, WeaveUsersPresencePlugin, WeaveUsersSelectionPlugin, WeaveVideoNode, WeaveVideoToolAction, WeaveZoomInToolAction, WeaveZoomOutToolAction, canComposite, clearContainerTargets, containerOverCursor, containsNodeDeep, defaultInitialState, downscaleImageFile, downscaleImageFromURL, getBoundingBox, getDownscaleRatio, getExportBoundingBox, getImageSizeFromFile, getPositionRelativeToContainerOnPosition, getSelectedNodesMetadata, getStageClickPoint, getTargetAndSkipNodes, getTargetedNode, getTopmostShadowHost, getVisibleNodes, getVisibleNodesInViewport, hasFrames, hasImages, intersectArrays, isIOS, isInShadowDOM, isNodeInSelection, isServer, loadImageSource, memoize, mergeExceptArrays, moveNodeToContainer, moveNodeToContainerNT, resetScale, setupCanvasBackend, setupSkiaBackend };
|