@inditextech/weave-sdk 3.3.1 → 3.4.0-SNAPSHOT.85.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sdk.js +520 -167
- package/dist/sdk.node.js +520 -167
- package/dist/types.d.ts +168 -50
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +520 -167
- package/dist/types.js.map +1 -1
- package/package.json +2 -3
package/dist/sdk.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();
|
|
@@ -21967,11 +21984,34 @@ var WeaveRegisterManager = class {
|
|
|
21967
21984
|
}
|
|
21968
21985
|
}
|
|
21969
21986
|
}
|
|
21987
|
+
resetNodesHandlers() {
|
|
21988
|
+
for (const nodeHandlerId of Object.keys(this.nodesHandlers)) {
|
|
21989
|
+
const nodeHandler = this.nodesHandlers[nodeHandlerId];
|
|
21990
|
+
nodeHandler.initialize?.();
|
|
21991
|
+
}
|
|
21992
|
+
}
|
|
21993
|
+
resetActionsHandlers() {
|
|
21994
|
+
for (const actionHandlerId of Object.keys(this.actionsHandlers)) {
|
|
21995
|
+
const actionHandler = this.actionsHandlers[actionHandlerId];
|
|
21996
|
+
actionHandler.initialize?.();
|
|
21997
|
+
}
|
|
21998
|
+
}
|
|
21999
|
+
resetPlugins() {
|
|
22000
|
+
for (const pluginId of Object.keys(this.plugins)) {
|
|
22001
|
+
const plugin = this.plugins[pluginId];
|
|
22002
|
+
plugin.initialize?.();
|
|
22003
|
+
}
|
|
22004
|
+
}
|
|
22005
|
+
reset() {
|
|
22006
|
+
this.resetNodesHandlers();
|
|
22007
|
+
this.resetActionsHandlers();
|
|
22008
|
+
this.resetPlugins();
|
|
22009
|
+
}
|
|
21970
22010
|
};
|
|
21971
22011
|
|
|
21972
22012
|
//#endregion
|
|
21973
22013
|
//#region package.json
|
|
21974
|
-
var version = "3.
|
|
22014
|
+
var version = "3.4.0-SNAPSHOT.85.1";
|
|
21975
22015
|
|
|
21976
22016
|
//#endregion
|
|
21977
22017
|
//#region src/managers/setup.ts
|
|
@@ -22088,6 +22128,11 @@ var WeaveStageManager = class {
|
|
|
22088
22128
|
initialZIndex: void 0
|
|
22089
22129
|
};
|
|
22090
22130
|
const stage = new Konva.Stage({ ...props });
|
|
22131
|
+
if (!this.instance.isServerSide()) {
|
|
22132
|
+
const containerParent = stage.container().parentNode;
|
|
22133
|
+
stage.width(containerParent.clientWidth);
|
|
22134
|
+
stage.height(containerParent.clientHeight);
|
|
22135
|
+
}
|
|
22091
22136
|
const realContainer = stage.container();
|
|
22092
22137
|
if (realContainer !== void 0 && realContainer.style?.position !== "relative") realContainer.style.position = "relative";
|
|
22093
22138
|
this.setStage(stage);
|
|
@@ -22396,6 +22441,91 @@ var WeaveExportManager = class {
|
|
|
22396
22441
|
height: imageHeight * pixelRatio
|
|
22397
22442
|
};
|
|
22398
22443
|
}
|
|
22444
|
+
async exportAreaServerSide(area, options) {
|
|
22445
|
+
const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
|
|
22446
|
+
this.getNodesSelectionPlugin()?.disable();
|
|
22447
|
+
this.getNodesDistanceSnappingPlugin()?.disable();
|
|
22448
|
+
this.getNodesEdgeSnappingPlugin()?.disable();
|
|
22449
|
+
this.getStageGridPlugin()?.disable();
|
|
22450
|
+
const stage = this.instance.getStage();
|
|
22451
|
+
const mainLayer = this.instance.getMainLayer();
|
|
22452
|
+
if (!mainLayer) throw new Error("Main layer not found");
|
|
22453
|
+
const originalPosition = {
|
|
22454
|
+
x: stage.x(),
|
|
22455
|
+
y: stage.y()
|
|
22456
|
+
};
|
|
22457
|
+
const originalScale = {
|
|
22458
|
+
x: stage.scaleX(),
|
|
22459
|
+
y: stage.scaleY()
|
|
22460
|
+
};
|
|
22461
|
+
stage.scale({
|
|
22462
|
+
x: 1,
|
|
22463
|
+
y: 1
|
|
22464
|
+
});
|
|
22465
|
+
const bounds = area;
|
|
22466
|
+
const scaleX = stage.scaleX();
|
|
22467
|
+
const scaleY = stage.scaleY();
|
|
22468
|
+
const unscaledBounds = {
|
|
22469
|
+
x: bounds.x / scaleX,
|
|
22470
|
+
y: bounds.y / scaleY,
|
|
22471
|
+
width: bounds.width / scaleX,
|
|
22472
|
+
height: bounds.height / scaleY
|
|
22473
|
+
};
|
|
22474
|
+
const background = new Konva.Rect({
|
|
22475
|
+
x: unscaledBounds.x - padding,
|
|
22476
|
+
y: unscaledBounds.y - padding,
|
|
22477
|
+
width: unscaledBounds.width + 2 * padding,
|
|
22478
|
+
height: unscaledBounds.height + 2 * padding,
|
|
22479
|
+
strokeWidth: 0,
|
|
22480
|
+
fill: backgroundColor
|
|
22481
|
+
});
|
|
22482
|
+
mainLayer.add(background);
|
|
22483
|
+
background.moveToBottom();
|
|
22484
|
+
const backgroundRect = background.getClientRect({ relativeTo: stage });
|
|
22485
|
+
const composites = [];
|
|
22486
|
+
const imageWidth = Math.round(backgroundRect.width);
|
|
22487
|
+
const imageHeight = Math.round(backgroundRect.height);
|
|
22488
|
+
const maxRenderSize = 1920;
|
|
22489
|
+
const cols = Math.ceil(imageWidth / maxRenderSize);
|
|
22490
|
+
const rows = Math.ceil(imageHeight / maxRenderSize);
|
|
22491
|
+
const tileWidth = Math.floor(imageWidth / cols);
|
|
22492
|
+
const tileHeight = Math.floor(imageHeight / rows);
|
|
22493
|
+
for (let y = 0; y < imageHeight; y += tileHeight) for (let x = 0; x < imageWidth; x += tileWidth) {
|
|
22494
|
+
const width = Math.min(tileWidth, imageWidth - x);
|
|
22495
|
+
const height = Math.min(tileHeight, imageHeight - y);
|
|
22496
|
+
const canvas = await mainLayer.toCanvas({
|
|
22497
|
+
x: Math.round(backgroundRect.x) + x,
|
|
22498
|
+
y: Math.round(backgroundRect.y) + y,
|
|
22499
|
+
width,
|
|
22500
|
+
height,
|
|
22501
|
+
mimeType: format,
|
|
22502
|
+
pixelRatio,
|
|
22503
|
+
quality: options.quality ?? 1
|
|
22504
|
+
});
|
|
22505
|
+
let buffer = null;
|
|
22506
|
+
if (globalThis._weave_serverSideBackend === WEAVE_KONVA_BACKEND.CANVAS) buffer = canvas.toBuffer();
|
|
22507
|
+
if (globalThis._weave_serverSideBackend === WEAVE_KONVA_BACKEND.SKIA) buffer = await canvas.toBuffer();
|
|
22508
|
+
if (!buffer) throw new Error("Failed to generate image buffer");
|
|
22509
|
+
composites.push({
|
|
22510
|
+
top: y * pixelRatio,
|
|
22511
|
+
left: x * pixelRatio,
|
|
22512
|
+
input: buffer
|
|
22513
|
+
});
|
|
22514
|
+
}
|
|
22515
|
+
background.destroy();
|
|
22516
|
+
stage.position(originalPosition);
|
|
22517
|
+
stage.scale(originalScale);
|
|
22518
|
+
stage.batchDraw();
|
|
22519
|
+
this.getNodesSelectionPlugin()?.enable();
|
|
22520
|
+
this.getNodesDistanceSnappingPlugin()?.enable();
|
|
22521
|
+
this.getNodesEdgeSnappingPlugin()?.enable();
|
|
22522
|
+
this.getStageGridPlugin()?.enable();
|
|
22523
|
+
return {
|
|
22524
|
+
composites,
|
|
22525
|
+
width: imageWidth * pixelRatio,
|
|
22526
|
+
height: imageHeight * pixelRatio
|
|
22527
|
+
};
|
|
22528
|
+
}
|
|
22399
22529
|
imageToBase64(img, mimeType) {
|
|
22400
22530
|
if (img.naturalWidth === 0 && img.naturalHeight === 0) throw new Error("Image has no content");
|
|
22401
22531
|
const canvas = document.createElement("canvas");
|
|
@@ -22675,7 +22805,12 @@ var WeaveAsyncManager = class {
|
|
|
22675
22805
|
this.instance.emitEvent("onAsyncElementChange");
|
|
22676
22806
|
}, new Map());
|
|
22677
22807
|
}
|
|
22808
|
+
reset() {
|
|
22809
|
+
this.asyncElements.clear();
|
|
22810
|
+
this.asyncElementsLoadedEventEmitted = false;
|
|
22811
|
+
}
|
|
22678
22812
|
checkForAsyncElements(elements) {
|
|
22813
|
+
this.instance.emitEvent("onAsyncElementsIdle");
|
|
22679
22814
|
const amountAsyncResourcesExtracted = this.extractAsyncResources(elements);
|
|
22680
22815
|
if (amountAsyncResourcesExtracted === 0 && !this.asyncElementsLoadedEventEmitted) {
|
|
22681
22816
|
this.instance.emitEvent("onAsyncElementsLoaded");
|
|
@@ -22728,7 +22863,7 @@ var WeaveAsyncManager = class {
|
|
|
22728
22863
|
status: WEAVE_ASYNC_STATUS.LOADING
|
|
22729
22864
|
};
|
|
22730
22865
|
this.asyncElements.set(nodeId, element);
|
|
22731
|
-
this.instance.emitEvent("onAsyncElementsLoading", {
|
|
22866
|
+
if (!this.asyncElementsLoadedEventEmitted) this.instance.emitEvent("onAsyncElementsLoading", {
|
|
22732
22867
|
loaded: this.getAmountAsyncElementsLoaded(),
|
|
22733
22868
|
total: this.getAmountAsyncElements()
|
|
22734
22869
|
});
|
|
@@ -22741,11 +22876,11 @@ var WeaveAsyncManager = class {
|
|
|
22741
22876
|
status: WEAVE_ASYNC_STATUS.LOADED
|
|
22742
22877
|
};
|
|
22743
22878
|
this.asyncElements.set(nodeId, element);
|
|
22744
|
-
this.instance.emitEvent("onAsyncElementsLoading", {
|
|
22745
|
-
loaded: this.getAmountAsyncElementsLoaded(),
|
|
22746
|
-
total: this.getAmountAsyncElements()
|
|
22747
|
-
});
|
|
22748
22879
|
if (!this.asyncElementsLoadedEventEmitted) {
|
|
22880
|
+
this.instance.emitEvent("onAsyncElementsLoading", {
|
|
22881
|
+
loaded: this.getAmountAsyncElementsLoaded(),
|
|
22882
|
+
total: this.getAmountAsyncElements()
|
|
22883
|
+
});
|
|
22749
22884
|
const allLoaded = this.asyncElementsLoaded();
|
|
22750
22885
|
if (allLoaded) {
|
|
22751
22886
|
this.instance.emitEvent("onAsyncElementsLoaded");
|
|
@@ -22870,6 +23005,7 @@ var Weave = class {
|
|
|
22870
23005
|
constructor(weaveConfig, stageConfig) {
|
|
22871
23006
|
globalThis._weave_isServerSide = false;
|
|
22872
23007
|
if (typeof window === "undefined") globalThis._weave_isServerSide = true;
|
|
23008
|
+
this.eventsController = void 0;
|
|
22873
23009
|
this.emitter = new Emittery();
|
|
22874
23010
|
Konva.showWarnings = false;
|
|
22875
23011
|
this.id = v4_default();
|
|
@@ -22915,6 +23051,7 @@ var Weave = class {
|
|
|
22915
23051
|
this.initialized = true;
|
|
22916
23052
|
this.status = WEAVE_INSTANCE_STATUS.RUNNING;
|
|
22917
23053
|
this.emitEvent("onInstanceStatus", this.status);
|
|
23054
|
+
this.emitEvent("onRender");
|
|
22918
23055
|
});
|
|
22919
23056
|
}
|
|
22920
23057
|
setStatus(status) {
|
|
@@ -22939,6 +23076,7 @@ var Weave = class {
|
|
|
22939
23076
|
async start() {
|
|
22940
23077
|
this.moduleLogger.info("Start instance");
|
|
22941
23078
|
if (!this.isServerSide()) {
|
|
23079
|
+
this.eventsController = new AbortController();
|
|
22942
23080
|
if (!window.weave) window.weave = this;
|
|
22943
23081
|
}
|
|
22944
23082
|
this.emitEvent("onRoomLoaded", false);
|
|
@@ -22962,8 +23100,39 @@ var Weave = class {
|
|
|
22962
23100
|
store.setup();
|
|
22963
23101
|
store.connect();
|
|
22964
23102
|
}
|
|
23103
|
+
async switchRoom() {
|
|
23104
|
+
this.moduleLogger.info(`Switching room`);
|
|
23105
|
+
const nodeHandlers = this.registerManager.getNodesHandlers();
|
|
23106
|
+
for (const nodeHandlerKey of Object.keys(nodeHandlers)) {
|
|
23107
|
+
const nodeHandler = nodeHandlers[nodeHandlerKey];
|
|
23108
|
+
nodeHandler?.onDestroyInstance();
|
|
23109
|
+
}
|
|
23110
|
+
const stage = this.getStage();
|
|
23111
|
+
if (stage) stage.destroy();
|
|
23112
|
+
if (this.eventsController) this.eventsController.abort();
|
|
23113
|
+
if (!this.isServerSide()) this.eventsController = new AbortController();
|
|
23114
|
+
this.registerManager.reset();
|
|
23115
|
+
this.asyncManager.reset();
|
|
23116
|
+
this.moduleLogger.info("Switching room instance");
|
|
23117
|
+
if (!this.isServerSide()) {
|
|
23118
|
+
if (!window.weave) window.weave = this;
|
|
23119
|
+
}
|
|
23120
|
+
this.emitEvent("onRoomLoaded", false);
|
|
23121
|
+
this.status = WEAVE_INSTANCE_STATUS.STARTING;
|
|
23122
|
+
this.emitEvent("onInstanceStatus", this.status);
|
|
23123
|
+
this.registerManager.reset();
|
|
23124
|
+
this.status = WEAVE_INSTANCE_STATUS.LOADING_FONTS;
|
|
23125
|
+
this.emitEvent("onInstanceStatus", this.status);
|
|
23126
|
+
await this.fontsManager.loadFonts();
|
|
23127
|
+
this.setupManager.setupLog();
|
|
23128
|
+
this.stageManager.initStage();
|
|
23129
|
+
this.status = WEAVE_INSTANCE_STATUS.CONNECTING_TO_ROOM;
|
|
23130
|
+
this.emitEvent("onInstanceStatus", this.status);
|
|
23131
|
+
this.addEventListener("onStoreConnectionStatusChange", this.handleStoreConnectionStatusChange.bind(this));
|
|
23132
|
+
}
|
|
22965
23133
|
destroy() {
|
|
22966
23134
|
this.moduleLogger.info(`Destroying the instance`);
|
|
23135
|
+
if (this.eventsController) this.eventsController.abort();
|
|
22967
23136
|
this.emitter.clearListeners();
|
|
22968
23137
|
this.status = WEAVE_INSTANCE_STATUS.IDLE;
|
|
22969
23138
|
this.emitEvent("onInstanceStatus", this.status);
|
|
@@ -23433,6 +23602,9 @@ var Weave = class {
|
|
|
23433
23602
|
async exportNodesServerSide(nodes, boundingNodes, options) {
|
|
23434
23603
|
return await this.exportManager.exportNodesServerSide(nodes, boundingNodes, options);
|
|
23435
23604
|
}
|
|
23605
|
+
async exportAreaServerSide(area, options) {
|
|
23606
|
+
return await this.exportManager.exportAreaServerSide(area, options);
|
|
23607
|
+
}
|
|
23436
23608
|
async exportNodes(nodes, boundingNodes, options) {
|
|
23437
23609
|
return await this.exportManager.exportNodesAsImage(nodes, boundingNodes, options);
|
|
23438
23610
|
}
|
|
@@ -23598,6 +23770,9 @@ var Weave = class {
|
|
|
23598
23770
|
getDragProperties() {
|
|
23599
23771
|
return this.dragAndDropManager.getDragProperties();
|
|
23600
23772
|
}
|
|
23773
|
+
getEventsController() {
|
|
23774
|
+
return this.eventsController;
|
|
23775
|
+
}
|
|
23601
23776
|
};
|
|
23602
23777
|
|
|
23603
23778
|
//#endregion
|
|
@@ -23689,6 +23864,7 @@ const downscaleImageFromURL = (url, options) => {
|
|
|
23689
23864
|
//#endregion
|
|
23690
23865
|
//#region src/internal-utils/upscale.ts
|
|
23691
23866
|
const setupUpscaleStage = (instance, stage) => {
|
|
23867
|
+
if (instance.isServerSide()) return;
|
|
23692
23868
|
const config = instance.getConfiguration();
|
|
23693
23869
|
const doUpscale = config.performance?.upscale?.enabled ?? false;
|
|
23694
23870
|
if (doUpscale) {
|
|
@@ -23720,7 +23896,14 @@ const setupUpscaleStage = (instance, stage) => {
|
|
|
23720
23896
|
innerElement.style.transformOrigin = "0 0";
|
|
23721
23897
|
innerElement.style.transform = `scale(${scaleToCover})`;
|
|
23722
23898
|
}
|
|
23723
|
-
} else
|
|
23899
|
+
} else {
|
|
23900
|
+
const realContainer = stage.container();
|
|
23901
|
+
const containerWidth = realContainer.offsetWidth;
|
|
23902
|
+
const containerHeight = realContainer.offsetHeight;
|
|
23903
|
+
stage.width(containerWidth);
|
|
23904
|
+
stage.height(containerHeight);
|
|
23905
|
+
stage.setAttrs({ upscaleScale: 1 });
|
|
23906
|
+
}
|
|
23724
23907
|
};
|
|
23725
23908
|
|
|
23726
23909
|
//#endregion
|
|
@@ -23731,6 +23914,7 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23731
23914
|
wheelMousePressed = false;
|
|
23732
23915
|
isCmdCtrlPressed = false;
|
|
23733
23916
|
globalEventsInitialized = false;
|
|
23917
|
+
initialize = void 0;
|
|
23734
23918
|
onRender(props) {
|
|
23735
23919
|
const stage = new Konva.Stage({
|
|
23736
23920
|
...props,
|
|
@@ -23749,10 +23933,10 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23749
23933
|
container.setAttribute("tabindex", "0");
|
|
23750
23934
|
stage.container().addEventListener("focus", () => {
|
|
23751
23935
|
this.stageFocused = true;
|
|
23752
|
-
});
|
|
23936
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
23753
23937
|
stage.container().addEventListener("blur", () => {
|
|
23754
23938
|
this.stageFocused = false;
|
|
23755
|
-
});
|
|
23939
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
23756
23940
|
}
|
|
23757
23941
|
Konva.Stage.prototype.mode = function(mode) {
|
|
23758
23942
|
if (typeof mode !== "undefined") this._mode = mode;
|
|
@@ -23822,7 +24006,7 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23822
24006
|
const selectedNode = transformer.nodes()[0];
|
|
23823
24007
|
selectedNode.fire("onCmdCtrlPressed");
|
|
23824
24008
|
}
|
|
23825
|
-
});
|
|
24009
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
23826
24010
|
window.addEventListener("keyup", (e) => {
|
|
23827
24011
|
if (!(e.ctrlKey || e.metaKey)) {
|
|
23828
24012
|
this.isCmdCtrlPressed = false;
|
|
@@ -23833,7 +24017,7 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23833
24017
|
const selectedNode = transformer.nodes()[0];
|
|
23834
24018
|
selectedNode.fire("onCmdCtrlReleased");
|
|
23835
24019
|
}
|
|
23836
|
-
});
|
|
24020
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
23837
24021
|
this.globalEventsInitialized = true;
|
|
23838
24022
|
}
|
|
23839
24023
|
isOnlyCtrlOrMeta(event) {
|
|
@@ -23853,6 +24037,7 @@ const WEAVE_LAYER_NODE_TYPE = "layer";
|
|
|
23853
24037
|
//#region src/nodes/layer/layer.ts
|
|
23854
24038
|
var WeaveLayerNode = class extends WeaveNode {
|
|
23855
24039
|
nodeType = WEAVE_LAYER_NODE_TYPE;
|
|
24040
|
+
initialize = void 0;
|
|
23856
24041
|
onRender(props) {
|
|
23857
24042
|
const layer = new Konva.Layer({ ...props });
|
|
23858
24043
|
layer.canMoveToContainer = function() {
|
|
@@ -23900,6 +24085,7 @@ const WEAVE_GROUP_NODE_TYPE = "group";
|
|
|
23900
24085
|
//#region src/nodes/group/group.ts
|
|
23901
24086
|
var WeaveGroupNode = class extends WeaveNode {
|
|
23902
24087
|
nodeType = WEAVE_GROUP_NODE_TYPE;
|
|
24088
|
+
initialize = void 0;
|
|
23903
24089
|
constructor(params) {
|
|
23904
24090
|
super();
|
|
23905
24091
|
const { config } = params ?? {};
|
|
@@ -23992,6 +24178,7 @@ const WEAVE_RECTANGLE_NODE_TYPE = "rectangle";
|
|
|
23992
24178
|
//#region src/nodes/rectangle/rectangle.ts
|
|
23993
24179
|
var WeaveRectangleNode = class extends WeaveNode {
|
|
23994
24180
|
nodeType = WEAVE_RECTANGLE_NODE_TYPE;
|
|
24181
|
+
initialize = void 0;
|
|
23995
24182
|
constructor(params) {
|
|
23996
24183
|
super();
|
|
23997
24184
|
const { config } = params ?? {};
|
|
@@ -24035,6 +24222,7 @@ const WEAVE_ELLIPSE_NODE_TYPE = "ellipse";
|
|
|
24035
24222
|
//#region src/nodes/ellipse/ellipse.ts
|
|
24036
24223
|
var WeaveEllipseNode = class extends WeaveNode {
|
|
24037
24224
|
nodeType = WEAVE_ELLIPSE_NODE_TYPE;
|
|
24225
|
+
initialize = void 0;
|
|
24038
24226
|
constructor(params) {
|
|
24039
24227
|
super();
|
|
24040
24228
|
const { config } = params ?? {};
|
|
@@ -24180,13 +24368,16 @@ var WeaveLineNode = class extends WeaveNode {
|
|
|
24180
24368
|
constructor(params) {
|
|
24181
24369
|
super();
|
|
24182
24370
|
this.config = mergeExceptArrays(WEAVE_LINE_NODE_DEFAULT_CONFIG, params?.config ?? {});
|
|
24183
|
-
this.handleNodeChanges = null;
|
|
24184
|
-
this.handleZoomChanges = null;
|
|
24185
24371
|
this.snapper = new GreedySnapper({
|
|
24186
24372
|
snapAngles: this.config.snapAngles.angles,
|
|
24187
24373
|
activateThreshold: this.config.snapAngles.activateThreshold,
|
|
24188
24374
|
releaseThreshold: this.config.snapAngles.releaseThreshold
|
|
24189
24375
|
});
|
|
24376
|
+
this.initialize();
|
|
24377
|
+
}
|
|
24378
|
+
initialize() {
|
|
24379
|
+
this.handleNodeChanges = null;
|
|
24380
|
+
this.handleZoomChanges = null;
|
|
24190
24381
|
}
|
|
24191
24382
|
onRender(props) {
|
|
24192
24383
|
const line = new Konva.Line({
|
|
@@ -24491,17 +24682,19 @@ const TEXT_LAYOUT = {
|
|
|
24491
24682
|
//#region src/nodes/text/text.ts
|
|
24492
24683
|
var WeaveTextNode = class extends WeaveNode {
|
|
24493
24684
|
nodeType = WEAVE_TEXT_NODE_TYPE;
|
|
24494
|
-
editing = false;
|
|
24495
|
-
textAreaSuperContainer = null;
|
|
24496
|
-
textAreaContainer = null;
|
|
24497
|
-
textArea = null;
|
|
24498
|
-
eventsInitialized = false;
|
|
24499
|
-
isCtrlMetaPressed = false;
|
|
24500
24685
|
constructor(params) {
|
|
24501
24686
|
super();
|
|
24502
24687
|
const { config } = params ?? {};
|
|
24503
24688
|
this.config = (0, import_lodash.merge)({}, WEAVE_TEXT_NODE_DEFAULT_CONFIG, config);
|
|
24689
|
+
this.initialize();
|
|
24690
|
+
}
|
|
24691
|
+
initialize() {
|
|
24504
24692
|
this.keyPressHandler = void 0;
|
|
24693
|
+
this.eventsInitialized = false;
|
|
24694
|
+
this.isCtrlMetaPressed = false;
|
|
24695
|
+
this.textAreaSuperContainer = null;
|
|
24696
|
+
this.textAreaContainer = null;
|
|
24697
|
+
this.textArea = null;
|
|
24505
24698
|
this.editing = false;
|
|
24506
24699
|
this.textArea = null;
|
|
24507
24700
|
}
|
|
@@ -24509,10 +24702,10 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24509
24702
|
if (!this.eventsInitialized && !globalThis._weave_isServerSide) {
|
|
24510
24703
|
window.addEventListener("keydown", (e) => {
|
|
24511
24704
|
if (e.ctrlKey || e.metaKey) this.isCtrlMetaPressed = true;
|
|
24512
|
-
});
|
|
24705
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24513
24706
|
window.addEventListener("keyup", (e) => {
|
|
24514
24707
|
if (!(e.ctrlKey || e.metaKey)) this.isCtrlMetaPressed = false;
|
|
24515
|
-
});
|
|
24708
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24516
24709
|
this.eventsInitialized = true;
|
|
24517
24710
|
}
|
|
24518
24711
|
}
|
|
@@ -24540,7 +24733,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24540
24733
|
onAdd() {
|
|
24541
24734
|
if (!this.instance.isServerSide() && !this.keyPressHandler) {
|
|
24542
24735
|
this.keyPressHandler = this.handleKeyPress.bind(this);
|
|
24543
|
-
window.addEventListener("keypress", this.keyPressHandler);
|
|
24736
|
+
window.addEventListener("keypress", this.keyPressHandler, { signal: this.instance.getEventsController()?.signal });
|
|
24544
24737
|
}
|
|
24545
24738
|
}
|
|
24546
24739
|
onRender(props) {
|
|
@@ -24694,7 +24887,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24694
24887
|
});
|
|
24695
24888
|
if (!this.instance.isServerSide() && !this.keyPressHandler) {
|
|
24696
24889
|
this.keyPressHandler = this.handleKeyPress.bind(this);
|
|
24697
|
-
window.addEventListener("keypress", this.keyPressHandler);
|
|
24890
|
+
window.addEventListener("keypress", this.keyPressHandler, { signal: this.instance.getEventsController()?.signal });
|
|
24698
24891
|
}
|
|
24699
24892
|
return text;
|
|
24700
24893
|
}
|
|
@@ -24953,17 +25146,17 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24953
25146
|
this.textAreaSuperContainer.scrollTop = 0;
|
|
24954
25147
|
this.textAreaSuperContainer.scrollLeft = 0;
|
|
24955
25148
|
}
|
|
24956
|
-
});
|
|
25149
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24957
25150
|
this.textAreaContainer.addEventListener("scroll", () => {
|
|
24958
25151
|
if (!this.textAreaContainer) return;
|
|
24959
25152
|
this.textAreaContainer.scrollTop = 0;
|
|
24960
25153
|
this.textAreaContainer.scrollLeft = 0;
|
|
24961
|
-
});
|
|
25154
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24962
25155
|
this.textArea.addEventListener("scroll", () => {
|
|
24963
25156
|
if (!this.textArea) return;
|
|
24964
25157
|
this.textArea.scrollTop = 0;
|
|
24965
25158
|
this.textArea.scrollLeft = 0;
|
|
24966
|
-
});
|
|
25159
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24967
25160
|
const rotation = textNode.getAbsoluteRotation();
|
|
24968
25161
|
if (rotation) {
|
|
24969
25162
|
const transform = "rotate(" + rotation + "deg)";
|
|
@@ -25012,8 +25205,8 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
25012
25205
|
this.textAreaDomResize(textNode);
|
|
25013
25206
|
}
|
|
25014
25207
|
};
|
|
25015
|
-
this.textArea.addEventListener("keydown", handleKeyDown);
|
|
25016
|
-
this.textArea.addEventListener("keyup", handleKeyUp);
|
|
25208
|
+
this.textArea.addEventListener("keydown", handleKeyDown, { signal: this.instance.getEventsController()?.signal });
|
|
25209
|
+
this.textArea.addEventListener("keyup", handleKeyUp, { signal: this.instance.getEventsController()?.signal });
|
|
25017
25210
|
this.textArea.tabIndex = 1;
|
|
25018
25211
|
this.textArea.focus();
|
|
25019
25212
|
const handleOutsideClick = (e) => {
|
|
@@ -25039,7 +25232,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
25039
25232
|
}
|
|
25040
25233
|
};
|
|
25041
25234
|
setTimeout(() => {
|
|
25042
|
-
window.addEventListener("pointerup", handleOutsideClick);
|
|
25235
|
+
window.addEventListener("pointerup", handleOutsideClick, { signal: this.instance.getEventsController()?.signal });
|
|
25043
25236
|
}, 0);
|
|
25044
25237
|
this.instance.getStage().mode(WEAVE_STAGE_TEXT_EDITION_MODE);
|
|
25045
25238
|
this.editing = true;
|
|
@@ -25373,7 +25566,7 @@ var WeaveImageCrop = class WeaveImageCrop {
|
|
|
25373
25566
|
utilityLayer?.add(this.transformer);
|
|
25374
25567
|
this.transformer?.forceUpdate();
|
|
25375
25568
|
this.cropGroup.show();
|
|
25376
|
-
window.addEventListener("keydown", this.handleHide);
|
|
25569
|
+
window.addEventListener("keydown", this.handleHide, { signal: this.instance.getEventsController()?.signal });
|
|
25377
25570
|
if (options.cmdCtrl.triggered) {
|
|
25378
25571
|
utilityLayer?.hide();
|
|
25379
25572
|
const stage = this.instance.getStage();
|
|
@@ -25823,24 +26016,21 @@ const isAllowedUrl = (value) => {
|
|
|
25823
26016
|
//#endregion
|
|
25824
26017
|
//#region src/nodes/image/image.ts
|
|
25825
26018
|
var WeaveImageNode = class extends WeaveNode {
|
|
25826
|
-
imageBitmapCache = {};
|
|
25827
|
-
imageSource = {};
|
|
25828
|
-
imageFallback = {};
|
|
25829
|
-
imageState = {};
|
|
25830
|
-
imageTryoutAttempts = {};
|
|
25831
|
-
imageTryoutIds = {};
|
|
25832
26019
|
nodeType = WEAVE_IMAGE_NODE_TYPE;
|
|
25833
26020
|
cursorsFallback = { loading: "wait" };
|
|
25834
26021
|
cursors = {};
|
|
25835
26022
|
constructor(params) {
|
|
25836
26023
|
super();
|
|
25837
26024
|
const { config } = params ?? {};
|
|
26025
|
+
this.config = mergeExceptArrays(WEAVE_IMAGE_DEFAULT_CONFIG, config);
|
|
26026
|
+
this.initialize();
|
|
26027
|
+
}
|
|
26028
|
+
initialize() {
|
|
25838
26029
|
this.tapStart = {
|
|
25839
26030
|
x: 0,
|
|
25840
26031
|
y: 0,
|
|
25841
26032
|
time: 0
|
|
25842
26033
|
};
|
|
25843
|
-
this.config = mergeExceptArrays(WEAVE_IMAGE_DEFAULT_CONFIG, config);
|
|
25844
26034
|
this.imageCrop = null;
|
|
25845
26035
|
this.imageBitmapCache = {};
|
|
25846
26036
|
this.imageSource = {};
|
|
@@ -26059,7 +26249,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26059
26249
|
};
|
|
26060
26250
|
this.updateImageCrop(image);
|
|
26061
26251
|
} else {
|
|
26062
|
-
this.updatePlaceholderSize(image
|
|
26252
|
+
this.updatePlaceholderSize(image);
|
|
26063
26253
|
this.loadImage(imageProps, image, true);
|
|
26064
26254
|
}
|
|
26065
26255
|
if (this.config.performance.cache.enabled) image.on("transformend", () => {
|
|
@@ -26446,7 +26636,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26446
26636
|
}
|
|
26447
26637
|
this.loadAsyncElement(id);
|
|
26448
26638
|
preloadFunction(id, realImageURL ?? "", {
|
|
26449
|
-
onLoad: () => {
|
|
26639
|
+
onLoad: async () => {
|
|
26450
26640
|
if (useFallback) this.imageTryoutIds[id] = setTimeout(() => {
|
|
26451
26641
|
const node = this.instance.getStage().findOne(`#${id}`);
|
|
26452
26642
|
if (node) {
|
|
@@ -26497,7 +26687,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26497
26687
|
error: false
|
|
26498
26688
|
};
|
|
26499
26689
|
this.updateImageCrop(image);
|
|
26500
|
-
this.resolveAsyncElement(id);
|
|
26690
|
+
if (!useFallback) this.resolveAsyncElement(id);
|
|
26501
26691
|
this.cacheNode(image);
|
|
26502
26692
|
}
|
|
26503
26693
|
},
|
|
@@ -26538,13 +26728,9 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26538
26728
|
}
|
|
26539
26729
|
}, loadTryout);
|
|
26540
26730
|
}
|
|
26541
|
-
updatePlaceholderSize(image
|
|
26731
|
+
updatePlaceholderSize(image) {
|
|
26542
26732
|
const imageAttrs = image.getAttrs();
|
|
26543
26733
|
if (!this.imageState[imageAttrs.id ?? ""]?.loaded) return;
|
|
26544
|
-
if (!imageAttrs.adding && !imageAttrs.cropInfo) {
|
|
26545
|
-
imagePlaceholder.width(imageAttrs.uncroppedImage.width);
|
|
26546
|
-
imagePlaceholder.height(imageAttrs.uncroppedImage.height);
|
|
26547
|
-
}
|
|
26548
26734
|
}
|
|
26549
26735
|
updateImageCrop(image) {
|
|
26550
26736
|
const imageAttrs = image.getAttrs();
|
|
@@ -26678,6 +26864,7 @@ const WEAVE_STAR_NODE_TYPE = "star";
|
|
|
26678
26864
|
//#region src/nodes/star/star.ts
|
|
26679
26865
|
var WeaveStarNode = class extends WeaveNode {
|
|
26680
26866
|
nodeType = WEAVE_STAR_NODE_TYPE;
|
|
26867
|
+
initialize = void 0;
|
|
26681
26868
|
constructor(params) {
|
|
26682
26869
|
super();
|
|
26683
26870
|
const { config } = params ?? {};
|
|
@@ -26763,6 +26950,7 @@ const WEAVE_ARROW_NODE_TYPE = "arrow";
|
|
|
26763
26950
|
//#region src/nodes/arrow/arrow.ts
|
|
26764
26951
|
var WeaveArrowNode = class extends WeaveNode {
|
|
26765
26952
|
nodeType = WEAVE_ARROW_NODE_TYPE;
|
|
26953
|
+
initialize = void 0;
|
|
26766
26954
|
constructor(params) {
|
|
26767
26955
|
super();
|
|
26768
26956
|
const { config } = params ?? {};
|
|
@@ -26819,6 +27007,7 @@ const WEAVE_REGULAR_POLYGON_NODE_TYPE = "regular-polygon";
|
|
|
26819
27007
|
//#region src/nodes/regular-polygon/regular-polygon.ts
|
|
26820
27008
|
var WeaveRegularPolygonNode = class extends WeaveNode {
|
|
26821
27009
|
nodeType = WEAVE_REGULAR_POLYGON_NODE_TYPE;
|
|
27010
|
+
initialize = void 0;
|
|
26822
27011
|
constructor(params) {
|
|
26823
27012
|
super();
|
|
26824
27013
|
const { config } = params ?? {};
|
|
@@ -26932,6 +27121,7 @@ var GroupFrame = class extends Konva.Group {
|
|
|
26932
27121
|
//#region src/nodes/frame/frame.ts
|
|
26933
27122
|
var WeaveFrameNode = class extends WeaveNode {
|
|
26934
27123
|
nodeType = WEAVE_FRAME_NODE_TYPE;
|
|
27124
|
+
initialize = void 0;
|
|
26935
27125
|
constructor(params) {
|
|
26936
27126
|
super();
|
|
26937
27127
|
const { config } = params ?? {};
|
|
@@ -27232,6 +27422,7 @@ const WEAVE_STROKE_NODE_DEFAULT_CONFIG = {
|
|
|
27232
27422
|
//#region src/nodes/stroke/stroke.ts
|
|
27233
27423
|
var WeaveStrokeNode = class extends WeaveNode {
|
|
27234
27424
|
nodeType = WEAVE_STROKE_NODE_TYPE;
|
|
27425
|
+
initialize = void 0;
|
|
27235
27426
|
constructor(params) {
|
|
27236
27427
|
super();
|
|
27237
27428
|
const { config } = params ?? {};
|
|
@@ -27808,8 +27999,6 @@ var WeaveSquareLineTipManager = class extends WeaveBaseLineTipManager {
|
|
|
27808
27999
|
//#endregion
|
|
27809
28000
|
//#region src/nodes/stroke-single/stroke-single.ts
|
|
27810
28001
|
var WeaveStrokeSingleNode = class extends WeaveNode {
|
|
27811
|
-
startHandle = null;
|
|
27812
|
-
endHandle = null;
|
|
27813
28002
|
nodeType = WEAVE_STROKE_SINGLE_NODE_TYPE;
|
|
27814
28003
|
tipManagers = {
|
|
27815
28004
|
[WEAVE_STROKE_SINGLE_NODE_TIP_TYPE.ARROW]: new WeaveArrowLineTipManager(),
|
|
@@ -27820,24 +28009,29 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
|
|
|
27820
28009
|
constructor(params) {
|
|
27821
28010
|
super();
|
|
27822
28011
|
this.config = mergeExceptArrays(WEAVE_STROKE_SINGLE_NODE_DEFAULT_CONFIG, params?.config ?? {});
|
|
27823
|
-
this.handleNodeChanges = null;
|
|
27824
|
-
this.handleZoomChanges = null;
|
|
27825
|
-
this.shiftPressed = false;
|
|
27826
28012
|
this.snapper = new GreedySnapper({
|
|
27827
28013
|
snapAngles: this.config.snapAngles.angles,
|
|
27828
28014
|
activateThreshold: this.config.snapAngles.activateThreshold,
|
|
27829
28015
|
releaseThreshold: this.config.snapAngles.releaseThreshold
|
|
27830
28016
|
});
|
|
28017
|
+
this.initialize();
|
|
28018
|
+
}
|
|
28019
|
+
initialize() {
|
|
27831
28020
|
this.eventsInitialized = false;
|
|
28021
|
+
this.startHandle = null;
|
|
28022
|
+
this.endHandle = null;
|
|
28023
|
+
this.handleNodeChanges = null;
|
|
28024
|
+
this.handleZoomChanges = null;
|
|
28025
|
+
this.shiftPressed = false;
|
|
27832
28026
|
}
|
|
27833
28027
|
initEvents() {
|
|
27834
28028
|
if (this.eventsInitialized) return;
|
|
27835
28029
|
window.addEventListener("keydown", (e) => {
|
|
27836
28030
|
if (e.key === "Shift") this.shiftPressed = true;
|
|
27837
|
-
});
|
|
28031
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
27838
28032
|
window.addEventListener("keyup", (e) => {
|
|
27839
28033
|
if (e.key === "Shift") this.shiftPressed = false;
|
|
27840
|
-
});
|
|
28034
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
27841
28035
|
this.eventsInitialized = true;
|
|
27842
28036
|
}
|
|
27843
28037
|
onRender(props) {
|
|
@@ -28324,6 +28518,9 @@ var WeaveCommentNode = class extends WeaveNode {
|
|
|
28324
28518
|
constructor(params) {
|
|
28325
28519
|
super();
|
|
28326
28520
|
this.config = mergeExceptArrays(WEAVE_COMMENT_NODE_DEFAULTS, params.config);
|
|
28521
|
+
this.initialize();
|
|
28522
|
+
}
|
|
28523
|
+
initialize() {
|
|
28327
28524
|
this.commentDomVisibleId = null;
|
|
28328
28525
|
this.commentDomVisible = false;
|
|
28329
28526
|
this.commentDomAction = null;
|
|
@@ -28952,10 +29149,6 @@ const WEAVE_VIDEO_DEFAULT_CONFIG = {
|
|
|
28952
29149
|
//#endregion
|
|
28953
29150
|
//#region src/nodes/video/video.ts
|
|
28954
29151
|
var WeaveVideoNode = class extends WeaveNode {
|
|
28955
|
-
videoState = {};
|
|
28956
|
-
videoSourceFrameId = {};
|
|
28957
|
-
videoSource = {};
|
|
28958
|
-
videoPlaceholder = {};
|
|
28959
29152
|
nodeType = WEAVE_VIDEO_NODE_TYPE;
|
|
28960
29153
|
constructor(params) {
|
|
28961
29154
|
super();
|
|
@@ -28968,6 +29161,13 @@ var WeaveVideoNode = class extends WeaveNode {
|
|
|
28968
29161
|
this.videoIconImage.src = this.config.style.icon.dataURL;
|
|
28969
29162
|
}
|
|
28970
29163
|
}
|
|
29164
|
+
initialize() {
|
|
29165
|
+
this.videoState = {};
|
|
29166
|
+
this.videoSource = {};
|
|
29167
|
+
this.videoSourceFrameId = {};
|
|
29168
|
+
this.videoPlaceholder = {};
|
|
29169
|
+
this.videoIconImage = void 0;
|
|
29170
|
+
}
|
|
28971
29171
|
async loadPlaceholder(params, video) {
|
|
28972
29172
|
const videoProps = params;
|
|
28973
29173
|
const { id } = videoProps;
|
|
@@ -29462,6 +29662,7 @@ const WEAVE_MEASURE_NODE_DEFAULT_CONFIG = { style: {
|
|
|
29462
29662
|
var WeaveMeasureNode = class extends WeaveNode {
|
|
29463
29663
|
nodeType = WEAVE_MEASURE_NODE_TYPE;
|
|
29464
29664
|
handlePointCircleRadius = 6;
|
|
29665
|
+
initialize = void 0;
|
|
29465
29666
|
constructor(params) {
|
|
29466
29667
|
super();
|
|
29467
29668
|
this.config = mergeExceptArrays(WEAVE_MEASURE_NODE_DEFAULT_CONFIG, params?.config ?? {});
|
|
@@ -30752,6 +30953,7 @@ var WeaveConnectorNode = class extends WeaveNode {
|
|
|
30752
30953
|
[WEAVE_CONNECTOR_NODE_DECORATOR_TYPE.DOT]: setupNodeDecoratorDot,
|
|
30753
30954
|
[WEAVE_CONNECTOR_NODE_DECORATOR_TYPE.ARROW]: setupNodeDecoratorArrow
|
|
30754
30955
|
};
|
|
30956
|
+
initialize = void 0;
|
|
30755
30957
|
constructor(params) {
|
|
30756
30958
|
super();
|
|
30757
30959
|
this.config = mergeExceptArrays(WEAVE_CONNECTOR_NODE_DEFAULT_CONFIG, params?.config);
|
|
@@ -31502,10 +31704,6 @@ const WEAVE_STAGE_ZOOM_DEFAULT_CONFIG = {
|
|
|
31502
31704
|
var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
31503
31705
|
getLayerName = void 0;
|
|
31504
31706
|
initLayer = void 0;
|
|
31505
|
-
pinching = false;
|
|
31506
|
-
zooming = false;
|
|
31507
|
-
isTrackpad = false;
|
|
31508
|
-
zoomVelocity = 0;
|
|
31509
31707
|
zoomInertiaType = WEAVE_STAGE_ZOOM_TYPE.MOUSE_WHEEL;
|
|
31510
31708
|
defaultStep = 3;
|
|
31511
31709
|
constructor(params) {
|
|
@@ -31513,8 +31711,13 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31513
31711
|
const { config } = params ?? {};
|
|
31514
31712
|
this.config = mergeExceptArrays(WEAVE_STAGE_ZOOM_DEFAULT_CONFIG, config);
|
|
31515
31713
|
if (!this.config.zoomSteps.includes(this.config.defaultZoom)) throw new Error(`Default zoom ${this.config.defaultZoom} is not in zoom steps`);
|
|
31714
|
+
this.initialize();
|
|
31715
|
+
}
|
|
31716
|
+
initialize() {
|
|
31516
31717
|
this.pinching = false;
|
|
31718
|
+
this.zooming = false;
|
|
31517
31719
|
this.isTrackpad = false;
|
|
31720
|
+
this.zoomVelocity = 0;
|
|
31518
31721
|
this.isCtrlOrMetaPressed = false;
|
|
31519
31722
|
this.updatedMinimumZoom = false;
|
|
31520
31723
|
this.actualStep = this.config.zoomSteps.findIndex((step) => step === this.config.defaultZoom);
|
|
@@ -31801,6 +32004,15 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31801
32004
|
if (box.width === 0 || box.height === 0) return;
|
|
31802
32005
|
this.fitToElements(box, finalOptions);
|
|
31803
32006
|
}
|
|
32007
|
+
fitToArea(area, options) {
|
|
32008
|
+
const finalOptions = mergeExceptArrays({
|
|
32009
|
+
smartZoom: false,
|
|
32010
|
+
overrideZoom: true
|
|
32011
|
+
}, options);
|
|
32012
|
+
if (!this.enabled) return;
|
|
32013
|
+
if (area.width === 0 || area.height === 0) return;
|
|
32014
|
+
this.fitToElements(area, finalOptions);
|
|
32015
|
+
}
|
|
31804
32016
|
enable() {
|
|
31805
32017
|
this.enabled = true;
|
|
31806
32018
|
}
|
|
@@ -31819,10 +32031,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31819
32031
|
initEvents() {
|
|
31820
32032
|
window.addEventListener("keydown", (e) => {
|
|
31821
32033
|
if (e.ctrlKey || e.metaKey) this.isCtrlOrMetaPressed = true;
|
|
31822
|
-
});
|
|
32034
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
31823
32035
|
window.addEventListener("keyup", (e) => {
|
|
31824
32036
|
if (!(e.ctrlKey || e.metaKey)) this.isCtrlOrMetaPressed = false;
|
|
31825
|
-
});
|
|
32037
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
31826
32038
|
const stage = this.instance.getStage();
|
|
31827
32039
|
let lastCenter = null;
|
|
31828
32040
|
let lastDist = 0;
|
|
@@ -31847,7 +32059,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31847
32059
|
return;
|
|
31848
32060
|
}
|
|
31849
32061
|
}
|
|
31850
|
-
}, {
|
|
32062
|
+
}, {
|
|
32063
|
+
passive: false,
|
|
32064
|
+
signal: this.instance.getEventsController()?.signal
|
|
32065
|
+
});
|
|
31851
32066
|
stage.getContent().addEventListener("touchmove", (e) => {
|
|
31852
32067
|
e.preventDefault();
|
|
31853
32068
|
if (e.touches.length === 2) {
|
|
@@ -31887,12 +32102,18 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31887
32102
|
lastDist = dist;
|
|
31888
32103
|
lastCenter = newCenter;
|
|
31889
32104
|
}
|
|
31890
|
-
}, {
|
|
32105
|
+
}, {
|
|
32106
|
+
passive: false,
|
|
32107
|
+
signal: this.instance.getEventsController()?.signal
|
|
32108
|
+
});
|
|
31891
32109
|
stage.getContent().addEventListener("touchend", () => {
|
|
31892
32110
|
this.pinching = false;
|
|
31893
32111
|
lastDist = 0;
|
|
31894
32112
|
lastCenter = null;
|
|
31895
|
-
}, {
|
|
32113
|
+
}, {
|
|
32114
|
+
passive: false,
|
|
32115
|
+
signal: this.instance.getEventsController()?.signal
|
|
32116
|
+
});
|
|
31896
32117
|
let doZoom = false;
|
|
31897
32118
|
const handleWheelImmediate = (e) => {
|
|
31898
32119
|
const performZoom = this.isCtrlOrMetaPressed || !this.isCtrlOrMetaPressed && e.ctrlKey && e.deltaMode === 0;
|
|
@@ -31910,7 +32131,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31910
32131
|
e.preventDefault();
|
|
31911
32132
|
doZoom = true;
|
|
31912
32133
|
};
|
|
31913
|
-
window.addEventListener("wheel", handleWheelImmediate, {
|
|
32134
|
+
window.addEventListener("wheel", handleWheelImmediate, {
|
|
32135
|
+
signal: this.instance.getEventsController()?.signal,
|
|
32136
|
+
passive: false
|
|
32137
|
+
});
|
|
31914
32138
|
const handleWheel = (e) => {
|
|
31915
32139
|
if (!doZoom) return;
|
|
31916
32140
|
const delta = e.deltaY > 0 ? 1 : -1;
|
|
@@ -31923,7 +32147,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31923
32147
|
}
|
|
31924
32148
|
};
|
|
31925
32149
|
const throttledHandleWheel = (0, import_lodash.throttle)(handleWheel, DEFAULT_THROTTLE_MS);
|
|
31926
|
-
window.addEventListener("wheel", throttledHandleWheel, {
|
|
32150
|
+
window.addEventListener("wheel", throttledHandleWheel, {
|
|
32151
|
+
signal: this.instance.getEventsController()?.signal,
|
|
32152
|
+
passive: true
|
|
32153
|
+
});
|
|
31927
32154
|
}
|
|
31928
32155
|
getInertiaScale() {
|
|
31929
32156
|
const stage = this.instance.getStage();
|
|
@@ -31981,6 +32208,7 @@ const ZOOM_OUT_TOOL_ACTION_NAME = "zoomOutTool";
|
|
|
31981
32208
|
//#region src/actions/zoom-out-tool/zoom-out-tool.ts
|
|
31982
32209
|
var WeaveZoomOutToolAction = class extends WeaveAction {
|
|
31983
32210
|
onPropsChange = void 0;
|
|
32211
|
+
initialize = void 0;
|
|
31984
32212
|
getName() {
|
|
31985
32213
|
return ZOOM_OUT_TOOL_ACTION_NAME;
|
|
31986
32214
|
}
|
|
@@ -32015,6 +32243,10 @@ const ZOOM_IN_TOOL_ACTION_NAME = "zoomInTool";
|
|
|
32015
32243
|
//#region src/actions/zoom-in-tool/zoom-in-tool.ts
|
|
32016
32244
|
var WeaveZoomInToolAction = class extends WeaveAction {
|
|
32017
32245
|
onPropsChange = void 0;
|
|
32246
|
+
initialize = void 0;
|
|
32247
|
+
constructor() {
|
|
32248
|
+
super();
|
|
32249
|
+
}
|
|
32018
32250
|
getName() {
|
|
32019
32251
|
return ZOOM_IN_TOOL_ACTION_NAME;
|
|
32020
32252
|
}
|
|
@@ -32049,6 +32281,10 @@ const FIT_TO_SCREEN_TOOL_ACTION_NAME = "fitToScreenTool";
|
|
|
32049
32281
|
//#region src/actions/fit-to-screen-tool/fit-to-screen-tool.ts
|
|
32050
32282
|
var WeaveFitToScreenToolAction = class extends WeaveAction {
|
|
32051
32283
|
onPropsChange = void 0;
|
|
32284
|
+
initialize = void 0;
|
|
32285
|
+
constructor() {
|
|
32286
|
+
super();
|
|
32287
|
+
}
|
|
32052
32288
|
getName() {
|
|
32053
32289
|
return FIT_TO_SCREEN_TOOL_ACTION_NAME;
|
|
32054
32290
|
}
|
|
@@ -32082,6 +32318,10 @@ const FIT_TO_SELECTION_TOOL_ACTION_NAME = "fitToSelectionTool";
|
|
|
32082
32318
|
//#region src/actions/fit-to-selection-tool/fit-to-selection-tool.ts
|
|
32083
32319
|
var WeaveFitToSelectionToolAction = class extends WeaveAction {
|
|
32084
32320
|
onPropsChange = void 0;
|
|
32321
|
+
initialize = void 0;
|
|
32322
|
+
constructor() {
|
|
32323
|
+
super();
|
|
32324
|
+
}
|
|
32085
32325
|
getName() {
|
|
32086
32326
|
return FIT_TO_SELECTION_TOOL_ACTION_NAME;
|
|
32087
32327
|
}
|
|
@@ -32124,6 +32364,9 @@ var WeaveMoveToolAction = class extends WeaveAction {
|
|
|
32124
32364
|
onInit = void 0;
|
|
32125
32365
|
constructor() {
|
|
32126
32366
|
super();
|
|
32367
|
+
this.initialize();
|
|
32368
|
+
}
|
|
32369
|
+
initialize() {
|
|
32127
32370
|
this.initialized = false;
|
|
32128
32371
|
this.state = MOVE_TOOL_STATE.IDLE;
|
|
32129
32372
|
}
|
|
@@ -32137,7 +32380,7 @@ var WeaveMoveToolAction = class extends WeaveAction {
|
|
|
32137
32380
|
this.cancelAction();
|
|
32138
32381
|
return;
|
|
32139
32382
|
}
|
|
32140
|
-
});
|
|
32383
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32141
32384
|
stage.on("pointerdown", () => {
|
|
32142
32385
|
if ([MOVE_TOOL_ACTION_NAME].includes(this.instance.getActiveAction() ?? "")) stage.container().style.cursor = "grabbing";
|
|
32143
32386
|
});
|
|
@@ -32196,6 +32439,9 @@ var WeaveSelectionToolAction = class extends WeaveAction {
|
|
|
32196
32439
|
onInit = void 0;
|
|
32197
32440
|
constructor() {
|
|
32198
32441
|
super();
|
|
32442
|
+
this.initialize();
|
|
32443
|
+
}
|
|
32444
|
+
initialize() {
|
|
32199
32445
|
this.initialized = false;
|
|
32200
32446
|
this.state = SELECTION_TOOL_STATE.IDLE;
|
|
32201
32447
|
}
|
|
@@ -32259,6 +32505,9 @@ var WeaveEraserToolAction = class extends WeaveAction {
|
|
|
32259
32505
|
onInit = void 0;
|
|
32260
32506
|
constructor() {
|
|
32261
32507
|
super();
|
|
32508
|
+
this.initialize();
|
|
32509
|
+
}
|
|
32510
|
+
initialize() {
|
|
32262
32511
|
this.initialized = false;
|
|
32263
32512
|
this.erasing = false;
|
|
32264
32513
|
this.state = ERASER_TOOL_STATE.IDLE;
|
|
@@ -32292,7 +32541,7 @@ var WeaveEraserToolAction = class extends WeaveAction {
|
|
|
32292
32541
|
this.cancelAction();
|
|
32293
32542
|
return;
|
|
32294
32543
|
}
|
|
32295
|
-
});
|
|
32544
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32296
32545
|
this.initialized = true;
|
|
32297
32546
|
}
|
|
32298
32547
|
setState(state) {
|
|
@@ -32359,6 +32608,9 @@ var WeaveRectangleToolAction = class extends WeaveAction {
|
|
|
32359
32608
|
onInit = void 0;
|
|
32360
32609
|
constructor() {
|
|
32361
32610
|
super();
|
|
32611
|
+
this.initialize();
|
|
32612
|
+
}
|
|
32613
|
+
initialize() {
|
|
32362
32614
|
this.pointers = new Map();
|
|
32363
32615
|
this.initialized = false;
|
|
32364
32616
|
this.state = RECTANGLE_TOOL_STATE.IDLE;
|
|
@@ -32394,7 +32646,7 @@ var WeaveRectangleToolAction = class extends WeaveAction {
|
|
|
32394
32646
|
this.cancelAction();
|
|
32395
32647
|
return;
|
|
32396
32648
|
}
|
|
32397
|
-
});
|
|
32649
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32398
32650
|
stage.on("pointermove", () => {
|
|
32399
32651
|
if (this.state === RECTANGLE_TOOL_STATE.IDLE) return;
|
|
32400
32652
|
this.setCursor();
|
|
@@ -32568,6 +32820,9 @@ var WeaveEllipseToolAction = class extends WeaveAction {
|
|
|
32568
32820
|
onInit = void 0;
|
|
32569
32821
|
constructor() {
|
|
32570
32822
|
super();
|
|
32823
|
+
this.initialize();
|
|
32824
|
+
}
|
|
32825
|
+
initialize() {
|
|
32571
32826
|
this.pointers = new Map();
|
|
32572
32827
|
this.initialized = false;
|
|
32573
32828
|
this.state = ELLIPSE_TOOL_STATE.IDLE;
|
|
@@ -32603,7 +32858,7 @@ var WeaveEllipseToolAction = class extends WeaveAction {
|
|
|
32603
32858
|
this.cancelAction();
|
|
32604
32859
|
return;
|
|
32605
32860
|
}
|
|
32606
|
-
});
|
|
32861
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32607
32862
|
stage.on("pointerdown", (e) => {
|
|
32608
32863
|
this.setTapStart(e);
|
|
32609
32864
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -32784,6 +33039,9 @@ var WeavePenToolAction = class extends WeaveAction {
|
|
|
32784
33039
|
onInit = void 0;
|
|
32785
33040
|
constructor() {
|
|
32786
33041
|
super();
|
|
33042
|
+
this.initialize();
|
|
33043
|
+
}
|
|
33044
|
+
initialize() {
|
|
32787
33045
|
this.pointers = new Map();
|
|
32788
33046
|
this.initialized = false;
|
|
32789
33047
|
this.state = PEN_TOOL_STATE.IDLE;
|
|
@@ -32819,7 +33077,7 @@ var WeavePenToolAction = class extends WeaveAction {
|
|
|
32819
33077
|
this.cancelAction();
|
|
32820
33078
|
return;
|
|
32821
33079
|
}
|
|
32822
|
-
});
|
|
33080
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32823
33081
|
stage.on("pointerdown", (e) => {
|
|
32824
33082
|
this.setTapStart(e);
|
|
32825
33083
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -33056,6 +33314,9 @@ var WeaveLineToolAction = class extends WeaveAction {
|
|
|
33056
33314
|
constructor(params) {
|
|
33057
33315
|
super();
|
|
33058
33316
|
this.config = mergeExceptArrays(LINE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
|
|
33317
|
+
this.initialize();
|
|
33318
|
+
}
|
|
33319
|
+
initialize() {
|
|
33059
33320
|
this.pointers = new Map();
|
|
33060
33321
|
this.initialized = false;
|
|
33061
33322
|
this.state = LINE_TOOL_STATE.IDLE;
|
|
@@ -33100,13 +33361,13 @@ var WeaveLineToolAction = class extends WeaveAction {
|
|
|
33100
33361
|
this.snappedAngle = null;
|
|
33101
33362
|
this.shiftPressed = true;
|
|
33102
33363
|
}
|
|
33103
|
-
});
|
|
33364
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33104
33365
|
window.addEventListener("keyup", (e) => {
|
|
33105
33366
|
if (e.key === "Shift" && this.instance.getActiveAction() === LINE_TOOL_ACTION_NAME) {
|
|
33106
33367
|
this.snappedAngle = null;
|
|
33107
33368
|
this.shiftPressed = false;
|
|
33108
33369
|
}
|
|
33109
|
-
});
|
|
33370
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33110
33371
|
stage.on("pointerdown", (e) => {
|
|
33111
33372
|
this.setTapStart(e);
|
|
33112
33373
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -33321,6 +33582,9 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
33321
33582
|
constructor(params) {
|
|
33322
33583
|
super();
|
|
33323
33584
|
this.config = mergeExceptArrays(BRUSH_TOOL_DEFAULT_CONFIG, params?.config ?? {});
|
|
33585
|
+
this.initialize();
|
|
33586
|
+
}
|
|
33587
|
+
initialize() {
|
|
33324
33588
|
this.initialized = false;
|
|
33325
33589
|
this.state = BRUSH_TOOL_STATE.INACTIVE;
|
|
33326
33590
|
this.strokeId = null;
|
|
@@ -33349,7 +33613,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
33349
33613
|
const stage = this.instance.getStage();
|
|
33350
33614
|
window.addEventListener("keyup", (e) => {
|
|
33351
33615
|
if (e.code === "Space" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) this.isSpacePressed = false;
|
|
33352
|
-
});
|
|
33616
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33353
33617
|
window.addEventListener("keydown", (e) => {
|
|
33354
33618
|
if (e.code === "Enter" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) {
|
|
33355
33619
|
e.stopPropagation();
|
|
@@ -33365,7 +33629,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
33365
33629
|
e.stopPropagation();
|
|
33366
33630
|
this.cancelAction();
|
|
33367
33631
|
}
|
|
33368
|
-
});
|
|
33632
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33369
33633
|
const handlePointerDown = (e) => {
|
|
33370
33634
|
if (this.state === BRUSH_TOOL_STATE.INACTIVE) return;
|
|
33371
33635
|
if (this.state !== BRUSH_TOOL_STATE.IDLE) return;
|
|
@@ -33574,6 +33838,9 @@ var WeaveTextToolAction = class extends WeaveAction {
|
|
|
33574
33838
|
onInit = void 0;
|
|
33575
33839
|
constructor() {
|
|
33576
33840
|
super();
|
|
33841
|
+
this.initialize();
|
|
33842
|
+
}
|
|
33843
|
+
initialize() {
|
|
33577
33844
|
this.initialized = false;
|
|
33578
33845
|
this.state = TEXT_TOOL_STATE.IDLE;
|
|
33579
33846
|
this.textId = null;
|
|
@@ -33603,7 +33870,7 @@ var WeaveTextToolAction = class extends WeaveAction {
|
|
|
33603
33870
|
this.cancelAction();
|
|
33604
33871
|
return;
|
|
33605
33872
|
}
|
|
33606
|
-
});
|
|
33873
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33607
33874
|
stage.on("pointermove", () => {
|
|
33608
33875
|
if (this.state === TEXT_TOOL_STATE.IDLE) return;
|
|
33609
33876
|
this.setCursor();
|
|
@@ -33731,6 +33998,9 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
33731
33998
|
constructor(params) {
|
|
33732
33999
|
super();
|
|
33733
34000
|
this.config = mergeExceptArrays(WEAVE_IMAGE_TOOL_CONFIG_DEFAULT, params?.config ?? {});
|
|
34001
|
+
this.initialize();
|
|
34002
|
+
}
|
|
34003
|
+
initialize() {
|
|
33734
34004
|
this.pointers = new Map();
|
|
33735
34005
|
this.initialized = false;
|
|
33736
34006
|
this.imageId = null;
|
|
@@ -33774,7 +34044,7 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
33774
34044
|
this.cancelAction();
|
|
33775
34045
|
return;
|
|
33776
34046
|
}
|
|
33777
|
-
});
|
|
34047
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33778
34048
|
stage.on("pointerdown", (e) => {
|
|
33779
34049
|
this.setTapStart(e);
|
|
33780
34050
|
if (this.ignorePointerEvents) return;
|
|
@@ -34171,6 +34441,9 @@ var WeaveImagesToolAction = class extends WeaveAction {
|
|
|
34171
34441
|
constructor(params) {
|
|
34172
34442
|
super();
|
|
34173
34443
|
this.config = mergeExceptArrays(WEAVE_IMAGES_TOOL_DEFAULT_CONFIG, params ?? {});
|
|
34444
|
+
this.initialize();
|
|
34445
|
+
}
|
|
34446
|
+
initialize() {
|
|
34174
34447
|
this.pointers = new Map();
|
|
34175
34448
|
this.initialized = false;
|
|
34176
34449
|
this.tempPointerFeedbackNode = null;
|
|
@@ -34217,7 +34490,7 @@ var WeaveImagesToolAction = class extends WeaveAction {
|
|
|
34217
34490
|
const stage = this.instance.getStage();
|
|
34218
34491
|
stage.container().addEventListener("keydown", (e) => {
|
|
34219
34492
|
if (e.key === "Escape" && this.instance.getActiveAction() === WEAVE_IMAGES_TOOL_ACTION_NAME) this.cancelAction();
|
|
34220
|
-
});
|
|
34493
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
34221
34494
|
stage.on("pointerdown", (e) => {
|
|
34222
34495
|
this.setTapStart(e);
|
|
34223
34496
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -34599,6 +34872,9 @@ var WeaveStarToolAction = class extends WeaveAction {
|
|
|
34599
34872
|
onInit = void 0;
|
|
34600
34873
|
constructor() {
|
|
34601
34874
|
super();
|
|
34875
|
+
this.initialize();
|
|
34876
|
+
}
|
|
34877
|
+
initialize() {
|
|
34602
34878
|
this.pointers = new Map();
|
|
34603
34879
|
this.initialized = false;
|
|
34604
34880
|
this.state = STAR_TOOL_STATE.IDLE;
|
|
@@ -34635,7 +34911,7 @@ var WeaveStarToolAction = class extends WeaveAction {
|
|
|
34635
34911
|
this.cancelAction();
|
|
34636
34912
|
return;
|
|
34637
34913
|
}
|
|
34638
|
-
});
|
|
34914
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
34639
34915
|
stage.on("pointerdown", (e) => {
|
|
34640
34916
|
this.setTapStart(e);
|
|
34641
34917
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -34800,8 +35076,8 @@ var WeaveStarToolAction = class extends WeaveAction {
|
|
|
34800
35076
|
|
|
34801
35077
|
//#endregion
|
|
34802
35078
|
//#region src/actions/arrow-tool/constants.ts
|
|
34803
|
-
const
|
|
34804
|
-
const
|
|
35079
|
+
const WEAVE_ARROW_TOOL_ACTION_NAME = "arrowTool";
|
|
35080
|
+
const WEAVE_ARROW_TOOL_STATE = {
|
|
34805
35081
|
["IDLE"]: "idle",
|
|
34806
35082
|
["ADDING"]: "adding",
|
|
34807
35083
|
["DEFINING_SIZE"]: "definingSize",
|
|
@@ -34817,9 +35093,12 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34817
35093
|
onInit = void 0;
|
|
34818
35094
|
constructor() {
|
|
34819
35095
|
super();
|
|
35096
|
+
this.initialize();
|
|
35097
|
+
}
|
|
35098
|
+
initialize() {
|
|
34820
35099
|
this.pointers = new Map();
|
|
34821
35100
|
this.initialized = false;
|
|
34822
|
-
this.state =
|
|
35101
|
+
this.state = WEAVE_ARROW_TOOL_STATE.IDLE;
|
|
34823
35102
|
this.arrowId = null;
|
|
34824
35103
|
this.tempArrowId = null;
|
|
34825
35104
|
this.tempMainArrowNode = null;
|
|
@@ -34832,7 +35111,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34832
35111
|
this.props = this.initProps();
|
|
34833
35112
|
}
|
|
34834
35113
|
getName() {
|
|
34835
|
-
return
|
|
35114
|
+
return WEAVE_ARROW_TOOL_ACTION_NAME;
|
|
34836
35115
|
}
|
|
34837
35116
|
initProps() {
|
|
34838
35117
|
return {
|
|
@@ -34849,40 +35128,37 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34849
35128
|
setupEvents() {
|
|
34850
35129
|
const stage = this.instance.getStage();
|
|
34851
35130
|
window.addEventListener("keydown", (e) => {
|
|
34852
|
-
if (e.code === "Enter" && this.instance.getActiveAction() ===
|
|
35131
|
+
if (e.code === "Enter" && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
|
|
34853
35132
|
this.cancelAction();
|
|
34854
35133
|
return;
|
|
34855
35134
|
}
|
|
34856
|
-
if (e.code === "Escape" && this.instance.getActiveAction() ===
|
|
34857
|
-
|
|
34858
|
-
return;
|
|
34859
|
-
}
|
|
34860
|
-
});
|
|
35135
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) this.cancelAction();
|
|
35136
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
34861
35137
|
stage.on("pointerdown", (e) => {
|
|
34862
35138
|
this.setTapStart(e);
|
|
34863
35139
|
this.pointers.set(e.evt.pointerId, {
|
|
34864
35140
|
x: e.evt.clientX,
|
|
34865
35141
|
y: e.evt.clientY
|
|
34866
35142
|
});
|
|
34867
|
-
if (this.pointers.size === 2 && this.instance.getActiveAction() ===
|
|
34868
|
-
this.state =
|
|
35143
|
+
if (this.pointers.size === 2 && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
|
|
35144
|
+
this.state = WEAVE_ARROW_TOOL_STATE.ADDING;
|
|
34869
35145
|
return;
|
|
34870
35146
|
}
|
|
34871
|
-
if (!this.tempMainArrowNode && this.state ===
|
|
34872
|
-
if (this.tempMainArrowNode && this.state ===
|
|
35147
|
+
if (!this.tempMainArrowNode && this.state === WEAVE_ARROW_TOOL_STATE.ADDING) this.handleAdding();
|
|
35148
|
+
if (this.tempMainArrowNode && this.state === WEAVE_ARROW_TOOL_STATE.ADDING) this.state = WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE;
|
|
34873
35149
|
});
|
|
34874
35150
|
stage.on("pointermove", () => {
|
|
34875
|
-
if (this.state ===
|
|
35151
|
+
if (this.state === WEAVE_ARROW_TOOL_STATE.IDLE) return;
|
|
34876
35152
|
this.setCursor();
|
|
34877
|
-
if (this.pointers.size === 2 && this.instance.getActiveAction() ===
|
|
34878
|
-
this.state =
|
|
35153
|
+
if (this.pointers.size === 2 && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
|
|
35154
|
+
this.state = WEAVE_ARROW_TOOL_STATE.ADDING;
|
|
34879
35155
|
return;
|
|
34880
35156
|
}
|
|
34881
|
-
if (this.state ===
|
|
35157
|
+
if (this.state === WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) this.handleMovement();
|
|
34882
35158
|
});
|
|
34883
35159
|
stage.on("pointerup", (e) => {
|
|
34884
35160
|
this.pointers.delete(e.evt.pointerId);
|
|
34885
|
-
if (this.state ===
|
|
35161
|
+
if (this.state === WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) this.handleSettingSize();
|
|
34886
35162
|
});
|
|
34887
35163
|
this.initialized = true;
|
|
34888
35164
|
}
|
|
@@ -34896,7 +35172,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34896
35172
|
this.tempPoint = void 0;
|
|
34897
35173
|
this.tempNextPoint = void 0;
|
|
34898
35174
|
this.clickPoint = null;
|
|
34899
|
-
this.setState(
|
|
35175
|
+
this.setState(WEAVE_ARROW_TOOL_STATE.ADDING);
|
|
34900
35176
|
}
|
|
34901
35177
|
handleAdding() {
|
|
34902
35178
|
const stage = this.instance.getStage();
|
|
@@ -34947,7 +35223,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34947
35223
|
this.measureContainer?.add(this.tempNextPoint);
|
|
34948
35224
|
this.tempPoint.moveToTop();
|
|
34949
35225
|
this.tempNextPoint.moveToTop();
|
|
34950
|
-
this.setState(
|
|
35226
|
+
this.setState(WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE);
|
|
34951
35227
|
}
|
|
34952
35228
|
}
|
|
34953
35229
|
handleSettingSize() {
|
|
@@ -34974,11 +35250,11 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34974
35250
|
y: mousePoint.y,
|
|
34975
35251
|
points: [0, 0]
|
|
34976
35252
|
});
|
|
34977
|
-
this.setState(
|
|
35253
|
+
this.setState(WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE);
|
|
34978
35254
|
}
|
|
34979
35255
|
}
|
|
34980
35256
|
handleMovement() {
|
|
34981
|
-
if (this.state !==
|
|
35257
|
+
if (this.state !== WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) return;
|
|
34982
35258
|
if (this.arrowId && this.tempArrowNode && this.measureContainer && this.tempNextPoint) {
|
|
34983
35259
|
const { mousePoint } = this.instance.getMousePointerRelativeToContainer(this.measureContainer);
|
|
34984
35260
|
this.tempArrowNode.setAttrs({
|
|
@@ -35045,7 +35321,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
35045
35321
|
this.container = void 0;
|
|
35046
35322
|
this.measureContainer = void 0;
|
|
35047
35323
|
this.clickPoint = null;
|
|
35048
|
-
this.setState(
|
|
35324
|
+
this.setState(WEAVE_ARROW_TOOL_STATE.IDLE);
|
|
35049
35325
|
}
|
|
35050
35326
|
setCursor() {
|
|
35051
35327
|
const stage = this.instance.getStage();
|
|
@@ -35089,13 +35365,15 @@ const WEAVE_STROKE_TOOL_DEFAULT_CONFIG = { snapAngles: {
|
|
|
35089
35365
|
var WeaveStrokeToolAction = class extends WeaveAction {
|
|
35090
35366
|
initialized = false;
|
|
35091
35367
|
initialCursor = null;
|
|
35092
|
-
snappedAngle = null;
|
|
35093
35368
|
shiftPressed = false;
|
|
35094
35369
|
onPropsChange = void 0;
|
|
35095
35370
|
onInit = void 0;
|
|
35096
35371
|
constructor(params) {
|
|
35097
35372
|
super();
|
|
35098
35373
|
this.config = mergeExceptArrays(WEAVE_STROKE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
|
|
35374
|
+
this.initialize();
|
|
35375
|
+
}
|
|
35376
|
+
initialize() {
|
|
35099
35377
|
this.pointers = new Map();
|
|
35100
35378
|
this.initialized = false;
|
|
35101
35379
|
this.state = WEAVE_STROKE_TOOL_STATE.IDLE;
|
|
@@ -35104,7 +35382,6 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35104
35382
|
this.tempLineId = null;
|
|
35105
35383
|
this.tempLineNode = null;
|
|
35106
35384
|
this.container = void 0;
|
|
35107
|
-
this.snappedAngle = null;
|
|
35108
35385
|
this.measureContainer = void 0;
|
|
35109
35386
|
this.clickPoint = null;
|
|
35110
35387
|
this.snapper = new GreedySnapper({
|
|
@@ -35117,6 +35394,9 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35117
35394
|
getName() {
|
|
35118
35395
|
return WEAVE_STROKE_TOOL_ACTION_NAME;
|
|
35119
35396
|
}
|
|
35397
|
+
getNames() {
|
|
35398
|
+
return [WEAVE_STROKE_TOOL_ACTION_NAME, ...WEAVE_STROKE_TOOL_ACTION_NAME_ALIASES];
|
|
35399
|
+
}
|
|
35120
35400
|
hasAliases() {
|
|
35121
35401
|
return true;
|
|
35122
35402
|
}
|
|
@@ -35135,32 +35415,26 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35135
35415
|
setupEvents() {
|
|
35136
35416
|
const stage = this.instance.getStage();
|
|
35137
35417
|
window.addEventListener("keydown", (e) => {
|
|
35138
|
-
if (e.code === "Enter" && this.instance.getActiveAction()
|
|
35418
|
+
if (e.code === "Enter" && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
|
|
35139
35419
|
this.cancelAction();
|
|
35140
35420
|
return;
|
|
35141
35421
|
}
|
|
35142
|
-
if (e.code === "Escape" && this.instance.getActiveAction()
|
|
35422
|
+
if (e.code === "Escape" && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
|
|
35143
35423
|
this.cancelAction();
|
|
35144
35424
|
return;
|
|
35145
35425
|
}
|
|
35146
|
-
if (e.key === "Shift" && this.instance.getActiveAction()
|
|
35147
|
-
|
|
35148
|
-
this.shiftPressed = true;
|
|
35149
|
-
}
|
|
35150
|
-
});
|
|
35426
|
+
if (e.key === "Shift" && this.getNames().includes(this.instance.getActiveAction() ?? "")) this.shiftPressed = true;
|
|
35427
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35151
35428
|
window.addEventListener("keyup", (e) => {
|
|
35152
|
-
if (e.key === "Shift" && this.instance.getActiveAction()
|
|
35153
|
-
|
|
35154
|
-
this.shiftPressed = false;
|
|
35155
|
-
}
|
|
35156
|
-
});
|
|
35429
|
+
if (e.key === "Shift" && this.getNames().includes(this.instance.getActiveAction() ?? "")) this.shiftPressed = false;
|
|
35430
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35157
35431
|
stage.on("pointerdown", (e) => {
|
|
35158
35432
|
this.setTapStart(e);
|
|
35159
35433
|
this.pointers.set(e.evt.pointerId, {
|
|
35160
35434
|
x: e.evt.clientX,
|
|
35161
35435
|
y: e.evt.clientY
|
|
35162
35436
|
});
|
|
35163
|
-
if (this.pointers.size === 2 && this.instance.getActiveAction()
|
|
35437
|
+
if (this.pointers.size === 2 && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
|
|
35164
35438
|
this.state = WEAVE_STROKE_TOOL_STATE.ADDING;
|
|
35165
35439
|
return;
|
|
35166
35440
|
}
|
|
@@ -35170,7 +35444,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35170
35444
|
stage.on("pointermove", () => {
|
|
35171
35445
|
if (this.state === WEAVE_STROKE_TOOL_STATE.IDLE) return;
|
|
35172
35446
|
this.setCursor();
|
|
35173
|
-
if (this.pointers.size === 2 && this.instance.getActiveAction()
|
|
35447
|
+
if (this.pointers.size === 2 && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
|
|
35174
35448
|
this.state = WEAVE_STROKE_TOOL_STATE.ADDING;
|
|
35175
35449
|
return;
|
|
35176
35450
|
}
|
|
@@ -35188,7 +35462,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35188
35462
|
addLine() {
|
|
35189
35463
|
this.setCursor();
|
|
35190
35464
|
this.setFocusStage();
|
|
35191
|
-
this.instance.emitEvent("onAddingStroke", { actionName: this.instance.getActiveAction() ??
|
|
35465
|
+
this.instance.emitEvent("onAddingStroke", { actionName: this.instance.getActiveAction() ?? "not-defined" });
|
|
35192
35466
|
this.shiftPressed = false;
|
|
35193
35467
|
this.clickPoint = null;
|
|
35194
35468
|
this.setState(WEAVE_STROKE_TOOL_STATE.ADDING);
|
|
@@ -35296,7 +35570,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35296
35570
|
});
|
|
35297
35571
|
delete finalLine.props.dragBoundFunc;
|
|
35298
35572
|
this.instance.addNode(finalLine, this.container?.getAttrs().id);
|
|
35299
|
-
this.instance.emitEvent("onAddedStroke", { actionName: this.instance.getActiveAction() ??
|
|
35573
|
+
this.instance.emitEvent("onAddedStroke", { actionName: this.instance.getActiveAction() ?? "not-defined" });
|
|
35300
35574
|
nodeCreated = true;
|
|
35301
35575
|
}
|
|
35302
35576
|
}
|
|
@@ -35346,6 +35620,9 @@ var WeaveRegularPolygonToolAction = class extends WeaveAction {
|
|
|
35346
35620
|
onInit = void 0;
|
|
35347
35621
|
constructor() {
|
|
35348
35622
|
super();
|
|
35623
|
+
this.initialize();
|
|
35624
|
+
}
|
|
35625
|
+
initialize() {
|
|
35349
35626
|
this.pointers = new Map();
|
|
35350
35627
|
this.initialized = false;
|
|
35351
35628
|
this.state = REGULAR_POLYGON_TOOL_STATE.IDLE;
|
|
@@ -35380,7 +35657,7 @@ var WeaveRegularPolygonToolAction = class extends WeaveAction {
|
|
|
35380
35657
|
this.cancelAction();
|
|
35381
35658
|
return;
|
|
35382
35659
|
}
|
|
35383
|
-
});
|
|
35660
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35384
35661
|
stage.on("pointerdown", (e) => {
|
|
35385
35662
|
this.setTapStart(e);
|
|
35386
35663
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -35554,6 +35831,9 @@ var WeaveFrameToolAction = class extends WeaveAction {
|
|
|
35554
35831
|
onInit = void 0;
|
|
35555
35832
|
constructor() {
|
|
35556
35833
|
super();
|
|
35834
|
+
this.initialize();
|
|
35835
|
+
}
|
|
35836
|
+
initialize() {
|
|
35557
35837
|
this.initialized = false;
|
|
35558
35838
|
this.state = FRAME_TOOL_STATE.IDLE;
|
|
35559
35839
|
this.frameId = null;
|
|
@@ -35581,7 +35861,7 @@ var WeaveFrameToolAction = class extends WeaveAction {
|
|
|
35581
35861
|
this.cancelAction();
|
|
35582
35862
|
return;
|
|
35583
35863
|
}
|
|
35584
|
-
});
|
|
35864
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35585
35865
|
stage.on("pointermove", () => {
|
|
35586
35866
|
if (this.state === FRAME_TOOL_STATE.IDLE) return;
|
|
35587
35867
|
this.setCursor();
|
|
@@ -35683,6 +35963,10 @@ var WeaveExportStageToolAction = class extends WeaveAction {
|
|
|
35683
35963
|
};
|
|
35684
35964
|
onPropsChange = void 0;
|
|
35685
35965
|
onInit = void 0;
|
|
35966
|
+
initialize = void 0;
|
|
35967
|
+
constructor() {
|
|
35968
|
+
super();
|
|
35969
|
+
}
|
|
35686
35970
|
getName() {
|
|
35687
35971
|
return EXPORT_STAGE_TOOL_ACTION_NAME;
|
|
35688
35972
|
}
|
|
@@ -35730,6 +36014,10 @@ var WeaveExportNodesToolAction = class extends WeaveAction {
|
|
|
35730
36014
|
};
|
|
35731
36015
|
onPropsChange = void 0;
|
|
35732
36016
|
onInit = void 0;
|
|
36017
|
+
initialize = void 0;
|
|
36018
|
+
constructor() {
|
|
36019
|
+
super();
|
|
36020
|
+
}
|
|
35733
36021
|
getName() {
|
|
35734
36022
|
return EXPORT_NODES_TOOL_ACTION_NAME;
|
|
35735
36023
|
}
|
|
@@ -35782,6 +36070,9 @@ var WeaveAlignNodesToolAction = class extends WeaveAction {
|
|
|
35782
36070
|
onInit = void 0;
|
|
35783
36071
|
constructor() {
|
|
35784
36072
|
super();
|
|
36073
|
+
this.initialize();
|
|
36074
|
+
}
|
|
36075
|
+
initialize() {
|
|
35785
36076
|
this.initialized = false;
|
|
35786
36077
|
this.state = ALIGN_NODES_TOOL_STATE.IDLE;
|
|
35787
36078
|
}
|
|
@@ -36031,6 +36322,9 @@ var WeaveCommentToolAction = class extends WeaveAction {
|
|
|
36031
36322
|
super();
|
|
36032
36323
|
const { config } = params ?? {};
|
|
36033
36324
|
this.config = mergeExceptArrays(WEAVE_COMMENT_TOOL_DEFAULT_CONFIG, config);
|
|
36325
|
+
this.initialize();
|
|
36326
|
+
}
|
|
36327
|
+
initialize() {
|
|
36034
36328
|
this.pointers = new Map();
|
|
36035
36329
|
this.initialized = false;
|
|
36036
36330
|
this.state = WEAVE_COMMENT_TOOL_STATE.IDLE;
|
|
@@ -36108,7 +36402,7 @@ var WeaveCommentToolAction = class extends WeaveAction {
|
|
|
36108
36402
|
return;
|
|
36109
36403
|
}
|
|
36110
36404
|
if (e.code === "Escape" && this.state === WEAVE_COMMENT_TOOL_STATE.CREATING_COMMENT) this.setState(WEAVE_COMMENT_TOOL_STATE.ADDING);
|
|
36111
|
-
});
|
|
36405
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
36112
36406
|
stage.on("pointermove", (e) => {
|
|
36113
36407
|
if (this.state === WEAVE_COMMENT_TOOL_STATE.IDLE) return;
|
|
36114
36408
|
if (commentNodeHandler?.isCommentViewing()) {
|
|
@@ -36259,6 +36553,9 @@ var WeaveVideoToolAction = class extends WeaveAction {
|
|
|
36259
36553
|
update = void 0;
|
|
36260
36554
|
constructor() {
|
|
36261
36555
|
super();
|
|
36556
|
+
this.initialize();
|
|
36557
|
+
}
|
|
36558
|
+
initialize() {
|
|
36262
36559
|
this.pointers = new Map();
|
|
36263
36560
|
this.initialized = false;
|
|
36264
36561
|
this.state = VIDEO_TOOL_STATE.IDLE;
|
|
@@ -36305,7 +36602,7 @@ var WeaveVideoToolAction = class extends WeaveAction {
|
|
|
36305
36602
|
this.cancelAction();
|
|
36306
36603
|
return;
|
|
36307
36604
|
}
|
|
36308
|
-
});
|
|
36605
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
36309
36606
|
stage.on("pointerdown", (e) => {
|
|
36310
36607
|
this.setTapStart(e);
|
|
36311
36608
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -36438,6 +36735,9 @@ var WeaveMeasureToolAction = class extends WeaveAction {
|
|
|
36438
36735
|
constructor(params) {
|
|
36439
36736
|
super();
|
|
36440
36737
|
this.config = mergeExceptArrays(WEAVE_MEASURE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
|
|
36738
|
+
this.initialize();
|
|
36739
|
+
}
|
|
36740
|
+
initialize() {
|
|
36441
36741
|
this.initialized = false;
|
|
36442
36742
|
this.state = MEASURE_TOOL_STATE.IDLE;
|
|
36443
36743
|
this.measureId = null;
|
|
@@ -36464,7 +36764,7 @@ var WeaveMeasureToolAction = class extends WeaveAction {
|
|
|
36464
36764
|
const stage = this.instance.getStage();
|
|
36465
36765
|
window.addEventListener("keydown", (e) => {
|
|
36466
36766
|
if (e.code === "Escape" && this.instance.getActiveAction() === MEASURE_TOOL_ACTION_NAME) this.cancelAction();
|
|
36467
|
-
});
|
|
36767
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
36468
36768
|
stage.on("pointermove", () => {
|
|
36469
36769
|
if (this.state === MEASURE_TOOL_STATE.IDLE) return;
|
|
36470
36770
|
if (this.state === MEASURE_TOOL_STATE.SET_TO) {
|
|
@@ -36734,6 +37034,9 @@ var WeaveConnectorToolAction = class extends WeaveAction {
|
|
|
36734
37034
|
constructor(params) {
|
|
36735
37035
|
super();
|
|
36736
37036
|
this.config = mergeExceptArrays(CONNECTOR_TOOL_DEFAULT_CONFIG, params?.config);
|
|
37037
|
+
this.initialize();
|
|
37038
|
+
}
|
|
37039
|
+
initialize() {
|
|
36737
37040
|
this.pointers = new Map();
|
|
36738
37041
|
this.initialized = false;
|
|
36739
37042
|
this.tempLineNode = null;
|
|
@@ -36772,7 +37075,7 @@ var WeaveConnectorToolAction = class extends WeaveAction {
|
|
|
36772
37075
|
return;
|
|
36773
37076
|
}
|
|
36774
37077
|
if (e.code === "Escape" && this.instance.getActiveAction() === CONNECTOR_TOOL_ACTION_NAME) this.cancelAction();
|
|
36775
|
-
});
|
|
37078
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
36776
37079
|
let nodeHovered = void 0;
|
|
36777
37080
|
stage.on("pointermove", () => {
|
|
36778
37081
|
if (!(this.state === CONNECTOR_TOOL_STATE.SELECTING_INITIAL || this.state === CONNECTOR_TOOL_STATE.SELECTING_FINAL)) return;
|
|
@@ -37087,16 +37390,9 @@ var WeaveConnectorToolAction = class extends WeaveAction {
|
|
|
37087
37390
|
//#endregion
|
|
37088
37391
|
//#region src/plugins/stage-grid/stage-grid.ts
|
|
37089
37392
|
var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
37090
|
-
actStageZoomX = 1;
|
|
37091
|
-
actStageZoomY = 1;
|
|
37092
|
-
actStagePosX = 0;
|
|
37093
|
-
actStagePosY = 0;
|
|
37094
37393
|
constructor(params) {
|
|
37095
37394
|
super();
|
|
37096
37395
|
const { config } = params ?? {};
|
|
37097
|
-
this.moveToolActive = false;
|
|
37098
|
-
this.isMouseMiddleButtonPressed = false;
|
|
37099
|
-
this.isSpaceKeyPressed = false;
|
|
37100
37396
|
this.config = {
|
|
37101
37397
|
type: WEAVE_GRID_DEFAULT_TYPE,
|
|
37102
37398
|
gridColor: WEAVE_GRID_DEFAULT_COLOR,
|
|
@@ -37105,7 +37401,17 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37105
37401
|
gridDotMaxDotsPerAxis: WEAVE_GRID_DEFAULT_DOT_MAX_DOTS_PER_AXIS,
|
|
37106
37402
|
...config
|
|
37107
37403
|
};
|
|
37404
|
+
this.initialize();
|
|
37405
|
+
}
|
|
37406
|
+
initialize() {
|
|
37407
|
+
this.moveToolActive = false;
|
|
37408
|
+
this.isMouseMiddleButtonPressed = false;
|
|
37409
|
+
this.isSpaceKeyPressed = false;
|
|
37108
37410
|
this.forceStageChange = false;
|
|
37411
|
+
this.actStagePosX = 0;
|
|
37412
|
+
this.actStagePosY = 0;
|
|
37413
|
+
this.actStageZoomX = 1;
|
|
37414
|
+
this.actStageZoomY = 1;
|
|
37109
37415
|
}
|
|
37110
37416
|
getName() {
|
|
37111
37417
|
return WEAVE_STAGE_GRID_PLUGIN_KEY;
|
|
@@ -37130,10 +37436,10 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37130
37436
|
const stage = this.instance.getStage();
|
|
37131
37437
|
window.addEventListener("keydown", (e) => {
|
|
37132
37438
|
if (e.code === "Space") this.isSpaceKeyPressed = true;
|
|
37133
|
-
});
|
|
37439
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37134
37440
|
window.addEventListener("keyup", (e) => {
|
|
37135
37441
|
if (e.code === "Space") this.isSpaceKeyPressed = false;
|
|
37136
|
-
});
|
|
37442
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37137
37443
|
this.instance.addEventListener("onStageMove", () => {
|
|
37138
37444
|
this.onRender();
|
|
37139
37445
|
});
|
|
@@ -37367,15 +37673,14 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37367
37673
|
//#endregion
|
|
37368
37674
|
//#region src/plugins/stage-panning/stage-panning.ts
|
|
37369
37675
|
var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
37370
|
-
panning = false;
|
|
37371
|
-
currentPointer = null;
|
|
37372
|
-
stageScrollInterval = void 0;
|
|
37373
|
-
panEdgeTargets = {};
|
|
37374
37676
|
getLayerName = void 0;
|
|
37375
37677
|
initLayer = void 0;
|
|
37376
37678
|
constructor(params) {
|
|
37377
37679
|
super();
|
|
37378
37680
|
this.config = mergeExceptArrays(WEAVE_STAGE_PANNING_DEFAULT_CONFIG, params?.config ?? {});
|
|
37681
|
+
this.initialize();
|
|
37682
|
+
}
|
|
37683
|
+
initialize() {
|
|
37379
37684
|
this.pointers = new Map();
|
|
37380
37685
|
this.panning = false;
|
|
37381
37686
|
this.isDragging = false;
|
|
@@ -37387,6 +37692,9 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37387
37692
|
this.isCtrlOrMetaPressed = false;
|
|
37388
37693
|
this.isSpaceKeyPressed = false;
|
|
37389
37694
|
this.previousPointer = null;
|
|
37695
|
+
this.currentPointer = null;
|
|
37696
|
+
this.stageScrollInterval = void 0;
|
|
37697
|
+
this.panEdgeTargets = {};
|
|
37390
37698
|
}
|
|
37391
37699
|
getName() {
|
|
37392
37700
|
return WEAVE_STAGE_PANNING_KEY;
|
|
@@ -37420,7 +37728,7 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37420
37728
|
this.isSpaceKeyPressed = true;
|
|
37421
37729
|
this.setCursor();
|
|
37422
37730
|
}
|
|
37423
|
-
});
|
|
37731
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37424
37732
|
window.addEventListener("keyup", (e) => {
|
|
37425
37733
|
if (e.key === "Meta" || e.key === "Control") this.isCtrlOrMetaPressed = false;
|
|
37426
37734
|
if (e.code === "Space") {
|
|
@@ -37431,7 +37739,7 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37431
37739
|
this.isSpaceKeyPressed = false;
|
|
37432
37740
|
this.disableMove();
|
|
37433
37741
|
}
|
|
37434
|
-
});
|
|
37742
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37435
37743
|
let lastPos = null;
|
|
37436
37744
|
stage.on("pointerdown", (e) => {
|
|
37437
37745
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -37504,7 +37812,10 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37504
37812
|
this.instance.emitEvent("onStageMove");
|
|
37505
37813
|
};
|
|
37506
37814
|
const handleWheelThrottled = (0, import_lodash.throttle)(handleWheel, WEAVE_STAGE_PANNING_THROTTLE_MS);
|
|
37507
|
-
window.addEventListener("wheel", handleWheelThrottled, {
|
|
37815
|
+
window.addEventListener("wheel", handleWheelThrottled, {
|
|
37816
|
+
passive: true,
|
|
37817
|
+
signal: this.instance.getEventsController()?.signal
|
|
37818
|
+
});
|
|
37508
37819
|
stage.on("dragstart", (e) => {
|
|
37509
37820
|
const duration = 1e3 / 60;
|
|
37510
37821
|
if (this.panEdgeTargets[e.target.getAttrs().id ?? ""] !== void 0) return;
|
|
@@ -37562,7 +37873,10 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37562
37873
|
stage.container().style.setProperty("-webkit-user-drag", "none");
|
|
37563
37874
|
stage.getContent().addEventListener("touchmove", function(e) {
|
|
37564
37875
|
e.preventDefault();
|
|
37565
|
-
}, {
|
|
37876
|
+
}, {
|
|
37877
|
+
passive: false,
|
|
37878
|
+
signal: this.instance.getEventsController()?.signal
|
|
37879
|
+
});
|
|
37566
37880
|
}
|
|
37567
37881
|
isPanning() {
|
|
37568
37882
|
return this.panning;
|
|
@@ -37640,6 +37954,9 @@ var WeaveStageMinimapPlugin = class extends WeavePlugin {
|
|
|
37640
37954
|
constructor(params) {
|
|
37641
37955
|
super();
|
|
37642
37956
|
this.config = mergeExceptArrays(STAGE_MINIMAP_DEFAULT_CONFIG, params.config);
|
|
37957
|
+
this.initialize();
|
|
37958
|
+
}
|
|
37959
|
+
initialize() {
|
|
37643
37960
|
this.initialized = false;
|
|
37644
37961
|
}
|
|
37645
37962
|
getName() {
|
|
@@ -37817,6 +38134,7 @@ const WEAVE_STAGE_RESIZE_KEY = "stageResize";
|
|
|
37817
38134
|
var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
37818
38135
|
getLayerName = void 0;
|
|
37819
38136
|
initLayer = void 0;
|
|
38137
|
+
initialize = void 0;
|
|
37820
38138
|
getName() {
|
|
37821
38139
|
return WEAVE_STAGE_RESIZE_KEY;
|
|
37822
38140
|
}
|
|
@@ -37836,6 +38154,10 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
|
37836
38154
|
const pluginInstance = plugins[pluginId];
|
|
37837
38155
|
pluginInstance.onRender?.();
|
|
37838
38156
|
}
|
|
38157
|
+
this.instance.emitEvent("onStageResize", {
|
|
38158
|
+
width: stage.width(),
|
|
38159
|
+
height: stage.height()
|
|
38160
|
+
});
|
|
37839
38161
|
}
|
|
37840
38162
|
}
|
|
37841
38163
|
onInit() {
|
|
@@ -37844,7 +38166,7 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
|
37844
38166
|
}, DEFAULT_THROTTLE_MS);
|
|
37845
38167
|
window.addEventListener("resize", () => {
|
|
37846
38168
|
throttledResize();
|
|
37847
|
-
});
|
|
38169
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37848
38170
|
const resizeObserver = new ResizeObserver(() => {
|
|
37849
38171
|
throttledResize();
|
|
37850
38172
|
});
|
|
@@ -37862,10 +38184,12 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
|
37862
38184
|
//#endregion
|
|
37863
38185
|
//#region src/plugins/nodes-multi-selection-feedback/nodes-multi-selection-feedback.ts
|
|
37864
38186
|
var WeaveNodesMultiSelectionFeedbackPlugin = class extends WeavePlugin {
|
|
37865
|
-
selectedHalos = {};
|
|
37866
38187
|
constructor(params) {
|
|
37867
38188
|
super();
|
|
37868
38189
|
this.config = mergeExceptArrays(WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_DEFAULT_CONFIG, params?.config ?? {});
|
|
38190
|
+
this.initialize();
|
|
38191
|
+
}
|
|
38192
|
+
initialize() {
|
|
37869
38193
|
this.selectedHalos = {};
|
|
37870
38194
|
}
|
|
37871
38195
|
getName() {
|
|
@@ -38031,12 +38355,14 @@ var WeaveNodesMultiSelectionFeedbackPlugin = class extends WeavePlugin {
|
|
|
38031
38355
|
//#endregion
|
|
38032
38356
|
//#region src/plugins/connected-users/connected-users.ts
|
|
38033
38357
|
var WeaveConnectedUsersPlugin = class extends WeavePlugin {
|
|
38034
|
-
connectedUsers = {};
|
|
38035
38358
|
getLayerName = void 0;
|
|
38036
38359
|
constructor(params) {
|
|
38037
38360
|
super();
|
|
38038
38361
|
const { config } = params ?? {};
|
|
38039
38362
|
this.config = config;
|
|
38363
|
+
this.initialize();
|
|
38364
|
+
}
|
|
38365
|
+
initialize() {
|
|
38040
38366
|
this.connectedUsers = {};
|
|
38041
38367
|
}
|
|
38042
38368
|
getName() {
|
|
@@ -38083,6 +38409,9 @@ var WeaveUsersSelectionPlugin = class extends WeavePlugin {
|
|
|
38083
38409
|
this.config = config;
|
|
38084
38410
|
this.config.getUser = memoize(this.config.getUser);
|
|
38085
38411
|
this.config.getUserColor = memoize(this.config.getUserColor);
|
|
38412
|
+
this.initialize();
|
|
38413
|
+
}
|
|
38414
|
+
initialize() {
|
|
38086
38415
|
this.usersSelection = {};
|
|
38087
38416
|
}
|
|
38088
38417
|
getName() {
|
|
@@ -38275,6 +38604,9 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
38275
38604
|
this.config.getUser = memoize(this.config.getUser);
|
|
38276
38605
|
this.config.getUserBackgroundColor = memoize(this.config.getUserBackgroundColor);
|
|
38277
38606
|
this.config.getUserForegroundColor = memoize(this.config.getUserForegroundColor);
|
|
38607
|
+
this.initialize();
|
|
38608
|
+
}
|
|
38609
|
+
initialize() {
|
|
38278
38610
|
this.usersPointers = {};
|
|
38279
38611
|
this.usersOperations = {};
|
|
38280
38612
|
}
|
|
@@ -38485,6 +38817,9 @@ var WeaveUsersPresencePlugin = class extends WeavePlugin {
|
|
|
38485
38817
|
super();
|
|
38486
38818
|
const { config } = params;
|
|
38487
38819
|
this.config = mergeExceptArrays(WEAVE_USERS_PRESENCE_CONFIG_DEFAULT_PROPS, config);
|
|
38820
|
+
this.initialize();
|
|
38821
|
+
}
|
|
38822
|
+
initialize() {
|
|
38488
38823
|
this.userPresence = {};
|
|
38489
38824
|
}
|
|
38490
38825
|
getName() {
|
|
@@ -38560,6 +38895,9 @@ var WeaveStageDropAreaPlugin = class extends WeavePlugin {
|
|
|
38560
38895
|
initLayer = void 0;
|
|
38561
38896
|
constructor() {
|
|
38562
38897
|
super();
|
|
38898
|
+
this.initialize();
|
|
38899
|
+
}
|
|
38900
|
+
initialize() {
|
|
38563
38901
|
this.enabled = true;
|
|
38564
38902
|
}
|
|
38565
38903
|
getName() {
|
|
@@ -38573,14 +38911,20 @@ var WeaveStageDropAreaPlugin = class extends WeavePlugin {
|
|
|
38573
38911
|
stage.container().addEventListener("dragover", (e) => {
|
|
38574
38912
|
e.preventDefault();
|
|
38575
38913
|
e.stopPropagation();
|
|
38576
|
-
});
|
|
38914
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
38577
38915
|
stage.container().addEventListener("drop", (e) => {
|
|
38578
38916
|
e.preventDefault();
|
|
38579
38917
|
e.stopPropagation();
|
|
38580
38918
|
this.instance.emitEvent("onStageDrop", e);
|
|
38919
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
38920
|
+
window.addEventListener("dragover", (e) => e.preventDefault(), {
|
|
38921
|
+
signal: this.instance.getEventsController()?.signal,
|
|
38922
|
+
passive: false
|
|
38923
|
+
});
|
|
38924
|
+
window.addEventListener("drop", (e) => e.preventDefault(), {
|
|
38925
|
+
signal: this.instance.getEventsController()?.signal,
|
|
38926
|
+
passive: false
|
|
38581
38927
|
});
|
|
38582
|
-
window.addEventListener("dragover", (e) => e.preventDefault(), { passive: false });
|
|
38583
|
-
window.addEventListener("drop", (e) => e.preventDefault(), { passive: false });
|
|
38584
38928
|
}
|
|
38585
38929
|
enable() {
|
|
38586
38930
|
this.enabled = true;
|
|
@@ -38599,6 +38943,9 @@ var WeaveNodesEdgeSnappingPlugin = class extends WeavePlugin {
|
|
|
38599
38943
|
this.guideLineConfig = config?.guideLine ?? GUIDE_LINE_DEFAULT_CONFIG;
|
|
38600
38944
|
this.dragSnappingThreshold = config?.dragSnappingThreshold ?? GUIDE_LINE_DRAG_SNAPPING_THRESHOLD;
|
|
38601
38945
|
this.transformSnappingThreshold = config?.transformSnappingThreshold ?? GUIDE_LINE_TRANSFORM_SNAPPING_THRESHOLD;
|
|
38946
|
+
this.initialize();
|
|
38947
|
+
}
|
|
38948
|
+
initialize() {
|
|
38602
38949
|
this.enabled = true;
|
|
38603
38950
|
}
|
|
38604
38951
|
getName() {
|
|
@@ -38975,6 +39322,9 @@ var WeaveNodesDistanceSnappingPlugin = class extends WeavePlugin {
|
|
|
38975
39322
|
this.enterSnappingTolerance = config?.enterSnappingTolerance ?? GUIDE_ENTER_SNAPPING_TOLERANCE;
|
|
38976
39323
|
this.exitSnappingTolerance = config?.exitSnappingTolerance ?? GUIDE_EXIT_SNAPPING_TOLERANCE;
|
|
38977
39324
|
this.uiConfig = mergeExceptArrays(GUIDE_DISTANCE_LINE_DEFAULT_CONFIG, config?.ui);
|
|
39325
|
+
this.initialize();
|
|
39326
|
+
}
|
|
39327
|
+
initialize() {
|
|
38978
39328
|
this.enabled = true;
|
|
38979
39329
|
}
|
|
38980
39330
|
getName() {
|
|
@@ -39621,12 +39971,14 @@ var WeaveNodesDistanceSnappingPlugin = class extends WeavePlugin {
|
|
|
39621
39971
|
//#endregion
|
|
39622
39972
|
//#region src/plugins/comments-renderer/comments-renderer.ts
|
|
39623
39973
|
var WeaveCommentsRendererPlugin = class extends WeavePlugin {
|
|
39624
|
-
comments = [];
|
|
39625
39974
|
getLayerName = void 0;
|
|
39626
39975
|
constructor(params) {
|
|
39627
39976
|
super();
|
|
39628
39977
|
const { config } = params ?? {};
|
|
39629
39978
|
this.config = config;
|
|
39979
|
+
this.initialize();
|
|
39980
|
+
}
|
|
39981
|
+
initialize() {
|
|
39630
39982
|
this.comments = [];
|
|
39631
39983
|
}
|
|
39632
39984
|
getName() {
|
|
@@ -39717,6 +40069,7 @@ const WEAVE_STAGE_KEYBOARD_MOVE_DEFAULT_CONFIG = { movementDelta: 5 };
|
|
|
39717
40069
|
var WeaveStageKeyboardMovePlugin = class extends WeavePlugin {
|
|
39718
40070
|
getLayerName = void 0;
|
|
39719
40071
|
initLayer = void 0;
|
|
40072
|
+
initialize = void 0;
|
|
39720
40073
|
constructor(params) {
|
|
39721
40074
|
super();
|
|
39722
40075
|
this.config = mergeExceptArrays(WEAVE_STAGE_KEYBOARD_MOVE_DEFAULT_CONFIG, params?.config ?? {});
|
|
@@ -39755,7 +40108,7 @@ var WeaveStageKeyboardMovePlugin = class extends WeavePlugin {
|
|
|
39755
40108
|
if (e.code === "ArrowLeft" && e.shiftKey) this.handleNodesMovement("left");
|
|
39756
40109
|
if (e.code === "ArrowRight" && e.shiftKey) this.handleNodesMovement("right");
|
|
39757
40110
|
if (e.code === "ArrowDown" && e.shiftKey) this.handleNodesMovement("down");
|
|
39758
|
-
});
|
|
40111
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
39759
40112
|
}
|
|
39760
40113
|
enable() {
|
|
39761
40114
|
this.enabled = true;
|
|
@@ -39812,4 +40165,4 @@ function getJSONFromYjsBinary(actualState) {
|
|
|
39812
40165
|
}
|
|
39813
40166
|
|
|
39814
40167
|
//#endregion
|
|
39815
|
-
export { ALIGN_NODES_ALIGN_TO, ALIGN_NODES_TOOL_ACTION_NAME, ALIGN_NODES_TOOL_STATE,
|
|
40168
|
+
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, weavejsToYjsBinary };
|