@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/types.js
CHANGED
|
@@ -15084,6 +15084,11 @@ var WeaveStore = class {
|
|
|
15084
15084
|
getDocument() {
|
|
15085
15085
|
return this.document;
|
|
15086
15086
|
}
|
|
15087
|
+
restartDocument() {
|
|
15088
|
+
this.latestState = { weave: {} };
|
|
15089
|
+
this.state = syncedStore({ weave: {} });
|
|
15090
|
+
this.document = getYjsDoc(this.state);
|
|
15091
|
+
}
|
|
15087
15092
|
loadDocument(roomData) {
|
|
15088
15093
|
yjs_default.applyUpdate(this.document, roomData);
|
|
15089
15094
|
}
|
|
@@ -17959,6 +17964,15 @@ var WeaveContextMenuPlugin = class extends WeavePlugin {
|
|
|
17959
17964
|
initLayer = void 0;
|
|
17960
17965
|
constructor(params) {
|
|
17961
17966
|
super();
|
|
17967
|
+
const { config } = params ?? {};
|
|
17968
|
+
this.config = {
|
|
17969
|
+
xOffset: WEAVE_CONTEXT_MENU_X_OFFSET_DEFAULT,
|
|
17970
|
+
yOffset: WEAVE_CONTEXT_MENU_Y_OFFSET_DEFAULT,
|
|
17971
|
+
...config
|
|
17972
|
+
};
|
|
17973
|
+
this.initialize();
|
|
17974
|
+
}
|
|
17975
|
+
initialize() {
|
|
17962
17976
|
this.timer = null;
|
|
17963
17977
|
this.tapHold = false;
|
|
17964
17978
|
this.contextMenuVisible = false;
|
|
@@ -17968,12 +17982,6 @@ var WeaveContextMenuPlugin = class extends WeavePlugin {
|
|
|
17968
17982
|
time: 0
|
|
17969
17983
|
};
|
|
17970
17984
|
this.tapHoldTimeout = WEAVE_CONTEXT_MENU_TAP_HOLD_TIMEOUT;
|
|
17971
|
-
const { config } = params ?? {};
|
|
17972
|
-
this.config = {
|
|
17973
|
-
xOffset: WEAVE_CONTEXT_MENU_X_OFFSET_DEFAULT,
|
|
17974
|
-
yOffset: WEAVE_CONTEXT_MENU_Y_OFFSET_DEFAULT,
|
|
17975
|
-
...config
|
|
17976
|
-
};
|
|
17977
17985
|
this.pointers = {};
|
|
17978
17986
|
}
|
|
17979
17987
|
getName() {
|
|
@@ -18617,7 +18625,10 @@ const DEFAULT_ADD_NODE_OPTIONS = { emitUserChangeEvent: false };
|
|
|
18617
18625
|
const DEFAULT_UPDATE_NODE_OPTIONS = { emitUserChangeEvent: false };
|
|
18618
18626
|
const DEFAULT_REMOVE_NODE_OPTIONS = { emitUserChangeEvent: false };
|
|
18619
18627
|
const DEFAULT_MOVE_NODE_OPTIONS = { emitUserChangeEvent: false };
|
|
18620
|
-
const WEAVE_DEFAULT_CONFIG = {
|
|
18628
|
+
const WEAVE_DEFAULT_CONFIG = {
|
|
18629
|
+
behaviors: { axisLockThreshold: 5 },
|
|
18630
|
+
performance: { upscale: { enabled: false } }
|
|
18631
|
+
};
|
|
18621
18632
|
|
|
18622
18633
|
//#endregion
|
|
18623
18634
|
//#region src/plugins/users-presence/constants.ts
|
|
@@ -18646,6 +18657,9 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
18646
18657
|
constructor(params) {
|
|
18647
18658
|
super();
|
|
18648
18659
|
this.config = mergeExceptArrays(WEAVE_NODES_SELECTION_DEFAULT_CONFIG, params?.config ?? {});
|
|
18660
|
+
this.initialize();
|
|
18661
|
+
}
|
|
18662
|
+
initialize() {
|
|
18649
18663
|
this.defaultEnabledAnchors = this.config.selection?.enabledAnchors ?? [
|
|
18650
18664
|
"top-left",
|
|
18651
18665
|
"top-center",
|
|
@@ -18809,7 +18823,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
18809
18823
|
nodeHovered = void 0;
|
|
18810
18824
|
}
|
|
18811
18825
|
this.instance.getStage().handleMouseover?.();
|
|
18812
|
-
});
|
|
18826
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
18813
18827
|
const handleTransform = (e) => {
|
|
18814
18828
|
const moved = this.checkMoved(e);
|
|
18815
18829
|
if (moved) this.getContextMenuPlugin()?.cancelLongPressTimer();
|
|
@@ -19224,11 +19238,11 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
19224
19238
|
});
|
|
19225
19239
|
return;
|
|
19226
19240
|
}
|
|
19227
|
-
});
|
|
19241
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
19228
19242
|
stage.container().addEventListener("keyup", (e) => {
|
|
19229
19243
|
if (!(e.ctrlKey || e.metaKey)) this.isCtrlMetaPressed = false;
|
|
19230
19244
|
if (e.code === "Space") this.isSpaceKeyPressed = false;
|
|
19231
|
-
});
|
|
19245
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
19232
19246
|
stage.on("pointerdown", (e) => {
|
|
19233
19247
|
this.setTapStart(e);
|
|
19234
19248
|
this.handledClickOrTap = false;
|
|
@@ -19435,7 +19449,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
19435
19449
|
if (existNode) newSelectedNodes.push(existNode);
|
|
19436
19450
|
}
|
|
19437
19451
|
this.tr.nodes([...newSelectedNodes]);
|
|
19438
|
-
this.tr.forceUpdate();
|
|
19452
|
+
if (newSelectedNodes.length > 0) this.tr.forceUpdate();
|
|
19439
19453
|
this.triggerSelectedNodesEvent();
|
|
19440
19454
|
}
|
|
19441
19455
|
getSelectionPlugin() {
|
|
@@ -19688,6 +19702,9 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
|
|
|
19688
19702
|
super();
|
|
19689
19703
|
this.getImageBase64 = params.getImageBase64;
|
|
19690
19704
|
this.config = mergeExceptArrays(WEAVE_COPY_PASTE_CONFIG_DEFAULT, params?.config);
|
|
19705
|
+
this.initialize();
|
|
19706
|
+
}
|
|
19707
|
+
initialize() {
|
|
19691
19708
|
this.actualInternalPaddingX = 0;
|
|
19692
19709
|
this.actualInternalPaddingY = 0;
|
|
19693
19710
|
this.lastInternalPasteSnapshot = "";
|
|
@@ -19793,7 +19810,7 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
|
|
|
19793
19810
|
this.focusPasteCatcher();
|
|
19794
19811
|
if (!this.enabled) return;
|
|
19795
19812
|
}
|
|
19796
|
-
});
|
|
19813
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
19797
19814
|
if (catcher) catcher.addEventListener("paste", async (e) => {
|
|
19798
19815
|
e.preventDefault();
|
|
19799
19816
|
let items = void 0;
|
|
@@ -19812,7 +19829,7 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
|
|
|
19812
19829
|
return;
|
|
19813
19830
|
}
|
|
19814
19831
|
this.sendExternalPasteEvent(void 0, items);
|
|
19815
|
-
});
|
|
19832
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
19816
19833
|
}
|
|
19817
19834
|
sendExternalPasteEvent(dataList, items) {
|
|
19818
19835
|
const stage = this.instance.getStage();
|
|
@@ -21978,11 +21995,34 @@ var WeaveRegisterManager = class {
|
|
|
21978
21995
|
}
|
|
21979
21996
|
}
|
|
21980
21997
|
}
|
|
21998
|
+
resetNodesHandlers() {
|
|
21999
|
+
for (const nodeHandlerId of Object.keys(this.nodesHandlers)) {
|
|
22000
|
+
const nodeHandler = this.nodesHandlers[nodeHandlerId];
|
|
22001
|
+
nodeHandler.initialize?.();
|
|
22002
|
+
}
|
|
22003
|
+
}
|
|
22004
|
+
resetActionsHandlers() {
|
|
22005
|
+
for (const actionHandlerId of Object.keys(this.actionsHandlers)) {
|
|
22006
|
+
const actionHandler = this.actionsHandlers[actionHandlerId];
|
|
22007
|
+
actionHandler.initialize?.();
|
|
22008
|
+
}
|
|
22009
|
+
}
|
|
22010
|
+
resetPlugins() {
|
|
22011
|
+
for (const pluginId of Object.keys(this.plugins)) {
|
|
22012
|
+
const plugin = this.plugins[pluginId];
|
|
22013
|
+
plugin.initialize?.();
|
|
22014
|
+
}
|
|
22015
|
+
}
|
|
22016
|
+
reset() {
|
|
22017
|
+
this.resetNodesHandlers();
|
|
22018
|
+
this.resetActionsHandlers();
|
|
22019
|
+
this.resetPlugins();
|
|
22020
|
+
}
|
|
21981
22021
|
};
|
|
21982
22022
|
|
|
21983
22023
|
//#endregion
|
|
21984
22024
|
//#region package.json
|
|
21985
|
-
var version = "3.
|
|
22025
|
+
var version = "3.4.0-SNAPSHOT.85.1";
|
|
21986
22026
|
|
|
21987
22027
|
//#endregion
|
|
21988
22028
|
//#region src/managers/setup.ts
|
|
@@ -22099,6 +22139,11 @@ var WeaveStageManager = class {
|
|
|
22099
22139
|
initialZIndex: void 0
|
|
22100
22140
|
};
|
|
22101
22141
|
const stage = new Konva.Stage({ ...props });
|
|
22142
|
+
if (!this.instance.isServerSide()) {
|
|
22143
|
+
const containerParent = stage.container().parentNode;
|
|
22144
|
+
stage.width(containerParent.clientWidth);
|
|
22145
|
+
stage.height(containerParent.clientHeight);
|
|
22146
|
+
}
|
|
22102
22147
|
const realContainer = stage.container();
|
|
22103
22148
|
if (realContainer !== void 0 && realContainer.style?.position !== "relative") realContainer.style.position = "relative";
|
|
22104
22149
|
this.setStage(stage);
|
|
@@ -22407,6 +22452,91 @@ var WeaveExportManager = class {
|
|
|
22407
22452
|
height: imageHeight * pixelRatio
|
|
22408
22453
|
};
|
|
22409
22454
|
}
|
|
22455
|
+
async exportAreaServerSide(area, options) {
|
|
22456
|
+
const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
|
|
22457
|
+
this.getNodesSelectionPlugin()?.disable();
|
|
22458
|
+
this.getNodesDistanceSnappingPlugin()?.disable();
|
|
22459
|
+
this.getNodesEdgeSnappingPlugin()?.disable();
|
|
22460
|
+
this.getStageGridPlugin()?.disable();
|
|
22461
|
+
const stage = this.instance.getStage();
|
|
22462
|
+
const mainLayer = this.instance.getMainLayer();
|
|
22463
|
+
if (!mainLayer) throw new Error("Main layer not found");
|
|
22464
|
+
const originalPosition = {
|
|
22465
|
+
x: stage.x(),
|
|
22466
|
+
y: stage.y()
|
|
22467
|
+
};
|
|
22468
|
+
const originalScale = {
|
|
22469
|
+
x: stage.scaleX(),
|
|
22470
|
+
y: stage.scaleY()
|
|
22471
|
+
};
|
|
22472
|
+
stage.scale({
|
|
22473
|
+
x: 1,
|
|
22474
|
+
y: 1
|
|
22475
|
+
});
|
|
22476
|
+
const bounds = area;
|
|
22477
|
+
const scaleX = stage.scaleX();
|
|
22478
|
+
const scaleY = stage.scaleY();
|
|
22479
|
+
const unscaledBounds = {
|
|
22480
|
+
x: bounds.x / scaleX,
|
|
22481
|
+
y: bounds.y / scaleY,
|
|
22482
|
+
width: bounds.width / scaleX,
|
|
22483
|
+
height: bounds.height / scaleY
|
|
22484
|
+
};
|
|
22485
|
+
const background = new Konva.Rect({
|
|
22486
|
+
x: unscaledBounds.x - padding,
|
|
22487
|
+
y: unscaledBounds.y - padding,
|
|
22488
|
+
width: unscaledBounds.width + 2 * padding,
|
|
22489
|
+
height: unscaledBounds.height + 2 * padding,
|
|
22490
|
+
strokeWidth: 0,
|
|
22491
|
+
fill: backgroundColor
|
|
22492
|
+
});
|
|
22493
|
+
mainLayer.add(background);
|
|
22494
|
+
background.moveToBottom();
|
|
22495
|
+
const backgroundRect = background.getClientRect({ relativeTo: stage });
|
|
22496
|
+
const composites = [];
|
|
22497
|
+
const imageWidth = Math.round(backgroundRect.width);
|
|
22498
|
+
const imageHeight = Math.round(backgroundRect.height);
|
|
22499
|
+
const maxRenderSize = 1920;
|
|
22500
|
+
const cols = Math.ceil(imageWidth / maxRenderSize);
|
|
22501
|
+
const rows = Math.ceil(imageHeight / maxRenderSize);
|
|
22502
|
+
const tileWidth = Math.floor(imageWidth / cols);
|
|
22503
|
+
const tileHeight = Math.floor(imageHeight / rows);
|
|
22504
|
+
for (let y = 0; y < imageHeight; y += tileHeight) for (let x = 0; x < imageWidth; x += tileWidth) {
|
|
22505
|
+
const width = Math.min(tileWidth, imageWidth - x);
|
|
22506
|
+
const height = Math.min(tileHeight, imageHeight - y);
|
|
22507
|
+
const canvas = await mainLayer.toCanvas({
|
|
22508
|
+
x: Math.round(backgroundRect.x) + x,
|
|
22509
|
+
y: Math.round(backgroundRect.y) + y,
|
|
22510
|
+
width,
|
|
22511
|
+
height,
|
|
22512
|
+
mimeType: format,
|
|
22513
|
+
pixelRatio,
|
|
22514
|
+
quality: options.quality ?? 1
|
|
22515
|
+
});
|
|
22516
|
+
let buffer = null;
|
|
22517
|
+
if (globalThis._weave_serverSideBackend === WEAVE_KONVA_BACKEND.CANVAS) buffer = canvas.toBuffer();
|
|
22518
|
+
if (globalThis._weave_serverSideBackend === WEAVE_KONVA_BACKEND.SKIA) buffer = await canvas.toBuffer();
|
|
22519
|
+
if (!buffer) throw new Error("Failed to generate image buffer");
|
|
22520
|
+
composites.push({
|
|
22521
|
+
top: y * pixelRatio,
|
|
22522
|
+
left: x * pixelRatio,
|
|
22523
|
+
input: buffer
|
|
22524
|
+
});
|
|
22525
|
+
}
|
|
22526
|
+
background.destroy();
|
|
22527
|
+
stage.position(originalPosition);
|
|
22528
|
+
stage.scale(originalScale);
|
|
22529
|
+
stage.batchDraw();
|
|
22530
|
+
this.getNodesSelectionPlugin()?.enable();
|
|
22531
|
+
this.getNodesDistanceSnappingPlugin()?.enable();
|
|
22532
|
+
this.getNodesEdgeSnappingPlugin()?.enable();
|
|
22533
|
+
this.getStageGridPlugin()?.enable();
|
|
22534
|
+
return {
|
|
22535
|
+
composites,
|
|
22536
|
+
width: imageWidth * pixelRatio,
|
|
22537
|
+
height: imageHeight * pixelRatio
|
|
22538
|
+
};
|
|
22539
|
+
}
|
|
22410
22540
|
imageToBase64(img, mimeType) {
|
|
22411
22541
|
if (img.naturalWidth === 0 && img.naturalHeight === 0) throw new Error("Image has no content");
|
|
22412
22542
|
const canvas = document.createElement("canvas");
|
|
@@ -22686,7 +22816,12 @@ var WeaveAsyncManager = class {
|
|
|
22686
22816
|
this.instance.emitEvent("onAsyncElementChange");
|
|
22687
22817
|
}, new Map());
|
|
22688
22818
|
}
|
|
22819
|
+
reset() {
|
|
22820
|
+
this.asyncElements.clear();
|
|
22821
|
+
this.asyncElementsLoadedEventEmitted = false;
|
|
22822
|
+
}
|
|
22689
22823
|
checkForAsyncElements(elements) {
|
|
22824
|
+
this.instance.emitEvent("onAsyncElementsIdle");
|
|
22690
22825
|
const amountAsyncResourcesExtracted = this.extractAsyncResources(elements);
|
|
22691
22826
|
if (amountAsyncResourcesExtracted === 0 && !this.asyncElementsLoadedEventEmitted) {
|
|
22692
22827
|
this.instance.emitEvent("onAsyncElementsLoaded");
|
|
@@ -22739,7 +22874,7 @@ var WeaveAsyncManager = class {
|
|
|
22739
22874
|
status: WEAVE_ASYNC_STATUS.LOADING
|
|
22740
22875
|
};
|
|
22741
22876
|
this.asyncElements.set(nodeId, element);
|
|
22742
|
-
this.instance.emitEvent("onAsyncElementsLoading", {
|
|
22877
|
+
if (!this.asyncElementsLoadedEventEmitted) this.instance.emitEvent("onAsyncElementsLoading", {
|
|
22743
22878
|
loaded: this.getAmountAsyncElementsLoaded(),
|
|
22744
22879
|
total: this.getAmountAsyncElements()
|
|
22745
22880
|
});
|
|
@@ -22752,11 +22887,11 @@ var WeaveAsyncManager = class {
|
|
|
22752
22887
|
status: WEAVE_ASYNC_STATUS.LOADED
|
|
22753
22888
|
};
|
|
22754
22889
|
this.asyncElements.set(nodeId, element);
|
|
22755
|
-
this.instance.emitEvent("onAsyncElementsLoading", {
|
|
22756
|
-
loaded: this.getAmountAsyncElementsLoaded(),
|
|
22757
|
-
total: this.getAmountAsyncElements()
|
|
22758
|
-
});
|
|
22759
22890
|
if (!this.asyncElementsLoadedEventEmitted) {
|
|
22891
|
+
this.instance.emitEvent("onAsyncElementsLoading", {
|
|
22892
|
+
loaded: this.getAmountAsyncElementsLoaded(),
|
|
22893
|
+
total: this.getAmountAsyncElements()
|
|
22894
|
+
});
|
|
22760
22895
|
const allLoaded = this.asyncElementsLoaded();
|
|
22761
22896
|
if (allLoaded) {
|
|
22762
22897
|
this.instance.emitEvent("onAsyncElementsLoaded");
|
|
@@ -22881,6 +23016,7 @@ var Weave = class {
|
|
|
22881
23016
|
constructor(weaveConfig, stageConfig) {
|
|
22882
23017
|
globalThis._weave_isServerSide = false;
|
|
22883
23018
|
if (typeof window === "undefined") globalThis._weave_isServerSide = true;
|
|
23019
|
+
this.eventsController = void 0;
|
|
22884
23020
|
this.emitter = new Emittery();
|
|
22885
23021
|
Konva.showWarnings = false;
|
|
22886
23022
|
this.id = v4_default();
|
|
@@ -22926,6 +23062,7 @@ var Weave = class {
|
|
|
22926
23062
|
this.initialized = true;
|
|
22927
23063
|
this.status = WEAVE_INSTANCE_STATUS.RUNNING;
|
|
22928
23064
|
this.emitEvent("onInstanceStatus", this.status);
|
|
23065
|
+
this.emitEvent("onRender");
|
|
22929
23066
|
});
|
|
22930
23067
|
}
|
|
22931
23068
|
setStatus(status) {
|
|
@@ -22950,6 +23087,7 @@ var Weave = class {
|
|
|
22950
23087
|
async start() {
|
|
22951
23088
|
this.moduleLogger.info("Start instance");
|
|
22952
23089
|
if (!this.isServerSide()) {
|
|
23090
|
+
this.eventsController = new AbortController();
|
|
22953
23091
|
if (!window.weave) window.weave = this;
|
|
22954
23092
|
}
|
|
22955
23093
|
this.emitEvent("onRoomLoaded", false);
|
|
@@ -22973,8 +23111,39 @@ var Weave = class {
|
|
|
22973
23111
|
store.setup();
|
|
22974
23112
|
store.connect();
|
|
22975
23113
|
}
|
|
23114
|
+
async switchRoom() {
|
|
23115
|
+
this.moduleLogger.info(`Switching room`);
|
|
23116
|
+
const nodeHandlers = this.registerManager.getNodesHandlers();
|
|
23117
|
+
for (const nodeHandlerKey of Object.keys(nodeHandlers)) {
|
|
23118
|
+
const nodeHandler = nodeHandlers[nodeHandlerKey];
|
|
23119
|
+
nodeHandler?.onDestroyInstance();
|
|
23120
|
+
}
|
|
23121
|
+
const stage = this.getStage();
|
|
23122
|
+
if (stage) stage.destroy();
|
|
23123
|
+
if (this.eventsController) this.eventsController.abort();
|
|
23124
|
+
if (!this.isServerSide()) this.eventsController = new AbortController();
|
|
23125
|
+
this.registerManager.reset();
|
|
23126
|
+
this.asyncManager.reset();
|
|
23127
|
+
this.moduleLogger.info("Switching room instance");
|
|
23128
|
+
if (!this.isServerSide()) {
|
|
23129
|
+
if (!window.weave) window.weave = this;
|
|
23130
|
+
}
|
|
23131
|
+
this.emitEvent("onRoomLoaded", false);
|
|
23132
|
+
this.status = WEAVE_INSTANCE_STATUS.STARTING;
|
|
23133
|
+
this.emitEvent("onInstanceStatus", this.status);
|
|
23134
|
+
this.registerManager.reset();
|
|
23135
|
+
this.status = WEAVE_INSTANCE_STATUS.LOADING_FONTS;
|
|
23136
|
+
this.emitEvent("onInstanceStatus", this.status);
|
|
23137
|
+
await this.fontsManager.loadFonts();
|
|
23138
|
+
this.setupManager.setupLog();
|
|
23139
|
+
this.stageManager.initStage();
|
|
23140
|
+
this.status = WEAVE_INSTANCE_STATUS.CONNECTING_TO_ROOM;
|
|
23141
|
+
this.emitEvent("onInstanceStatus", this.status);
|
|
23142
|
+
this.addEventListener("onStoreConnectionStatusChange", this.handleStoreConnectionStatusChange.bind(this));
|
|
23143
|
+
}
|
|
22976
23144
|
destroy() {
|
|
22977
23145
|
this.moduleLogger.info(`Destroying the instance`);
|
|
23146
|
+
if (this.eventsController) this.eventsController.abort();
|
|
22978
23147
|
this.emitter.clearListeners();
|
|
22979
23148
|
this.status = WEAVE_INSTANCE_STATUS.IDLE;
|
|
22980
23149
|
this.emitEvent("onInstanceStatus", this.status);
|
|
@@ -23444,6 +23613,9 @@ var Weave = class {
|
|
|
23444
23613
|
async exportNodesServerSide(nodes, boundingNodes, options) {
|
|
23445
23614
|
return await this.exportManager.exportNodesServerSide(nodes, boundingNodes, options);
|
|
23446
23615
|
}
|
|
23616
|
+
async exportAreaServerSide(area, options) {
|
|
23617
|
+
return await this.exportManager.exportAreaServerSide(area, options);
|
|
23618
|
+
}
|
|
23447
23619
|
async exportNodes(nodes, boundingNodes, options) {
|
|
23448
23620
|
return await this.exportManager.exportNodesAsImage(nodes, boundingNodes, options);
|
|
23449
23621
|
}
|
|
@@ -23609,6 +23781,9 @@ var Weave = class {
|
|
|
23609
23781
|
getDragProperties() {
|
|
23610
23782
|
return this.dragAndDropManager.getDragProperties();
|
|
23611
23783
|
}
|
|
23784
|
+
getEventsController() {
|
|
23785
|
+
return this.eventsController;
|
|
23786
|
+
}
|
|
23612
23787
|
};
|
|
23613
23788
|
|
|
23614
23789
|
//#endregion
|
|
@@ -23700,6 +23875,7 @@ const downscaleImageFromURL = (url, options) => {
|
|
|
23700
23875
|
//#endregion
|
|
23701
23876
|
//#region src/internal-utils/upscale.ts
|
|
23702
23877
|
const setupUpscaleStage = (instance, stage) => {
|
|
23878
|
+
if (instance.isServerSide()) return;
|
|
23703
23879
|
const config = instance.getConfiguration();
|
|
23704
23880
|
const doUpscale = config.performance?.upscale?.enabled ?? false;
|
|
23705
23881
|
if (doUpscale) {
|
|
@@ -23731,7 +23907,14 @@ const setupUpscaleStage = (instance, stage) => {
|
|
|
23731
23907
|
innerElement.style.transformOrigin = "0 0";
|
|
23732
23908
|
innerElement.style.transform = `scale(${scaleToCover})`;
|
|
23733
23909
|
}
|
|
23734
|
-
} else
|
|
23910
|
+
} else {
|
|
23911
|
+
const realContainer = stage.container();
|
|
23912
|
+
const containerWidth = realContainer.offsetWidth;
|
|
23913
|
+
const containerHeight = realContainer.offsetHeight;
|
|
23914
|
+
stage.width(containerWidth);
|
|
23915
|
+
stage.height(containerHeight);
|
|
23916
|
+
stage.setAttrs({ upscaleScale: 1 });
|
|
23917
|
+
}
|
|
23735
23918
|
};
|
|
23736
23919
|
|
|
23737
23920
|
//#endregion
|
|
@@ -23742,6 +23925,7 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23742
23925
|
wheelMousePressed = false;
|
|
23743
23926
|
isCmdCtrlPressed = false;
|
|
23744
23927
|
globalEventsInitialized = false;
|
|
23928
|
+
initialize = void 0;
|
|
23745
23929
|
onRender(props) {
|
|
23746
23930
|
const stage = new Konva.Stage({
|
|
23747
23931
|
...props,
|
|
@@ -23760,10 +23944,10 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23760
23944
|
container.setAttribute("tabindex", "0");
|
|
23761
23945
|
stage.container().addEventListener("focus", () => {
|
|
23762
23946
|
this.stageFocused = true;
|
|
23763
|
-
});
|
|
23947
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
23764
23948
|
stage.container().addEventListener("blur", () => {
|
|
23765
23949
|
this.stageFocused = false;
|
|
23766
|
-
});
|
|
23950
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
23767
23951
|
}
|
|
23768
23952
|
Konva.Stage.prototype.mode = function(mode) {
|
|
23769
23953
|
if (typeof mode !== "undefined") this._mode = mode;
|
|
@@ -23833,7 +24017,7 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23833
24017
|
const selectedNode = transformer.nodes()[0];
|
|
23834
24018
|
selectedNode.fire("onCmdCtrlPressed");
|
|
23835
24019
|
}
|
|
23836
|
-
});
|
|
24020
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
23837
24021
|
window.addEventListener("keyup", (e) => {
|
|
23838
24022
|
if (!(e.ctrlKey || e.metaKey)) {
|
|
23839
24023
|
this.isCmdCtrlPressed = false;
|
|
@@ -23844,7 +24028,7 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23844
24028
|
const selectedNode = transformer.nodes()[0];
|
|
23845
24029
|
selectedNode.fire("onCmdCtrlReleased");
|
|
23846
24030
|
}
|
|
23847
|
-
});
|
|
24031
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
23848
24032
|
this.globalEventsInitialized = true;
|
|
23849
24033
|
}
|
|
23850
24034
|
isOnlyCtrlOrMeta(event) {
|
|
@@ -23864,6 +24048,7 @@ const WEAVE_LAYER_NODE_TYPE = "layer";
|
|
|
23864
24048
|
//#region src/nodes/layer/layer.ts
|
|
23865
24049
|
var WeaveLayerNode = class extends WeaveNode {
|
|
23866
24050
|
nodeType = WEAVE_LAYER_NODE_TYPE;
|
|
24051
|
+
initialize = void 0;
|
|
23867
24052
|
onRender(props) {
|
|
23868
24053
|
const layer = new Konva.Layer({ ...props });
|
|
23869
24054
|
layer.canMoveToContainer = function() {
|
|
@@ -23911,6 +24096,7 @@ const WEAVE_GROUP_NODE_TYPE = "group";
|
|
|
23911
24096
|
//#region src/nodes/group/group.ts
|
|
23912
24097
|
var WeaveGroupNode = class extends WeaveNode {
|
|
23913
24098
|
nodeType = WEAVE_GROUP_NODE_TYPE;
|
|
24099
|
+
initialize = void 0;
|
|
23914
24100
|
constructor(params) {
|
|
23915
24101
|
super();
|
|
23916
24102
|
const { config } = params ?? {};
|
|
@@ -24003,6 +24189,7 @@ const WEAVE_RECTANGLE_NODE_TYPE = "rectangle";
|
|
|
24003
24189
|
//#region src/nodes/rectangle/rectangle.ts
|
|
24004
24190
|
var WeaveRectangleNode = class extends WeaveNode {
|
|
24005
24191
|
nodeType = WEAVE_RECTANGLE_NODE_TYPE;
|
|
24192
|
+
initialize = void 0;
|
|
24006
24193
|
constructor(params) {
|
|
24007
24194
|
super();
|
|
24008
24195
|
const { config } = params ?? {};
|
|
@@ -24046,6 +24233,7 @@ const WEAVE_ELLIPSE_NODE_TYPE = "ellipse";
|
|
|
24046
24233
|
//#region src/nodes/ellipse/ellipse.ts
|
|
24047
24234
|
var WeaveEllipseNode = class extends WeaveNode {
|
|
24048
24235
|
nodeType = WEAVE_ELLIPSE_NODE_TYPE;
|
|
24236
|
+
initialize = void 0;
|
|
24049
24237
|
constructor(params) {
|
|
24050
24238
|
super();
|
|
24051
24239
|
const { config } = params ?? {};
|
|
@@ -24191,13 +24379,16 @@ var WeaveLineNode = class extends WeaveNode {
|
|
|
24191
24379
|
constructor(params) {
|
|
24192
24380
|
super();
|
|
24193
24381
|
this.config = mergeExceptArrays(WEAVE_LINE_NODE_DEFAULT_CONFIG, params?.config ?? {});
|
|
24194
|
-
this.handleNodeChanges = null;
|
|
24195
|
-
this.handleZoomChanges = null;
|
|
24196
24382
|
this.snapper = new GreedySnapper({
|
|
24197
24383
|
snapAngles: this.config.snapAngles.angles,
|
|
24198
24384
|
activateThreshold: this.config.snapAngles.activateThreshold,
|
|
24199
24385
|
releaseThreshold: this.config.snapAngles.releaseThreshold
|
|
24200
24386
|
});
|
|
24387
|
+
this.initialize();
|
|
24388
|
+
}
|
|
24389
|
+
initialize() {
|
|
24390
|
+
this.handleNodeChanges = null;
|
|
24391
|
+
this.handleZoomChanges = null;
|
|
24201
24392
|
}
|
|
24202
24393
|
onRender(props) {
|
|
24203
24394
|
const line = new Konva.Line({
|
|
@@ -24502,17 +24693,19 @@ const TEXT_LAYOUT = {
|
|
|
24502
24693
|
//#region src/nodes/text/text.ts
|
|
24503
24694
|
var WeaveTextNode = class extends WeaveNode {
|
|
24504
24695
|
nodeType = WEAVE_TEXT_NODE_TYPE;
|
|
24505
|
-
editing = false;
|
|
24506
|
-
textAreaSuperContainer = null;
|
|
24507
|
-
textAreaContainer = null;
|
|
24508
|
-
textArea = null;
|
|
24509
|
-
eventsInitialized = false;
|
|
24510
|
-
isCtrlMetaPressed = false;
|
|
24511
24696
|
constructor(params) {
|
|
24512
24697
|
super();
|
|
24513
24698
|
const { config } = params ?? {};
|
|
24514
24699
|
this.config = (0, import_lodash.merge)({}, WEAVE_TEXT_NODE_DEFAULT_CONFIG, config);
|
|
24700
|
+
this.initialize();
|
|
24701
|
+
}
|
|
24702
|
+
initialize() {
|
|
24515
24703
|
this.keyPressHandler = void 0;
|
|
24704
|
+
this.eventsInitialized = false;
|
|
24705
|
+
this.isCtrlMetaPressed = false;
|
|
24706
|
+
this.textAreaSuperContainer = null;
|
|
24707
|
+
this.textAreaContainer = null;
|
|
24708
|
+
this.textArea = null;
|
|
24516
24709
|
this.editing = false;
|
|
24517
24710
|
this.textArea = null;
|
|
24518
24711
|
}
|
|
@@ -24520,10 +24713,10 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24520
24713
|
if (!this.eventsInitialized && !globalThis._weave_isServerSide) {
|
|
24521
24714
|
window.addEventListener("keydown", (e) => {
|
|
24522
24715
|
if (e.ctrlKey || e.metaKey) this.isCtrlMetaPressed = true;
|
|
24523
|
-
});
|
|
24716
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24524
24717
|
window.addEventListener("keyup", (e) => {
|
|
24525
24718
|
if (!(e.ctrlKey || e.metaKey)) this.isCtrlMetaPressed = false;
|
|
24526
|
-
});
|
|
24719
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24527
24720
|
this.eventsInitialized = true;
|
|
24528
24721
|
}
|
|
24529
24722
|
}
|
|
@@ -24551,7 +24744,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24551
24744
|
onAdd() {
|
|
24552
24745
|
if (!this.instance.isServerSide() && !this.keyPressHandler) {
|
|
24553
24746
|
this.keyPressHandler = this.handleKeyPress.bind(this);
|
|
24554
|
-
window.addEventListener("keypress", this.keyPressHandler);
|
|
24747
|
+
window.addEventListener("keypress", this.keyPressHandler, { signal: this.instance.getEventsController()?.signal });
|
|
24555
24748
|
}
|
|
24556
24749
|
}
|
|
24557
24750
|
onRender(props) {
|
|
@@ -24705,7 +24898,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24705
24898
|
});
|
|
24706
24899
|
if (!this.instance.isServerSide() && !this.keyPressHandler) {
|
|
24707
24900
|
this.keyPressHandler = this.handleKeyPress.bind(this);
|
|
24708
|
-
window.addEventListener("keypress", this.keyPressHandler);
|
|
24901
|
+
window.addEventListener("keypress", this.keyPressHandler, { signal: this.instance.getEventsController()?.signal });
|
|
24709
24902
|
}
|
|
24710
24903
|
return text;
|
|
24711
24904
|
}
|
|
@@ -24964,17 +25157,17 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24964
25157
|
this.textAreaSuperContainer.scrollTop = 0;
|
|
24965
25158
|
this.textAreaSuperContainer.scrollLeft = 0;
|
|
24966
25159
|
}
|
|
24967
|
-
});
|
|
25160
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24968
25161
|
this.textAreaContainer.addEventListener("scroll", () => {
|
|
24969
25162
|
if (!this.textAreaContainer) return;
|
|
24970
25163
|
this.textAreaContainer.scrollTop = 0;
|
|
24971
25164
|
this.textAreaContainer.scrollLeft = 0;
|
|
24972
|
-
});
|
|
25165
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24973
25166
|
this.textArea.addEventListener("scroll", () => {
|
|
24974
25167
|
if (!this.textArea) return;
|
|
24975
25168
|
this.textArea.scrollTop = 0;
|
|
24976
25169
|
this.textArea.scrollLeft = 0;
|
|
24977
|
-
});
|
|
25170
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24978
25171
|
const rotation = textNode.getAbsoluteRotation();
|
|
24979
25172
|
if (rotation) {
|
|
24980
25173
|
const transform = "rotate(" + rotation + "deg)";
|
|
@@ -25023,8 +25216,8 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
25023
25216
|
this.textAreaDomResize(textNode);
|
|
25024
25217
|
}
|
|
25025
25218
|
};
|
|
25026
|
-
this.textArea.addEventListener("keydown", handleKeyDown);
|
|
25027
|
-
this.textArea.addEventListener("keyup", handleKeyUp);
|
|
25219
|
+
this.textArea.addEventListener("keydown", handleKeyDown, { signal: this.instance.getEventsController()?.signal });
|
|
25220
|
+
this.textArea.addEventListener("keyup", handleKeyUp, { signal: this.instance.getEventsController()?.signal });
|
|
25028
25221
|
this.textArea.tabIndex = 1;
|
|
25029
25222
|
this.textArea.focus();
|
|
25030
25223
|
const handleOutsideClick = (e) => {
|
|
@@ -25050,7 +25243,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
25050
25243
|
}
|
|
25051
25244
|
};
|
|
25052
25245
|
setTimeout(() => {
|
|
25053
|
-
window.addEventListener("pointerup", handleOutsideClick);
|
|
25246
|
+
window.addEventListener("pointerup", handleOutsideClick, { signal: this.instance.getEventsController()?.signal });
|
|
25054
25247
|
}, 0);
|
|
25055
25248
|
this.instance.getStage().mode(WEAVE_STAGE_TEXT_EDITION_MODE);
|
|
25056
25249
|
this.editing = true;
|
|
@@ -25384,7 +25577,7 @@ var WeaveImageCrop = class WeaveImageCrop {
|
|
|
25384
25577
|
utilityLayer?.add(this.transformer);
|
|
25385
25578
|
this.transformer?.forceUpdate();
|
|
25386
25579
|
this.cropGroup.show();
|
|
25387
|
-
window.addEventListener("keydown", this.handleHide);
|
|
25580
|
+
window.addEventListener("keydown", this.handleHide, { signal: this.instance.getEventsController()?.signal });
|
|
25388
25581
|
if (options.cmdCtrl.triggered) {
|
|
25389
25582
|
utilityLayer?.hide();
|
|
25390
25583
|
const stage = this.instance.getStage();
|
|
@@ -25834,24 +26027,21 @@ const isAllowedUrl = (value) => {
|
|
|
25834
26027
|
//#endregion
|
|
25835
26028
|
//#region src/nodes/image/image.ts
|
|
25836
26029
|
var WeaveImageNode = class extends WeaveNode {
|
|
25837
|
-
imageBitmapCache = {};
|
|
25838
|
-
imageSource = {};
|
|
25839
|
-
imageFallback = {};
|
|
25840
|
-
imageState = {};
|
|
25841
|
-
imageTryoutAttempts = {};
|
|
25842
|
-
imageTryoutIds = {};
|
|
25843
26030
|
nodeType = WEAVE_IMAGE_NODE_TYPE;
|
|
25844
26031
|
cursorsFallback = { loading: "wait" };
|
|
25845
26032
|
cursors = {};
|
|
25846
26033
|
constructor(params) {
|
|
25847
26034
|
super();
|
|
25848
26035
|
const { config } = params ?? {};
|
|
26036
|
+
this.config = mergeExceptArrays(WEAVE_IMAGE_DEFAULT_CONFIG, config);
|
|
26037
|
+
this.initialize();
|
|
26038
|
+
}
|
|
26039
|
+
initialize() {
|
|
25849
26040
|
this.tapStart = {
|
|
25850
26041
|
x: 0,
|
|
25851
26042
|
y: 0,
|
|
25852
26043
|
time: 0
|
|
25853
26044
|
};
|
|
25854
|
-
this.config = mergeExceptArrays(WEAVE_IMAGE_DEFAULT_CONFIG, config);
|
|
25855
26045
|
this.imageCrop = null;
|
|
25856
26046
|
this.imageBitmapCache = {};
|
|
25857
26047
|
this.imageSource = {};
|
|
@@ -26070,7 +26260,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26070
26260
|
};
|
|
26071
26261
|
this.updateImageCrop(image);
|
|
26072
26262
|
} else {
|
|
26073
|
-
this.updatePlaceholderSize(image
|
|
26263
|
+
this.updatePlaceholderSize(image);
|
|
26074
26264
|
this.loadImage(imageProps, image, true);
|
|
26075
26265
|
}
|
|
26076
26266
|
if (this.config.performance.cache.enabled) image.on("transformend", () => {
|
|
@@ -26457,7 +26647,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26457
26647
|
}
|
|
26458
26648
|
this.loadAsyncElement(id);
|
|
26459
26649
|
preloadFunction(id, realImageURL ?? "", {
|
|
26460
|
-
onLoad: () => {
|
|
26650
|
+
onLoad: async () => {
|
|
26461
26651
|
if (useFallback) this.imageTryoutIds[id] = setTimeout(() => {
|
|
26462
26652
|
const node = this.instance.getStage().findOne(`#${id}`);
|
|
26463
26653
|
if (node) {
|
|
@@ -26508,7 +26698,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26508
26698
|
error: false
|
|
26509
26699
|
};
|
|
26510
26700
|
this.updateImageCrop(image);
|
|
26511
|
-
this.resolveAsyncElement(id);
|
|
26701
|
+
if (!useFallback) this.resolveAsyncElement(id);
|
|
26512
26702
|
this.cacheNode(image);
|
|
26513
26703
|
}
|
|
26514
26704
|
},
|
|
@@ -26549,13 +26739,9 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26549
26739
|
}
|
|
26550
26740
|
}, loadTryout);
|
|
26551
26741
|
}
|
|
26552
|
-
updatePlaceholderSize(image
|
|
26742
|
+
updatePlaceholderSize(image) {
|
|
26553
26743
|
const imageAttrs = image.getAttrs();
|
|
26554
26744
|
if (!this.imageState[imageAttrs.id ?? ""]?.loaded) return;
|
|
26555
|
-
if (!imageAttrs.adding && !imageAttrs.cropInfo) {
|
|
26556
|
-
imagePlaceholder.width(imageAttrs.uncroppedImage.width);
|
|
26557
|
-
imagePlaceholder.height(imageAttrs.uncroppedImage.height);
|
|
26558
|
-
}
|
|
26559
26745
|
}
|
|
26560
26746
|
updateImageCrop(image) {
|
|
26561
26747
|
const imageAttrs = image.getAttrs();
|
|
@@ -26689,6 +26875,7 @@ const WEAVE_STAR_NODE_TYPE = "star";
|
|
|
26689
26875
|
//#region src/nodes/star/star.ts
|
|
26690
26876
|
var WeaveStarNode = class extends WeaveNode {
|
|
26691
26877
|
nodeType = WEAVE_STAR_NODE_TYPE;
|
|
26878
|
+
initialize = void 0;
|
|
26692
26879
|
constructor(params) {
|
|
26693
26880
|
super();
|
|
26694
26881
|
const { config } = params ?? {};
|
|
@@ -26774,6 +26961,7 @@ const WEAVE_ARROW_NODE_TYPE = "arrow";
|
|
|
26774
26961
|
//#region src/nodes/arrow/arrow.ts
|
|
26775
26962
|
var WeaveArrowNode = class extends WeaveNode {
|
|
26776
26963
|
nodeType = WEAVE_ARROW_NODE_TYPE;
|
|
26964
|
+
initialize = void 0;
|
|
26777
26965
|
constructor(params) {
|
|
26778
26966
|
super();
|
|
26779
26967
|
const { config } = params ?? {};
|
|
@@ -26830,6 +27018,7 @@ const WEAVE_REGULAR_POLYGON_NODE_TYPE = "regular-polygon";
|
|
|
26830
27018
|
//#region src/nodes/regular-polygon/regular-polygon.ts
|
|
26831
27019
|
var WeaveRegularPolygonNode = class extends WeaveNode {
|
|
26832
27020
|
nodeType = WEAVE_REGULAR_POLYGON_NODE_TYPE;
|
|
27021
|
+
initialize = void 0;
|
|
26833
27022
|
constructor(params) {
|
|
26834
27023
|
super();
|
|
26835
27024
|
const { config } = params ?? {};
|
|
@@ -26943,6 +27132,7 @@ var GroupFrame = class extends Konva.Group {
|
|
|
26943
27132
|
//#region src/nodes/frame/frame.ts
|
|
26944
27133
|
var WeaveFrameNode = class extends WeaveNode {
|
|
26945
27134
|
nodeType = WEAVE_FRAME_NODE_TYPE;
|
|
27135
|
+
initialize = void 0;
|
|
26946
27136
|
constructor(params) {
|
|
26947
27137
|
super();
|
|
26948
27138
|
const { config } = params ?? {};
|
|
@@ -27243,6 +27433,7 @@ const WEAVE_STROKE_NODE_DEFAULT_CONFIG = {
|
|
|
27243
27433
|
//#region src/nodes/stroke/stroke.ts
|
|
27244
27434
|
var WeaveStrokeNode = class extends WeaveNode {
|
|
27245
27435
|
nodeType = WEAVE_STROKE_NODE_TYPE;
|
|
27436
|
+
initialize = void 0;
|
|
27246
27437
|
constructor(params) {
|
|
27247
27438
|
super();
|
|
27248
27439
|
const { config } = params ?? {};
|
|
@@ -27819,8 +28010,6 @@ var WeaveSquareLineTipManager = class extends WeaveBaseLineTipManager {
|
|
|
27819
28010
|
//#endregion
|
|
27820
28011
|
//#region src/nodes/stroke-single/stroke-single.ts
|
|
27821
28012
|
var WeaveStrokeSingleNode = class extends WeaveNode {
|
|
27822
|
-
startHandle = null;
|
|
27823
|
-
endHandle = null;
|
|
27824
28013
|
nodeType = WEAVE_STROKE_SINGLE_NODE_TYPE;
|
|
27825
28014
|
tipManagers = {
|
|
27826
28015
|
[WEAVE_STROKE_SINGLE_NODE_TIP_TYPE.ARROW]: new WeaveArrowLineTipManager(),
|
|
@@ -27831,24 +28020,29 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
|
|
|
27831
28020
|
constructor(params) {
|
|
27832
28021
|
super();
|
|
27833
28022
|
this.config = mergeExceptArrays(WEAVE_STROKE_SINGLE_NODE_DEFAULT_CONFIG, params?.config ?? {});
|
|
27834
|
-
this.handleNodeChanges = null;
|
|
27835
|
-
this.handleZoomChanges = null;
|
|
27836
|
-
this.shiftPressed = false;
|
|
27837
28023
|
this.snapper = new GreedySnapper({
|
|
27838
28024
|
snapAngles: this.config.snapAngles.angles,
|
|
27839
28025
|
activateThreshold: this.config.snapAngles.activateThreshold,
|
|
27840
28026
|
releaseThreshold: this.config.snapAngles.releaseThreshold
|
|
27841
28027
|
});
|
|
28028
|
+
this.initialize();
|
|
28029
|
+
}
|
|
28030
|
+
initialize() {
|
|
27842
28031
|
this.eventsInitialized = false;
|
|
28032
|
+
this.startHandle = null;
|
|
28033
|
+
this.endHandle = null;
|
|
28034
|
+
this.handleNodeChanges = null;
|
|
28035
|
+
this.handleZoomChanges = null;
|
|
28036
|
+
this.shiftPressed = false;
|
|
27843
28037
|
}
|
|
27844
28038
|
initEvents() {
|
|
27845
28039
|
if (this.eventsInitialized) return;
|
|
27846
28040
|
window.addEventListener("keydown", (e) => {
|
|
27847
28041
|
if (e.key === "Shift") this.shiftPressed = true;
|
|
27848
|
-
});
|
|
28042
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
27849
28043
|
window.addEventListener("keyup", (e) => {
|
|
27850
28044
|
if (e.key === "Shift") this.shiftPressed = false;
|
|
27851
|
-
});
|
|
28045
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
27852
28046
|
this.eventsInitialized = true;
|
|
27853
28047
|
}
|
|
27854
28048
|
onRender(props) {
|
|
@@ -28335,6 +28529,9 @@ var WeaveCommentNode = class extends WeaveNode {
|
|
|
28335
28529
|
constructor(params) {
|
|
28336
28530
|
super();
|
|
28337
28531
|
this.config = mergeExceptArrays(WEAVE_COMMENT_NODE_DEFAULTS, params.config);
|
|
28532
|
+
this.initialize();
|
|
28533
|
+
}
|
|
28534
|
+
initialize() {
|
|
28338
28535
|
this.commentDomVisibleId = null;
|
|
28339
28536
|
this.commentDomVisible = false;
|
|
28340
28537
|
this.commentDomAction = null;
|
|
@@ -28963,10 +29160,6 @@ const WEAVE_VIDEO_DEFAULT_CONFIG = {
|
|
|
28963
29160
|
//#endregion
|
|
28964
29161
|
//#region src/nodes/video/video.ts
|
|
28965
29162
|
var WeaveVideoNode = class extends WeaveNode {
|
|
28966
|
-
videoState = {};
|
|
28967
|
-
videoSourceFrameId = {};
|
|
28968
|
-
videoSource = {};
|
|
28969
|
-
videoPlaceholder = {};
|
|
28970
29163
|
nodeType = WEAVE_VIDEO_NODE_TYPE;
|
|
28971
29164
|
constructor(params) {
|
|
28972
29165
|
super();
|
|
@@ -28979,6 +29172,13 @@ var WeaveVideoNode = class extends WeaveNode {
|
|
|
28979
29172
|
this.videoIconImage.src = this.config.style.icon.dataURL;
|
|
28980
29173
|
}
|
|
28981
29174
|
}
|
|
29175
|
+
initialize() {
|
|
29176
|
+
this.videoState = {};
|
|
29177
|
+
this.videoSource = {};
|
|
29178
|
+
this.videoSourceFrameId = {};
|
|
29179
|
+
this.videoPlaceholder = {};
|
|
29180
|
+
this.videoIconImage = void 0;
|
|
29181
|
+
}
|
|
28982
29182
|
async loadPlaceholder(params, video) {
|
|
28983
29183
|
const videoProps = params;
|
|
28984
29184
|
const { id } = videoProps;
|
|
@@ -29473,6 +29673,7 @@ const WEAVE_MEASURE_NODE_DEFAULT_CONFIG = { style: {
|
|
|
29473
29673
|
var WeaveMeasureNode = class extends WeaveNode {
|
|
29474
29674
|
nodeType = WEAVE_MEASURE_NODE_TYPE;
|
|
29475
29675
|
handlePointCircleRadius = 6;
|
|
29676
|
+
initialize = void 0;
|
|
29476
29677
|
constructor(params) {
|
|
29477
29678
|
super();
|
|
29478
29679
|
this.config = mergeExceptArrays(WEAVE_MEASURE_NODE_DEFAULT_CONFIG, params?.config ?? {});
|
|
@@ -30763,6 +30964,7 @@ var WeaveConnectorNode = class extends WeaveNode {
|
|
|
30763
30964
|
[WEAVE_CONNECTOR_NODE_DECORATOR_TYPE.DOT]: setupNodeDecoratorDot,
|
|
30764
30965
|
[WEAVE_CONNECTOR_NODE_DECORATOR_TYPE.ARROW]: setupNodeDecoratorArrow
|
|
30765
30966
|
};
|
|
30967
|
+
initialize = void 0;
|
|
30766
30968
|
constructor(params) {
|
|
30767
30969
|
super();
|
|
30768
30970
|
this.config = mergeExceptArrays(WEAVE_CONNECTOR_NODE_DEFAULT_CONFIG, params?.config);
|
|
@@ -31513,10 +31715,6 @@ const WEAVE_STAGE_ZOOM_DEFAULT_CONFIG = {
|
|
|
31513
31715
|
var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
31514
31716
|
getLayerName = void 0;
|
|
31515
31717
|
initLayer = void 0;
|
|
31516
|
-
pinching = false;
|
|
31517
|
-
zooming = false;
|
|
31518
|
-
isTrackpad = false;
|
|
31519
|
-
zoomVelocity = 0;
|
|
31520
31718
|
zoomInertiaType = WEAVE_STAGE_ZOOM_TYPE.MOUSE_WHEEL;
|
|
31521
31719
|
defaultStep = 3;
|
|
31522
31720
|
constructor(params) {
|
|
@@ -31524,8 +31722,13 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31524
31722
|
const { config } = params ?? {};
|
|
31525
31723
|
this.config = mergeExceptArrays(WEAVE_STAGE_ZOOM_DEFAULT_CONFIG, config);
|
|
31526
31724
|
if (!this.config.zoomSteps.includes(this.config.defaultZoom)) throw new Error(`Default zoom ${this.config.defaultZoom} is not in zoom steps`);
|
|
31725
|
+
this.initialize();
|
|
31726
|
+
}
|
|
31727
|
+
initialize() {
|
|
31527
31728
|
this.pinching = false;
|
|
31729
|
+
this.zooming = false;
|
|
31528
31730
|
this.isTrackpad = false;
|
|
31731
|
+
this.zoomVelocity = 0;
|
|
31529
31732
|
this.isCtrlOrMetaPressed = false;
|
|
31530
31733
|
this.updatedMinimumZoom = false;
|
|
31531
31734
|
this.actualStep = this.config.zoomSteps.findIndex((step) => step === this.config.defaultZoom);
|
|
@@ -31812,6 +32015,15 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31812
32015
|
if (box.width === 0 || box.height === 0) return;
|
|
31813
32016
|
this.fitToElements(box, finalOptions);
|
|
31814
32017
|
}
|
|
32018
|
+
fitToArea(area, options) {
|
|
32019
|
+
const finalOptions = mergeExceptArrays({
|
|
32020
|
+
smartZoom: false,
|
|
32021
|
+
overrideZoom: true
|
|
32022
|
+
}, options);
|
|
32023
|
+
if (!this.enabled) return;
|
|
32024
|
+
if (area.width === 0 || area.height === 0) return;
|
|
32025
|
+
this.fitToElements(area, finalOptions);
|
|
32026
|
+
}
|
|
31815
32027
|
enable() {
|
|
31816
32028
|
this.enabled = true;
|
|
31817
32029
|
}
|
|
@@ -31830,10 +32042,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31830
32042
|
initEvents() {
|
|
31831
32043
|
window.addEventListener("keydown", (e) => {
|
|
31832
32044
|
if (e.ctrlKey || e.metaKey) this.isCtrlOrMetaPressed = true;
|
|
31833
|
-
});
|
|
32045
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
31834
32046
|
window.addEventListener("keyup", (e) => {
|
|
31835
32047
|
if (!(e.ctrlKey || e.metaKey)) this.isCtrlOrMetaPressed = false;
|
|
31836
|
-
});
|
|
32048
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
31837
32049
|
const stage = this.instance.getStage();
|
|
31838
32050
|
let lastCenter = null;
|
|
31839
32051
|
let lastDist = 0;
|
|
@@ -31858,7 +32070,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31858
32070
|
return;
|
|
31859
32071
|
}
|
|
31860
32072
|
}
|
|
31861
|
-
}, {
|
|
32073
|
+
}, {
|
|
32074
|
+
passive: false,
|
|
32075
|
+
signal: this.instance.getEventsController()?.signal
|
|
32076
|
+
});
|
|
31862
32077
|
stage.getContent().addEventListener("touchmove", (e) => {
|
|
31863
32078
|
e.preventDefault();
|
|
31864
32079
|
if (e.touches.length === 2) {
|
|
@@ -31898,12 +32113,18 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31898
32113
|
lastDist = dist;
|
|
31899
32114
|
lastCenter = newCenter;
|
|
31900
32115
|
}
|
|
31901
|
-
}, {
|
|
32116
|
+
}, {
|
|
32117
|
+
passive: false,
|
|
32118
|
+
signal: this.instance.getEventsController()?.signal
|
|
32119
|
+
});
|
|
31902
32120
|
stage.getContent().addEventListener("touchend", () => {
|
|
31903
32121
|
this.pinching = false;
|
|
31904
32122
|
lastDist = 0;
|
|
31905
32123
|
lastCenter = null;
|
|
31906
|
-
}, {
|
|
32124
|
+
}, {
|
|
32125
|
+
passive: false,
|
|
32126
|
+
signal: this.instance.getEventsController()?.signal
|
|
32127
|
+
});
|
|
31907
32128
|
let doZoom = false;
|
|
31908
32129
|
const handleWheelImmediate = (e) => {
|
|
31909
32130
|
const performZoom = this.isCtrlOrMetaPressed || !this.isCtrlOrMetaPressed && e.ctrlKey && e.deltaMode === 0;
|
|
@@ -31921,7 +32142,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31921
32142
|
e.preventDefault();
|
|
31922
32143
|
doZoom = true;
|
|
31923
32144
|
};
|
|
31924
|
-
window.addEventListener("wheel", handleWheelImmediate, {
|
|
32145
|
+
window.addEventListener("wheel", handleWheelImmediate, {
|
|
32146
|
+
signal: this.instance.getEventsController()?.signal,
|
|
32147
|
+
passive: false
|
|
32148
|
+
});
|
|
31925
32149
|
const handleWheel = (e) => {
|
|
31926
32150
|
if (!doZoom) return;
|
|
31927
32151
|
const delta = e.deltaY > 0 ? 1 : -1;
|
|
@@ -31934,7 +32158,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31934
32158
|
}
|
|
31935
32159
|
};
|
|
31936
32160
|
const throttledHandleWheel = (0, import_lodash.throttle)(handleWheel, DEFAULT_THROTTLE_MS);
|
|
31937
|
-
window.addEventListener("wheel", throttledHandleWheel, {
|
|
32161
|
+
window.addEventListener("wheel", throttledHandleWheel, {
|
|
32162
|
+
signal: this.instance.getEventsController()?.signal,
|
|
32163
|
+
passive: true
|
|
32164
|
+
});
|
|
31938
32165
|
}
|
|
31939
32166
|
getInertiaScale() {
|
|
31940
32167
|
const stage = this.instance.getStage();
|
|
@@ -31992,6 +32219,7 @@ const ZOOM_OUT_TOOL_ACTION_NAME = "zoomOutTool";
|
|
|
31992
32219
|
//#region src/actions/zoom-out-tool/zoom-out-tool.ts
|
|
31993
32220
|
var WeaveZoomOutToolAction = class extends WeaveAction {
|
|
31994
32221
|
onPropsChange = void 0;
|
|
32222
|
+
initialize = void 0;
|
|
31995
32223
|
getName() {
|
|
31996
32224
|
return ZOOM_OUT_TOOL_ACTION_NAME;
|
|
31997
32225
|
}
|
|
@@ -32026,6 +32254,10 @@ const ZOOM_IN_TOOL_ACTION_NAME = "zoomInTool";
|
|
|
32026
32254
|
//#region src/actions/zoom-in-tool/zoom-in-tool.ts
|
|
32027
32255
|
var WeaveZoomInToolAction = class extends WeaveAction {
|
|
32028
32256
|
onPropsChange = void 0;
|
|
32257
|
+
initialize = void 0;
|
|
32258
|
+
constructor() {
|
|
32259
|
+
super();
|
|
32260
|
+
}
|
|
32029
32261
|
getName() {
|
|
32030
32262
|
return ZOOM_IN_TOOL_ACTION_NAME;
|
|
32031
32263
|
}
|
|
@@ -32060,6 +32292,10 @@ const FIT_TO_SCREEN_TOOL_ACTION_NAME = "fitToScreenTool";
|
|
|
32060
32292
|
//#region src/actions/fit-to-screen-tool/fit-to-screen-tool.ts
|
|
32061
32293
|
var WeaveFitToScreenToolAction = class extends WeaveAction {
|
|
32062
32294
|
onPropsChange = void 0;
|
|
32295
|
+
initialize = void 0;
|
|
32296
|
+
constructor() {
|
|
32297
|
+
super();
|
|
32298
|
+
}
|
|
32063
32299
|
getName() {
|
|
32064
32300
|
return FIT_TO_SCREEN_TOOL_ACTION_NAME;
|
|
32065
32301
|
}
|
|
@@ -32093,6 +32329,10 @@ const FIT_TO_SELECTION_TOOL_ACTION_NAME = "fitToSelectionTool";
|
|
|
32093
32329
|
//#region src/actions/fit-to-selection-tool/fit-to-selection-tool.ts
|
|
32094
32330
|
var WeaveFitToSelectionToolAction = class extends WeaveAction {
|
|
32095
32331
|
onPropsChange = void 0;
|
|
32332
|
+
initialize = void 0;
|
|
32333
|
+
constructor() {
|
|
32334
|
+
super();
|
|
32335
|
+
}
|
|
32096
32336
|
getName() {
|
|
32097
32337
|
return FIT_TO_SELECTION_TOOL_ACTION_NAME;
|
|
32098
32338
|
}
|
|
@@ -32135,6 +32375,9 @@ var WeaveMoveToolAction = class extends WeaveAction {
|
|
|
32135
32375
|
onInit = void 0;
|
|
32136
32376
|
constructor() {
|
|
32137
32377
|
super();
|
|
32378
|
+
this.initialize();
|
|
32379
|
+
}
|
|
32380
|
+
initialize() {
|
|
32138
32381
|
this.initialized = false;
|
|
32139
32382
|
this.state = MOVE_TOOL_STATE.IDLE;
|
|
32140
32383
|
}
|
|
@@ -32148,7 +32391,7 @@ var WeaveMoveToolAction = class extends WeaveAction {
|
|
|
32148
32391
|
this.cancelAction();
|
|
32149
32392
|
return;
|
|
32150
32393
|
}
|
|
32151
|
-
});
|
|
32394
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32152
32395
|
stage.on("pointerdown", () => {
|
|
32153
32396
|
if ([MOVE_TOOL_ACTION_NAME].includes(this.instance.getActiveAction() ?? "")) stage.container().style.cursor = "grabbing";
|
|
32154
32397
|
});
|
|
@@ -32207,6 +32450,9 @@ var WeaveSelectionToolAction = class extends WeaveAction {
|
|
|
32207
32450
|
onInit = void 0;
|
|
32208
32451
|
constructor() {
|
|
32209
32452
|
super();
|
|
32453
|
+
this.initialize();
|
|
32454
|
+
}
|
|
32455
|
+
initialize() {
|
|
32210
32456
|
this.initialized = false;
|
|
32211
32457
|
this.state = SELECTION_TOOL_STATE.IDLE;
|
|
32212
32458
|
}
|
|
@@ -32270,6 +32516,9 @@ var WeaveEraserToolAction = class extends WeaveAction {
|
|
|
32270
32516
|
onInit = void 0;
|
|
32271
32517
|
constructor() {
|
|
32272
32518
|
super();
|
|
32519
|
+
this.initialize();
|
|
32520
|
+
}
|
|
32521
|
+
initialize() {
|
|
32273
32522
|
this.initialized = false;
|
|
32274
32523
|
this.erasing = false;
|
|
32275
32524
|
this.state = ERASER_TOOL_STATE.IDLE;
|
|
@@ -32303,7 +32552,7 @@ var WeaveEraserToolAction = class extends WeaveAction {
|
|
|
32303
32552
|
this.cancelAction();
|
|
32304
32553
|
return;
|
|
32305
32554
|
}
|
|
32306
|
-
});
|
|
32555
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32307
32556
|
this.initialized = true;
|
|
32308
32557
|
}
|
|
32309
32558
|
setState(state) {
|
|
@@ -32370,6 +32619,9 @@ var WeaveRectangleToolAction = class extends WeaveAction {
|
|
|
32370
32619
|
onInit = void 0;
|
|
32371
32620
|
constructor() {
|
|
32372
32621
|
super();
|
|
32622
|
+
this.initialize();
|
|
32623
|
+
}
|
|
32624
|
+
initialize() {
|
|
32373
32625
|
this.pointers = new Map();
|
|
32374
32626
|
this.initialized = false;
|
|
32375
32627
|
this.state = RECTANGLE_TOOL_STATE.IDLE;
|
|
@@ -32405,7 +32657,7 @@ var WeaveRectangleToolAction = class extends WeaveAction {
|
|
|
32405
32657
|
this.cancelAction();
|
|
32406
32658
|
return;
|
|
32407
32659
|
}
|
|
32408
|
-
});
|
|
32660
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32409
32661
|
stage.on("pointermove", () => {
|
|
32410
32662
|
if (this.state === RECTANGLE_TOOL_STATE.IDLE) return;
|
|
32411
32663
|
this.setCursor();
|
|
@@ -32579,6 +32831,9 @@ var WeaveEllipseToolAction = class extends WeaveAction {
|
|
|
32579
32831
|
onInit = void 0;
|
|
32580
32832
|
constructor() {
|
|
32581
32833
|
super();
|
|
32834
|
+
this.initialize();
|
|
32835
|
+
}
|
|
32836
|
+
initialize() {
|
|
32582
32837
|
this.pointers = new Map();
|
|
32583
32838
|
this.initialized = false;
|
|
32584
32839
|
this.state = ELLIPSE_TOOL_STATE.IDLE;
|
|
@@ -32614,7 +32869,7 @@ var WeaveEllipseToolAction = class extends WeaveAction {
|
|
|
32614
32869
|
this.cancelAction();
|
|
32615
32870
|
return;
|
|
32616
32871
|
}
|
|
32617
|
-
});
|
|
32872
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32618
32873
|
stage.on("pointerdown", (e) => {
|
|
32619
32874
|
this.setTapStart(e);
|
|
32620
32875
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -32795,6 +33050,9 @@ var WeavePenToolAction = class extends WeaveAction {
|
|
|
32795
33050
|
onInit = void 0;
|
|
32796
33051
|
constructor() {
|
|
32797
33052
|
super();
|
|
33053
|
+
this.initialize();
|
|
33054
|
+
}
|
|
33055
|
+
initialize() {
|
|
32798
33056
|
this.pointers = new Map();
|
|
32799
33057
|
this.initialized = false;
|
|
32800
33058
|
this.state = PEN_TOOL_STATE.IDLE;
|
|
@@ -32830,7 +33088,7 @@ var WeavePenToolAction = class extends WeaveAction {
|
|
|
32830
33088
|
this.cancelAction();
|
|
32831
33089
|
return;
|
|
32832
33090
|
}
|
|
32833
|
-
});
|
|
33091
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32834
33092
|
stage.on("pointerdown", (e) => {
|
|
32835
33093
|
this.setTapStart(e);
|
|
32836
33094
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -33067,6 +33325,9 @@ var WeaveLineToolAction = class extends WeaveAction {
|
|
|
33067
33325
|
constructor(params) {
|
|
33068
33326
|
super();
|
|
33069
33327
|
this.config = mergeExceptArrays(LINE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
|
|
33328
|
+
this.initialize();
|
|
33329
|
+
}
|
|
33330
|
+
initialize() {
|
|
33070
33331
|
this.pointers = new Map();
|
|
33071
33332
|
this.initialized = false;
|
|
33072
33333
|
this.state = LINE_TOOL_STATE.IDLE;
|
|
@@ -33111,13 +33372,13 @@ var WeaveLineToolAction = class extends WeaveAction {
|
|
|
33111
33372
|
this.snappedAngle = null;
|
|
33112
33373
|
this.shiftPressed = true;
|
|
33113
33374
|
}
|
|
33114
|
-
});
|
|
33375
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33115
33376
|
window.addEventListener("keyup", (e) => {
|
|
33116
33377
|
if (e.key === "Shift" && this.instance.getActiveAction() === LINE_TOOL_ACTION_NAME) {
|
|
33117
33378
|
this.snappedAngle = null;
|
|
33118
33379
|
this.shiftPressed = false;
|
|
33119
33380
|
}
|
|
33120
|
-
});
|
|
33381
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33121
33382
|
stage.on("pointerdown", (e) => {
|
|
33122
33383
|
this.setTapStart(e);
|
|
33123
33384
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -33332,6 +33593,9 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
33332
33593
|
constructor(params) {
|
|
33333
33594
|
super();
|
|
33334
33595
|
this.config = mergeExceptArrays(BRUSH_TOOL_DEFAULT_CONFIG, params?.config ?? {});
|
|
33596
|
+
this.initialize();
|
|
33597
|
+
}
|
|
33598
|
+
initialize() {
|
|
33335
33599
|
this.initialized = false;
|
|
33336
33600
|
this.state = BRUSH_TOOL_STATE.INACTIVE;
|
|
33337
33601
|
this.strokeId = null;
|
|
@@ -33360,7 +33624,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
33360
33624
|
const stage = this.instance.getStage();
|
|
33361
33625
|
window.addEventListener("keyup", (e) => {
|
|
33362
33626
|
if (e.code === "Space" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) this.isSpacePressed = false;
|
|
33363
|
-
});
|
|
33627
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33364
33628
|
window.addEventListener("keydown", (e) => {
|
|
33365
33629
|
if (e.code === "Enter" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) {
|
|
33366
33630
|
e.stopPropagation();
|
|
@@ -33376,7 +33640,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
33376
33640
|
e.stopPropagation();
|
|
33377
33641
|
this.cancelAction();
|
|
33378
33642
|
}
|
|
33379
|
-
});
|
|
33643
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33380
33644
|
const handlePointerDown = (e) => {
|
|
33381
33645
|
if (this.state === BRUSH_TOOL_STATE.INACTIVE) return;
|
|
33382
33646
|
if (this.state !== BRUSH_TOOL_STATE.IDLE) return;
|
|
@@ -33585,6 +33849,9 @@ var WeaveTextToolAction = class extends WeaveAction {
|
|
|
33585
33849
|
onInit = void 0;
|
|
33586
33850
|
constructor() {
|
|
33587
33851
|
super();
|
|
33852
|
+
this.initialize();
|
|
33853
|
+
}
|
|
33854
|
+
initialize() {
|
|
33588
33855
|
this.initialized = false;
|
|
33589
33856
|
this.state = TEXT_TOOL_STATE.IDLE;
|
|
33590
33857
|
this.textId = null;
|
|
@@ -33614,7 +33881,7 @@ var WeaveTextToolAction = class extends WeaveAction {
|
|
|
33614
33881
|
this.cancelAction();
|
|
33615
33882
|
return;
|
|
33616
33883
|
}
|
|
33617
|
-
});
|
|
33884
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33618
33885
|
stage.on("pointermove", () => {
|
|
33619
33886
|
if (this.state === TEXT_TOOL_STATE.IDLE) return;
|
|
33620
33887
|
this.setCursor();
|
|
@@ -33742,6 +34009,9 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
33742
34009
|
constructor(params) {
|
|
33743
34010
|
super();
|
|
33744
34011
|
this.config = mergeExceptArrays(WEAVE_IMAGE_TOOL_CONFIG_DEFAULT, params?.config ?? {});
|
|
34012
|
+
this.initialize();
|
|
34013
|
+
}
|
|
34014
|
+
initialize() {
|
|
33745
34015
|
this.pointers = new Map();
|
|
33746
34016
|
this.initialized = false;
|
|
33747
34017
|
this.imageId = null;
|
|
@@ -33785,7 +34055,7 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
33785
34055
|
this.cancelAction();
|
|
33786
34056
|
return;
|
|
33787
34057
|
}
|
|
33788
|
-
});
|
|
34058
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33789
34059
|
stage.on("pointerdown", (e) => {
|
|
33790
34060
|
this.setTapStart(e);
|
|
33791
34061
|
if (this.ignorePointerEvents) return;
|
|
@@ -34182,6 +34452,9 @@ var WeaveImagesToolAction = class extends WeaveAction {
|
|
|
34182
34452
|
constructor(params) {
|
|
34183
34453
|
super();
|
|
34184
34454
|
this.config = mergeExceptArrays(WEAVE_IMAGES_TOOL_DEFAULT_CONFIG, params ?? {});
|
|
34455
|
+
this.initialize();
|
|
34456
|
+
}
|
|
34457
|
+
initialize() {
|
|
34185
34458
|
this.pointers = new Map();
|
|
34186
34459
|
this.initialized = false;
|
|
34187
34460
|
this.tempPointerFeedbackNode = null;
|
|
@@ -34228,7 +34501,7 @@ var WeaveImagesToolAction = class extends WeaveAction {
|
|
|
34228
34501
|
const stage = this.instance.getStage();
|
|
34229
34502
|
stage.container().addEventListener("keydown", (e) => {
|
|
34230
34503
|
if (e.key === "Escape" && this.instance.getActiveAction() === WEAVE_IMAGES_TOOL_ACTION_NAME) this.cancelAction();
|
|
34231
|
-
});
|
|
34504
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
34232
34505
|
stage.on("pointerdown", (e) => {
|
|
34233
34506
|
this.setTapStart(e);
|
|
34234
34507
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -34610,6 +34883,9 @@ var WeaveStarToolAction = class extends WeaveAction {
|
|
|
34610
34883
|
onInit = void 0;
|
|
34611
34884
|
constructor() {
|
|
34612
34885
|
super();
|
|
34886
|
+
this.initialize();
|
|
34887
|
+
}
|
|
34888
|
+
initialize() {
|
|
34613
34889
|
this.pointers = new Map();
|
|
34614
34890
|
this.initialized = false;
|
|
34615
34891
|
this.state = STAR_TOOL_STATE.IDLE;
|
|
@@ -34646,7 +34922,7 @@ var WeaveStarToolAction = class extends WeaveAction {
|
|
|
34646
34922
|
this.cancelAction();
|
|
34647
34923
|
return;
|
|
34648
34924
|
}
|
|
34649
|
-
});
|
|
34925
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
34650
34926
|
stage.on("pointerdown", (e) => {
|
|
34651
34927
|
this.setTapStart(e);
|
|
34652
34928
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -34811,8 +35087,8 @@ var WeaveStarToolAction = class extends WeaveAction {
|
|
|
34811
35087
|
|
|
34812
35088
|
//#endregion
|
|
34813
35089
|
//#region src/actions/arrow-tool/constants.ts
|
|
34814
|
-
const
|
|
34815
|
-
const
|
|
35090
|
+
const WEAVE_ARROW_TOOL_ACTION_NAME = "arrowTool";
|
|
35091
|
+
const WEAVE_ARROW_TOOL_STATE = {
|
|
34816
35092
|
["IDLE"]: "idle",
|
|
34817
35093
|
["ADDING"]: "adding",
|
|
34818
35094
|
["DEFINING_SIZE"]: "definingSize",
|
|
@@ -34828,9 +35104,12 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34828
35104
|
onInit = void 0;
|
|
34829
35105
|
constructor() {
|
|
34830
35106
|
super();
|
|
35107
|
+
this.initialize();
|
|
35108
|
+
}
|
|
35109
|
+
initialize() {
|
|
34831
35110
|
this.pointers = new Map();
|
|
34832
35111
|
this.initialized = false;
|
|
34833
|
-
this.state =
|
|
35112
|
+
this.state = WEAVE_ARROW_TOOL_STATE.IDLE;
|
|
34834
35113
|
this.arrowId = null;
|
|
34835
35114
|
this.tempArrowId = null;
|
|
34836
35115
|
this.tempMainArrowNode = null;
|
|
@@ -34843,7 +35122,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34843
35122
|
this.props = this.initProps();
|
|
34844
35123
|
}
|
|
34845
35124
|
getName() {
|
|
34846
|
-
return
|
|
35125
|
+
return WEAVE_ARROW_TOOL_ACTION_NAME;
|
|
34847
35126
|
}
|
|
34848
35127
|
initProps() {
|
|
34849
35128
|
return {
|
|
@@ -34860,40 +35139,37 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34860
35139
|
setupEvents() {
|
|
34861
35140
|
const stage = this.instance.getStage();
|
|
34862
35141
|
window.addEventListener("keydown", (e) => {
|
|
34863
|
-
if (e.code === "Enter" && this.instance.getActiveAction() ===
|
|
35142
|
+
if (e.code === "Enter" && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
|
|
34864
35143
|
this.cancelAction();
|
|
34865
35144
|
return;
|
|
34866
35145
|
}
|
|
34867
|
-
if (e.code === "Escape" && this.instance.getActiveAction() ===
|
|
34868
|
-
|
|
34869
|
-
return;
|
|
34870
|
-
}
|
|
34871
|
-
});
|
|
35146
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) this.cancelAction();
|
|
35147
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
34872
35148
|
stage.on("pointerdown", (e) => {
|
|
34873
35149
|
this.setTapStart(e);
|
|
34874
35150
|
this.pointers.set(e.evt.pointerId, {
|
|
34875
35151
|
x: e.evt.clientX,
|
|
34876
35152
|
y: e.evt.clientY
|
|
34877
35153
|
});
|
|
34878
|
-
if (this.pointers.size === 2 && this.instance.getActiveAction() ===
|
|
34879
|
-
this.state =
|
|
35154
|
+
if (this.pointers.size === 2 && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
|
|
35155
|
+
this.state = WEAVE_ARROW_TOOL_STATE.ADDING;
|
|
34880
35156
|
return;
|
|
34881
35157
|
}
|
|
34882
|
-
if (!this.tempMainArrowNode && this.state ===
|
|
34883
|
-
if (this.tempMainArrowNode && this.state ===
|
|
35158
|
+
if (!this.tempMainArrowNode && this.state === WEAVE_ARROW_TOOL_STATE.ADDING) this.handleAdding();
|
|
35159
|
+
if (this.tempMainArrowNode && this.state === WEAVE_ARROW_TOOL_STATE.ADDING) this.state = WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE;
|
|
34884
35160
|
});
|
|
34885
35161
|
stage.on("pointermove", () => {
|
|
34886
|
-
if (this.state ===
|
|
35162
|
+
if (this.state === WEAVE_ARROW_TOOL_STATE.IDLE) return;
|
|
34887
35163
|
this.setCursor();
|
|
34888
|
-
if (this.pointers.size === 2 && this.instance.getActiveAction() ===
|
|
34889
|
-
this.state =
|
|
35164
|
+
if (this.pointers.size === 2 && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
|
|
35165
|
+
this.state = WEAVE_ARROW_TOOL_STATE.ADDING;
|
|
34890
35166
|
return;
|
|
34891
35167
|
}
|
|
34892
|
-
if (this.state ===
|
|
35168
|
+
if (this.state === WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) this.handleMovement();
|
|
34893
35169
|
});
|
|
34894
35170
|
stage.on("pointerup", (e) => {
|
|
34895
35171
|
this.pointers.delete(e.evt.pointerId);
|
|
34896
|
-
if (this.state ===
|
|
35172
|
+
if (this.state === WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) this.handleSettingSize();
|
|
34897
35173
|
});
|
|
34898
35174
|
this.initialized = true;
|
|
34899
35175
|
}
|
|
@@ -34907,7 +35183,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34907
35183
|
this.tempPoint = void 0;
|
|
34908
35184
|
this.tempNextPoint = void 0;
|
|
34909
35185
|
this.clickPoint = null;
|
|
34910
|
-
this.setState(
|
|
35186
|
+
this.setState(WEAVE_ARROW_TOOL_STATE.ADDING);
|
|
34911
35187
|
}
|
|
34912
35188
|
handleAdding() {
|
|
34913
35189
|
const stage = this.instance.getStage();
|
|
@@ -34958,7 +35234,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34958
35234
|
this.measureContainer?.add(this.tempNextPoint);
|
|
34959
35235
|
this.tempPoint.moveToTop();
|
|
34960
35236
|
this.tempNextPoint.moveToTop();
|
|
34961
|
-
this.setState(
|
|
35237
|
+
this.setState(WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE);
|
|
34962
35238
|
}
|
|
34963
35239
|
}
|
|
34964
35240
|
handleSettingSize() {
|
|
@@ -34985,11 +35261,11 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34985
35261
|
y: mousePoint.y,
|
|
34986
35262
|
points: [0, 0]
|
|
34987
35263
|
});
|
|
34988
|
-
this.setState(
|
|
35264
|
+
this.setState(WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE);
|
|
34989
35265
|
}
|
|
34990
35266
|
}
|
|
34991
35267
|
handleMovement() {
|
|
34992
|
-
if (this.state !==
|
|
35268
|
+
if (this.state !== WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) return;
|
|
34993
35269
|
if (this.arrowId && this.tempArrowNode && this.measureContainer && this.tempNextPoint) {
|
|
34994
35270
|
const { mousePoint } = this.instance.getMousePointerRelativeToContainer(this.measureContainer);
|
|
34995
35271
|
this.tempArrowNode.setAttrs({
|
|
@@ -35056,7 +35332,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
35056
35332
|
this.container = void 0;
|
|
35057
35333
|
this.measureContainer = void 0;
|
|
35058
35334
|
this.clickPoint = null;
|
|
35059
|
-
this.setState(
|
|
35335
|
+
this.setState(WEAVE_ARROW_TOOL_STATE.IDLE);
|
|
35060
35336
|
}
|
|
35061
35337
|
setCursor() {
|
|
35062
35338
|
const stage = this.instance.getStage();
|
|
@@ -35100,13 +35376,15 @@ const WEAVE_STROKE_TOOL_DEFAULT_CONFIG = { snapAngles: {
|
|
|
35100
35376
|
var WeaveStrokeToolAction = class extends WeaveAction {
|
|
35101
35377
|
initialized = false;
|
|
35102
35378
|
initialCursor = null;
|
|
35103
|
-
snappedAngle = null;
|
|
35104
35379
|
shiftPressed = false;
|
|
35105
35380
|
onPropsChange = void 0;
|
|
35106
35381
|
onInit = void 0;
|
|
35107
35382
|
constructor(params) {
|
|
35108
35383
|
super();
|
|
35109
35384
|
this.config = mergeExceptArrays(WEAVE_STROKE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
|
|
35385
|
+
this.initialize();
|
|
35386
|
+
}
|
|
35387
|
+
initialize() {
|
|
35110
35388
|
this.pointers = new Map();
|
|
35111
35389
|
this.initialized = false;
|
|
35112
35390
|
this.state = WEAVE_STROKE_TOOL_STATE.IDLE;
|
|
@@ -35115,7 +35393,6 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35115
35393
|
this.tempLineId = null;
|
|
35116
35394
|
this.tempLineNode = null;
|
|
35117
35395
|
this.container = void 0;
|
|
35118
|
-
this.snappedAngle = null;
|
|
35119
35396
|
this.measureContainer = void 0;
|
|
35120
35397
|
this.clickPoint = null;
|
|
35121
35398
|
this.snapper = new GreedySnapper({
|
|
@@ -35128,6 +35405,9 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35128
35405
|
getName() {
|
|
35129
35406
|
return WEAVE_STROKE_TOOL_ACTION_NAME;
|
|
35130
35407
|
}
|
|
35408
|
+
getNames() {
|
|
35409
|
+
return [WEAVE_STROKE_TOOL_ACTION_NAME, ...WEAVE_STROKE_TOOL_ACTION_NAME_ALIASES];
|
|
35410
|
+
}
|
|
35131
35411
|
hasAliases() {
|
|
35132
35412
|
return true;
|
|
35133
35413
|
}
|
|
@@ -35146,32 +35426,26 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35146
35426
|
setupEvents() {
|
|
35147
35427
|
const stage = this.instance.getStage();
|
|
35148
35428
|
window.addEventListener("keydown", (e) => {
|
|
35149
|
-
if (e.code === "Enter" && this.instance.getActiveAction()
|
|
35429
|
+
if (e.code === "Enter" && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
|
|
35150
35430
|
this.cancelAction();
|
|
35151
35431
|
return;
|
|
35152
35432
|
}
|
|
35153
|
-
if (e.code === "Escape" && this.instance.getActiveAction()
|
|
35433
|
+
if (e.code === "Escape" && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
|
|
35154
35434
|
this.cancelAction();
|
|
35155
35435
|
return;
|
|
35156
35436
|
}
|
|
35157
|
-
if (e.key === "Shift" && this.instance.getActiveAction()
|
|
35158
|
-
|
|
35159
|
-
this.shiftPressed = true;
|
|
35160
|
-
}
|
|
35161
|
-
});
|
|
35437
|
+
if (e.key === "Shift" && this.getNames().includes(this.instance.getActiveAction() ?? "")) this.shiftPressed = true;
|
|
35438
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35162
35439
|
window.addEventListener("keyup", (e) => {
|
|
35163
|
-
if (e.key === "Shift" && this.instance.getActiveAction()
|
|
35164
|
-
|
|
35165
|
-
this.shiftPressed = false;
|
|
35166
|
-
}
|
|
35167
|
-
});
|
|
35440
|
+
if (e.key === "Shift" && this.getNames().includes(this.instance.getActiveAction() ?? "")) this.shiftPressed = false;
|
|
35441
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35168
35442
|
stage.on("pointerdown", (e) => {
|
|
35169
35443
|
this.setTapStart(e);
|
|
35170
35444
|
this.pointers.set(e.evt.pointerId, {
|
|
35171
35445
|
x: e.evt.clientX,
|
|
35172
35446
|
y: e.evt.clientY
|
|
35173
35447
|
});
|
|
35174
|
-
if (this.pointers.size === 2 && this.instance.getActiveAction()
|
|
35448
|
+
if (this.pointers.size === 2 && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
|
|
35175
35449
|
this.state = WEAVE_STROKE_TOOL_STATE.ADDING;
|
|
35176
35450
|
return;
|
|
35177
35451
|
}
|
|
@@ -35181,7 +35455,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35181
35455
|
stage.on("pointermove", () => {
|
|
35182
35456
|
if (this.state === WEAVE_STROKE_TOOL_STATE.IDLE) return;
|
|
35183
35457
|
this.setCursor();
|
|
35184
|
-
if (this.pointers.size === 2 && this.instance.getActiveAction()
|
|
35458
|
+
if (this.pointers.size === 2 && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
|
|
35185
35459
|
this.state = WEAVE_STROKE_TOOL_STATE.ADDING;
|
|
35186
35460
|
return;
|
|
35187
35461
|
}
|
|
@@ -35199,7 +35473,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35199
35473
|
addLine() {
|
|
35200
35474
|
this.setCursor();
|
|
35201
35475
|
this.setFocusStage();
|
|
35202
|
-
this.instance.emitEvent("onAddingStroke", { actionName: this.instance.getActiveAction() ??
|
|
35476
|
+
this.instance.emitEvent("onAddingStroke", { actionName: this.instance.getActiveAction() ?? "not-defined" });
|
|
35203
35477
|
this.shiftPressed = false;
|
|
35204
35478
|
this.clickPoint = null;
|
|
35205
35479
|
this.setState(WEAVE_STROKE_TOOL_STATE.ADDING);
|
|
@@ -35307,7 +35581,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35307
35581
|
});
|
|
35308
35582
|
delete finalLine.props.dragBoundFunc;
|
|
35309
35583
|
this.instance.addNode(finalLine, this.container?.getAttrs().id);
|
|
35310
|
-
this.instance.emitEvent("onAddedStroke", { actionName: this.instance.getActiveAction() ??
|
|
35584
|
+
this.instance.emitEvent("onAddedStroke", { actionName: this.instance.getActiveAction() ?? "not-defined" });
|
|
35311
35585
|
nodeCreated = true;
|
|
35312
35586
|
}
|
|
35313
35587
|
}
|
|
@@ -35357,6 +35631,9 @@ var WeaveRegularPolygonToolAction = class extends WeaveAction {
|
|
|
35357
35631
|
onInit = void 0;
|
|
35358
35632
|
constructor() {
|
|
35359
35633
|
super();
|
|
35634
|
+
this.initialize();
|
|
35635
|
+
}
|
|
35636
|
+
initialize() {
|
|
35360
35637
|
this.pointers = new Map();
|
|
35361
35638
|
this.initialized = false;
|
|
35362
35639
|
this.state = REGULAR_POLYGON_TOOL_STATE.IDLE;
|
|
@@ -35391,7 +35668,7 @@ var WeaveRegularPolygonToolAction = class extends WeaveAction {
|
|
|
35391
35668
|
this.cancelAction();
|
|
35392
35669
|
return;
|
|
35393
35670
|
}
|
|
35394
|
-
});
|
|
35671
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35395
35672
|
stage.on("pointerdown", (e) => {
|
|
35396
35673
|
this.setTapStart(e);
|
|
35397
35674
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -35565,6 +35842,9 @@ var WeaveFrameToolAction = class extends WeaveAction {
|
|
|
35565
35842
|
onInit = void 0;
|
|
35566
35843
|
constructor() {
|
|
35567
35844
|
super();
|
|
35845
|
+
this.initialize();
|
|
35846
|
+
}
|
|
35847
|
+
initialize() {
|
|
35568
35848
|
this.initialized = false;
|
|
35569
35849
|
this.state = FRAME_TOOL_STATE.IDLE;
|
|
35570
35850
|
this.frameId = null;
|
|
@@ -35592,7 +35872,7 @@ var WeaveFrameToolAction = class extends WeaveAction {
|
|
|
35592
35872
|
this.cancelAction();
|
|
35593
35873
|
return;
|
|
35594
35874
|
}
|
|
35595
|
-
});
|
|
35875
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35596
35876
|
stage.on("pointermove", () => {
|
|
35597
35877
|
if (this.state === FRAME_TOOL_STATE.IDLE) return;
|
|
35598
35878
|
this.setCursor();
|
|
@@ -35694,6 +35974,10 @@ var WeaveExportStageToolAction = class extends WeaveAction {
|
|
|
35694
35974
|
};
|
|
35695
35975
|
onPropsChange = void 0;
|
|
35696
35976
|
onInit = void 0;
|
|
35977
|
+
initialize = void 0;
|
|
35978
|
+
constructor() {
|
|
35979
|
+
super();
|
|
35980
|
+
}
|
|
35697
35981
|
getName() {
|
|
35698
35982
|
return EXPORT_STAGE_TOOL_ACTION_NAME;
|
|
35699
35983
|
}
|
|
@@ -35741,6 +36025,10 @@ var WeaveExportNodesToolAction = class extends WeaveAction {
|
|
|
35741
36025
|
};
|
|
35742
36026
|
onPropsChange = void 0;
|
|
35743
36027
|
onInit = void 0;
|
|
36028
|
+
initialize = void 0;
|
|
36029
|
+
constructor() {
|
|
36030
|
+
super();
|
|
36031
|
+
}
|
|
35744
36032
|
getName() {
|
|
35745
36033
|
return EXPORT_NODES_TOOL_ACTION_NAME;
|
|
35746
36034
|
}
|
|
@@ -35793,6 +36081,9 @@ var WeaveAlignNodesToolAction = class extends WeaveAction {
|
|
|
35793
36081
|
onInit = void 0;
|
|
35794
36082
|
constructor() {
|
|
35795
36083
|
super();
|
|
36084
|
+
this.initialize();
|
|
36085
|
+
}
|
|
36086
|
+
initialize() {
|
|
35796
36087
|
this.initialized = false;
|
|
35797
36088
|
this.state = ALIGN_NODES_TOOL_STATE.IDLE;
|
|
35798
36089
|
}
|
|
@@ -36042,6 +36333,9 @@ var WeaveCommentToolAction = class extends WeaveAction {
|
|
|
36042
36333
|
super();
|
|
36043
36334
|
const { config } = params ?? {};
|
|
36044
36335
|
this.config = mergeExceptArrays(WEAVE_COMMENT_TOOL_DEFAULT_CONFIG, config);
|
|
36336
|
+
this.initialize();
|
|
36337
|
+
}
|
|
36338
|
+
initialize() {
|
|
36045
36339
|
this.pointers = new Map();
|
|
36046
36340
|
this.initialized = false;
|
|
36047
36341
|
this.state = WEAVE_COMMENT_TOOL_STATE.IDLE;
|
|
@@ -36119,7 +36413,7 @@ var WeaveCommentToolAction = class extends WeaveAction {
|
|
|
36119
36413
|
return;
|
|
36120
36414
|
}
|
|
36121
36415
|
if (e.code === "Escape" && this.state === WEAVE_COMMENT_TOOL_STATE.CREATING_COMMENT) this.setState(WEAVE_COMMENT_TOOL_STATE.ADDING);
|
|
36122
|
-
});
|
|
36416
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
36123
36417
|
stage.on("pointermove", (e) => {
|
|
36124
36418
|
if (this.state === WEAVE_COMMENT_TOOL_STATE.IDLE) return;
|
|
36125
36419
|
if (commentNodeHandler?.isCommentViewing()) {
|
|
@@ -36270,6 +36564,9 @@ var WeaveVideoToolAction = class extends WeaveAction {
|
|
|
36270
36564
|
update = void 0;
|
|
36271
36565
|
constructor() {
|
|
36272
36566
|
super();
|
|
36567
|
+
this.initialize();
|
|
36568
|
+
}
|
|
36569
|
+
initialize() {
|
|
36273
36570
|
this.pointers = new Map();
|
|
36274
36571
|
this.initialized = false;
|
|
36275
36572
|
this.state = VIDEO_TOOL_STATE.IDLE;
|
|
@@ -36316,7 +36613,7 @@ var WeaveVideoToolAction = class extends WeaveAction {
|
|
|
36316
36613
|
this.cancelAction();
|
|
36317
36614
|
return;
|
|
36318
36615
|
}
|
|
36319
|
-
});
|
|
36616
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
36320
36617
|
stage.on("pointerdown", (e) => {
|
|
36321
36618
|
this.setTapStart(e);
|
|
36322
36619
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -36495,6 +36792,9 @@ var WeaveMeasureToolAction = class extends WeaveAction {
|
|
|
36495
36792
|
constructor(params) {
|
|
36496
36793
|
super();
|
|
36497
36794
|
this.config = mergeExceptArrays(WEAVE_MEASURE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
|
|
36795
|
+
this.initialize();
|
|
36796
|
+
}
|
|
36797
|
+
initialize() {
|
|
36498
36798
|
this.initialized = false;
|
|
36499
36799
|
this.state = MEASURE_TOOL_STATE.IDLE;
|
|
36500
36800
|
this.measureId = null;
|
|
@@ -36521,7 +36821,7 @@ var WeaveMeasureToolAction = class extends WeaveAction {
|
|
|
36521
36821
|
const stage = this.instance.getStage();
|
|
36522
36822
|
window.addEventListener("keydown", (e) => {
|
|
36523
36823
|
if (e.code === "Escape" && this.instance.getActiveAction() === MEASURE_TOOL_ACTION_NAME) this.cancelAction();
|
|
36524
|
-
});
|
|
36824
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
36525
36825
|
stage.on("pointermove", () => {
|
|
36526
36826
|
if (this.state === MEASURE_TOOL_STATE.IDLE) return;
|
|
36527
36827
|
if (this.state === MEASURE_TOOL_STATE.SET_TO) {
|
|
@@ -36791,6 +37091,9 @@ var WeaveConnectorToolAction = class extends WeaveAction {
|
|
|
36791
37091
|
constructor(params) {
|
|
36792
37092
|
super();
|
|
36793
37093
|
this.config = mergeExceptArrays(CONNECTOR_TOOL_DEFAULT_CONFIG, params?.config);
|
|
37094
|
+
this.initialize();
|
|
37095
|
+
}
|
|
37096
|
+
initialize() {
|
|
36794
37097
|
this.pointers = new Map();
|
|
36795
37098
|
this.initialized = false;
|
|
36796
37099
|
this.tempLineNode = null;
|
|
@@ -36829,7 +37132,7 @@ var WeaveConnectorToolAction = class extends WeaveAction {
|
|
|
36829
37132
|
return;
|
|
36830
37133
|
}
|
|
36831
37134
|
if (e.code === "Escape" && this.instance.getActiveAction() === CONNECTOR_TOOL_ACTION_NAME) this.cancelAction();
|
|
36832
|
-
});
|
|
37135
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
36833
37136
|
let nodeHovered = void 0;
|
|
36834
37137
|
stage.on("pointermove", () => {
|
|
36835
37138
|
if (!(this.state === CONNECTOR_TOOL_STATE.SELECTING_INITIAL || this.state === CONNECTOR_TOOL_STATE.SELECTING_FINAL)) return;
|
|
@@ -37144,16 +37447,9 @@ var WeaveConnectorToolAction = class extends WeaveAction {
|
|
|
37144
37447
|
//#endregion
|
|
37145
37448
|
//#region src/plugins/stage-grid/stage-grid.ts
|
|
37146
37449
|
var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
37147
|
-
actStageZoomX = 1;
|
|
37148
|
-
actStageZoomY = 1;
|
|
37149
|
-
actStagePosX = 0;
|
|
37150
|
-
actStagePosY = 0;
|
|
37151
37450
|
constructor(params) {
|
|
37152
37451
|
super();
|
|
37153
37452
|
const { config } = params ?? {};
|
|
37154
|
-
this.moveToolActive = false;
|
|
37155
|
-
this.isMouseMiddleButtonPressed = false;
|
|
37156
|
-
this.isSpaceKeyPressed = false;
|
|
37157
37453
|
this.config = {
|
|
37158
37454
|
type: WEAVE_GRID_DEFAULT_TYPE,
|
|
37159
37455
|
gridColor: WEAVE_GRID_DEFAULT_COLOR,
|
|
@@ -37162,7 +37458,17 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37162
37458
|
gridDotMaxDotsPerAxis: WEAVE_GRID_DEFAULT_DOT_MAX_DOTS_PER_AXIS,
|
|
37163
37459
|
...config
|
|
37164
37460
|
};
|
|
37461
|
+
this.initialize();
|
|
37462
|
+
}
|
|
37463
|
+
initialize() {
|
|
37464
|
+
this.moveToolActive = false;
|
|
37465
|
+
this.isMouseMiddleButtonPressed = false;
|
|
37466
|
+
this.isSpaceKeyPressed = false;
|
|
37165
37467
|
this.forceStageChange = false;
|
|
37468
|
+
this.actStagePosX = 0;
|
|
37469
|
+
this.actStagePosY = 0;
|
|
37470
|
+
this.actStageZoomX = 1;
|
|
37471
|
+
this.actStageZoomY = 1;
|
|
37166
37472
|
}
|
|
37167
37473
|
getName() {
|
|
37168
37474
|
return WEAVE_STAGE_GRID_PLUGIN_KEY;
|
|
@@ -37187,10 +37493,10 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37187
37493
|
const stage = this.instance.getStage();
|
|
37188
37494
|
window.addEventListener("keydown", (e) => {
|
|
37189
37495
|
if (e.code === "Space") this.isSpaceKeyPressed = true;
|
|
37190
|
-
});
|
|
37496
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37191
37497
|
window.addEventListener("keyup", (e) => {
|
|
37192
37498
|
if (e.code === "Space") this.isSpaceKeyPressed = false;
|
|
37193
|
-
});
|
|
37499
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37194
37500
|
this.instance.addEventListener("onStageMove", () => {
|
|
37195
37501
|
this.onRender();
|
|
37196
37502
|
});
|
|
@@ -37424,15 +37730,14 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37424
37730
|
//#endregion
|
|
37425
37731
|
//#region src/plugins/stage-panning/stage-panning.ts
|
|
37426
37732
|
var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
37427
|
-
panning = false;
|
|
37428
|
-
currentPointer = null;
|
|
37429
|
-
stageScrollInterval = void 0;
|
|
37430
|
-
panEdgeTargets = {};
|
|
37431
37733
|
getLayerName = void 0;
|
|
37432
37734
|
initLayer = void 0;
|
|
37433
37735
|
constructor(params) {
|
|
37434
37736
|
super();
|
|
37435
37737
|
this.config = mergeExceptArrays(WEAVE_STAGE_PANNING_DEFAULT_CONFIG, params?.config ?? {});
|
|
37738
|
+
this.initialize();
|
|
37739
|
+
}
|
|
37740
|
+
initialize() {
|
|
37436
37741
|
this.pointers = new Map();
|
|
37437
37742
|
this.panning = false;
|
|
37438
37743
|
this.isDragging = false;
|
|
@@ -37444,6 +37749,9 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37444
37749
|
this.isCtrlOrMetaPressed = false;
|
|
37445
37750
|
this.isSpaceKeyPressed = false;
|
|
37446
37751
|
this.previousPointer = null;
|
|
37752
|
+
this.currentPointer = null;
|
|
37753
|
+
this.stageScrollInterval = void 0;
|
|
37754
|
+
this.panEdgeTargets = {};
|
|
37447
37755
|
}
|
|
37448
37756
|
getName() {
|
|
37449
37757
|
return WEAVE_STAGE_PANNING_KEY;
|
|
@@ -37477,7 +37785,7 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37477
37785
|
this.isSpaceKeyPressed = true;
|
|
37478
37786
|
this.setCursor();
|
|
37479
37787
|
}
|
|
37480
|
-
});
|
|
37788
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37481
37789
|
window.addEventListener("keyup", (e) => {
|
|
37482
37790
|
if (e.key === "Meta" || e.key === "Control") this.isCtrlOrMetaPressed = false;
|
|
37483
37791
|
if (e.code === "Space") {
|
|
@@ -37488,7 +37796,7 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37488
37796
|
this.isSpaceKeyPressed = false;
|
|
37489
37797
|
this.disableMove();
|
|
37490
37798
|
}
|
|
37491
|
-
});
|
|
37799
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37492
37800
|
let lastPos = null;
|
|
37493
37801
|
stage.on("pointerdown", (e) => {
|
|
37494
37802
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -37561,7 +37869,10 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37561
37869
|
this.instance.emitEvent("onStageMove");
|
|
37562
37870
|
};
|
|
37563
37871
|
const handleWheelThrottled = (0, import_lodash.throttle)(handleWheel, WEAVE_STAGE_PANNING_THROTTLE_MS);
|
|
37564
|
-
window.addEventListener("wheel", handleWheelThrottled, {
|
|
37872
|
+
window.addEventListener("wheel", handleWheelThrottled, {
|
|
37873
|
+
passive: true,
|
|
37874
|
+
signal: this.instance.getEventsController()?.signal
|
|
37875
|
+
});
|
|
37565
37876
|
stage.on("dragstart", (e) => {
|
|
37566
37877
|
const duration = 1e3 / 60;
|
|
37567
37878
|
if (this.panEdgeTargets[e.target.getAttrs().id ?? ""] !== void 0) return;
|
|
@@ -37619,7 +37930,10 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37619
37930
|
stage.container().style.setProperty("-webkit-user-drag", "none");
|
|
37620
37931
|
stage.getContent().addEventListener("touchmove", function(e) {
|
|
37621
37932
|
e.preventDefault();
|
|
37622
|
-
}, {
|
|
37933
|
+
}, {
|
|
37934
|
+
passive: false,
|
|
37935
|
+
signal: this.instance.getEventsController()?.signal
|
|
37936
|
+
});
|
|
37623
37937
|
}
|
|
37624
37938
|
isPanning() {
|
|
37625
37939
|
return this.panning;
|
|
@@ -37697,6 +38011,9 @@ var WeaveStageMinimapPlugin = class extends WeavePlugin {
|
|
|
37697
38011
|
constructor(params) {
|
|
37698
38012
|
super();
|
|
37699
38013
|
this.config = mergeExceptArrays(STAGE_MINIMAP_DEFAULT_CONFIG, params.config);
|
|
38014
|
+
this.initialize();
|
|
38015
|
+
}
|
|
38016
|
+
initialize() {
|
|
37700
38017
|
this.initialized = false;
|
|
37701
38018
|
}
|
|
37702
38019
|
getName() {
|
|
@@ -37874,6 +38191,7 @@ const WEAVE_STAGE_RESIZE_KEY = "stageResize";
|
|
|
37874
38191
|
var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
37875
38192
|
getLayerName = void 0;
|
|
37876
38193
|
initLayer = void 0;
|
|
38194
|
+
initialize = void 0;
|
|
37877
38195
|
getName() {
|
|
37878
38196
|
return WEAVE_STAGE_RESIZE_KEY;
|
|
37879
38197
|
}
|
|
@@ -37893,6 +38211,10 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
|
37893
38211
|
const pluginInstance = plugins[pluginId];
|
|
37894
38212
|
pluginInstance.onRender?.();
|
|
37895
38213
|
}
|
|
38214
|
+
this.instance.emitEvent("onStageResize", {
|
|
38215
|
+
width: stage.width(),
|
|
38216
|
+
height: stage.height()
|
|
38217
|
+
});
|
|
37896
38218
|
}
|
|
37897
38219
|
}
|
|
37898
38220
|
onInit() {
|
|
@@ -37901,7 +38223,7 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
|
37901
38223
|
}, DEFAULT_THROTTLE_MS);
|
|
37902
38224
|
window.addEventListener("resize", () => {
|
|
37903
38225
|
throttledResize();
|
|
37904
|
-
});
|
|
38226
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37905
38227
|
const resizeObserver = new ResizeObserver(() => {
|
|
37906
38228
|
throttledResize();
|
|
37907
38229
|
});
|
|
@@ -37919,10 +38241,12 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
|
37919
38241
|
//#endregion
|
|
37920
38242
|
//#region src/plugins/nodes-multi-selection-feedback/nodes-multi-selection-feedback.ts
|
|
37921
38243
|
var WeaveNodesMultiSelectionFeedbackPlugin = class extends WeavePlugin {
|
|
37922
|
-
selectedHalos = {};
|
|
37923
38244
|
constructor(params) {
|
|
37924
38245
|
super();
|
|
37925
38246
|
this.config = mergeExceptArrays(WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_DEFAULT_CONFIG, params?.config ?? {});
|
|
38247
|
+
this.initialize();
|
|
38248
|
+
}
|
|
38249
|
+
initialize() {
|
|
37926
38250
|
this.selectedHalos = {};
|
|
37927
38251
|
}
|
|
37928
38252
|
getName() {
|
|
@@ -38088,12 +38412,14 @@ var WeaveNodesMultiSelectionFeedbackPlugin = class extends WeavePlugin {
|
|
|
38088
38412
|
//#endregion
|
|
38089
38413
|
//#region src/plugins/connected-users/connected-users.ts
|
|
38090
38414
|
var WeaveConnectedUsersPlugin = class extends WeavePlugin {
|
|
38091
|
-
connectedUsers = {};
|
|
38092
38415
|
getLayerName = void 0;
|
|
38093
38416
|
constructor(params) {
|
|
38094
38417
|
super();
|
|
38095
38418
|
const { config } = params ?? {};
|
|
38096
38419
|
this.config = config;
|
|
38420
|
+
this.initialize();
|
|
38421
|
+
}
|
|
38422
|
+
initialize() {
|
|
38097
38423
|
this.connectedUsers = {};
|
|
38098
38424
|
}
|
|
38099
38425
|
getName() {
|
|
@@ -38140,6 +38466,9 @@ var WeaveUsersSelectionPlugin = class extends WeavePlugin {
|
|
|
38140
38466
|
this.config = config;
|
|
38141
38467
|
this.config.getUser = memoize(this.config.getUser);
|
|
38142
38468
|
this.config.getUserColor = memoize(this.config.getUserColor);
|
|
38469
|
+
this.initialize();
|
|
38470
|
+
}
|
|
38471
|
+
initialize() {
|
|
38143
38472
|
this.usersSelection = {};
|
|
38144
38473
|
}
|
|
38145
38474
|
getName() {
|
|
@@ -38332,6 +38661,9 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
38332
38661
|
this.config.getUser = memoize(this.config.getUser);
|
|
38333
38662
|
this.config.getUserBackgroundColor = memoize(this.config.getUserBackgroundColor);
|
|
38334
38663
|
this.config.getUserForegroundColor = memoize(this.config.getUserForegroundColor);
|
|
38664
|
+
this.initialize();
|
|
38665
|
+
}
|
|
38666
|
+
initialize() {
|
|
38335
38667
|
this.usersPointers = {};
|
|
38336
38668
|
this.usersOperations = {};
|
|
38337
38669
|
}
|
|
@@ -38542,6 +38874,9 @@ var WeaveUsersPresencePlugin = class extends WeavePlugin {
|
|
|
38542
38874
|
super();
|
|
38543
38875
|
const { config } = params;
|
|
38544
38876
|
this.config = mergeExceptArrays(WEAVE_USERS_PRESENCE_CONFIG_DEFAULT_PROPS, config);
|
|
38877
|
+
this.initialize();
|
|
38878
|
+
}
|
|
38879
|
+
initialize() {
|
|
38545
38880
|
this.userPresence = {};
|
|
38546
38881
|
}
|
|
38547
38882
|
getName() {
|
|
@@ -38617,6 +38952,9 @@ var WeaveStageDropAreaPlugin = class extends WeavePlugin {
|
|
|
38617
38952
|
initLayer = void 0;
|
|
38618
38953
|
constructor() {
|
|
38619
38954
|
super();
|
|
38955
|
+
this.initialize();
|
|
38956
|
+
}
|
|
38957
|
+
initialize() {
|
|
38620
38958
|
this.enabled = true;
|
|
38621
38959
|
}
|
|
38622
38960
|
getName() {
|
|
@@ -38630,14 +38968,20 @@ var WeaveStageDropAreaPlugin = class extends WeavePlugin {
|
|
|
38630
38968
|
stage.container().addEventListener("dragover", (e) => {
|
|
38631
38969
|
e.preventDefault();
|
|
38632
38970
|
e.stopPropagation();
|
|
38633
|
-
});
|
|
38971
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
38634
38972
|
stage.container().addEventListener("drop", (e) => {
|
|
38635
38973
|
e.preventDefault();
|
|
38636
38974
|
e.stopPropagation();
|
|
38637
38975
|
this.instance.emitEvent("onStageDrop", e);
|
|
38976
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
38977
|
+
window.addEventListener("dragover", (e) => e.preventDefault(), {
|
|
38978
|
+
signal: this.instance.getEventsController()?.signal,
|
|
38979
|
+
passive: false
|
|
38980
|
+
});
|
|
38981
|
+
window.addEventListener("drop", (e) => e.preventDefault(), {
|
|
38982
|
+
signal: this.instance.getEventsController()?.signal,
|
|
38983
|
+
passive: false
|
|
38638
38984
|
});
|
|
38639
|
-
window.addEventListener("dragover", (e) => e.preventDefault(), { passive: false });
|
|
38640
|
-
window.addEventListener("drop", (e) => e.preventDefault(), { passive: false });
|
|
38641
38985
|
}
|
|
38642
38986
|
enable() {
|
|
38643
38987
|
this.enabled = true;
|
|
@@ -38656,6 +39000,9 @@ var WeaveNodesEdgeSnappingPlugin = class extends WeavePlugin {
|
|
|
38656
39000
|
this.guideLineConfig = config?.guideLine ?? GUIDE_LINE_DEFAULT_CONFIG;
|
|
38657
39001
|
this.dragSnappingThreshold = config?.dragSnappingThreshold ?? GUIDE_LINE_DRAG_SNAPPING_THRESHOLD;
|
|
38658
39002
|
this.transformSnappingThreshold = config?.transformSnappingThreshold ?? GUIDE_LINE_TRANSFORM_SNAPPING_THRESHOLD;
|
|
39003
|
+
this.initialize();
|
|
39004
|
+
}
|
|
39005
|
+
initialize() {
|
|
38659
39006
|
this.enabled = true;
|
|
38660
39007
|
}
|
|
38661
39008
|
getName() {
|
|
@@ -39032,6 +39379,9 @@ var WeaveNodesDistanceSnappingPlugin = class extends WeavePlugin {
|
|
|
39032
39379
|
this.enterSnappingTolerance = config?.enterSnappingTolerance ?? GUIDE_ENTER_SNAPPING_TOLERANCE;
|
|
39033
39380
|
this.exitSnappingTolerance = config?.exitSnappingTolerance ?? GUIDE_EXIT_SNAPPING_TOLERANCE;
|
|
39034
39381
|
this.uiConfig = mergeExceptArrays(GUIDE_DISTANCE_LINE_DEFAULT_CONFIG, config?.ui);
|
|
39382
|
+
this.initialize();
|
|
39383
|
+
}
|
|
39384
|
+
initialize() {
|
|
39035
39385
|
this.enabled = true;
|
|
39036
39386
|
}
|
|
39037
39387
|
getName() {
|
|
@@ -39678,12 +40028,14 @@ var WeaveNodesDistanceSnappingPlugin = class extends WeavePlugin {
|
|
|
39678
40028
|
//#endregion
|
|
39679
40029
|
//#region src/plugins/comments-renderer/comments-renderer.ts
|
|
39680
40030
|
var WeaveCommentsRendererPlugin = class extends WeavePlugin {
|
|
39681
|
-
comments = [];
|
|
39682
40031
|
getLayerName = void 0;
|
|
39683
40032
|
constructor(params) {
|
|
39684
40033
|
super();
|
|
39685
40034
|
const { config } = params ?? {};
|
|
39686
40035
|
this.config = config;
|
|
40036
|
+
this.initialize();
|
|
40037
|
+
}
|
|
40038
|
+
initialize() {
|
|
39687
40039
|
this.comments = [];
|
|
39688
40040
|
}
|
|
39689
40041
|
getName() {
|
|
@@ -39774,6 +40126,7 @@ const WEAVE_STAGE_KEYBOARD_MOVE_DEFAULT_CONFIG = { movementDelta: 5 };
|
|
|
39774
40126
|
var WeaveStageKeyboardMovePlugin = class extends WeavePlugin {
|
|
39775
40127
|
getLayerName = void 0;
|
|
39776
40128
|
initLayer = void 0;
|
|
40129
|
+
initialize = void 0;
|
|
39777
40130
|
constructor(params) {
|
|
39778
40131
|
super();
|
|
39779
40132
|
this.config = mergeExceptArrays(WEAVE_STAGE_KEYBOARD_MOVE_DEFAULT_CONFIG, params?.config ?? {});
|
|
@@ -39812,7 +40165,7 @@ var WeaveStageKeyboardMovePlugin = class extends WeavePlugin {
|
|
|
39812
40165
|
if (e.code === "ArrowLeft" && e.shiftKey) this.handleNodesMovement("left");
|
|
39813
40166
|
if (e.code === "ArrowRight" && e.shiftKey) this.handleNodesMovement("right");
|
|
39814
40167
|
if (e.code === "ArrowDown" && e.shiftKey) this.handleNodesMovement("down");
|
|
39815
|
-
});
|
|
40168
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
39816
40169
|
}
|
|
39817
40170
|
enable() {
|
|
39818
40171
|
this.enabled = true;
|
|
@@ -39823,5 +40176,5 @@ var WeaveStageKeyboardMovePlugin = class extends WeavePlugin {
|
|
|
39823
40176
|
};
|
|
39824
40177
|
|
|
39825
40178
|
//#endregion
|
|
39826
|
-
export { ALIGN_NODES_ALIGN_TO, ALIGN_NODES_TOOL_ACTION_NAME, ALIGN_NODES_TOOL_STATE,
|
|
40179
|
+
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, getJSONFromYjsBinary, getPositionRelativeToContainerOnPosition, getSelectedNodesMetadata, getStageClickPoint, getTargetAndSkipNodes, getTargetedNode, getTopmostShadowHost, getVisibleNodes, getVisibleNodesInViewport, hasFrames, hasImages, intersectArrays, isArray, isIOS, isInShadowDOM, isNodeInSelection, isObject, isServer, loadImageSource, mapJsonToYjsArray, mapJsonToYjsElements, mapJsonToYjsMap, memoize, mergeExceptArrays, moveNodeToContainer, moveNodeToContainerNT, resetScale, setupCanvasBackend, setupSkiaBackend, weavejsToYjsBinary };
|
|
39827
40180
|
//# sourceMappingURL=types.js.map
|