@inditextech/weave-sdk 3.5.0 → 3.6.0-SNAPSHOT.112.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 +589 -168
- package/dist/sdk.node.js +589 -168
- package/dist/types.d.ts +137 -14
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +589 -168
- 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() {
|
|
@@ -18624,7 +18632,10 @@ const DEFAULT_ADD_NODE_OPTIONS = { emitUserChangeEvent: false };
|
|
|
18624
18632
|
const DEFAULT_UPDATE_NODE_OPTIONS = { emitUserChangeEvent: false };
|
|
18625
18633
|
const DEFAULT_REMOVE_NODE_OPTIONS = { emitUserChangeEvent: false };
|
|
18626
18634
|
const DEFAULT_MOVE_NODE_OPTIONS = { emitUserChangeEvent: false };
|
|
18627
|
-
const WEAVE_DEFAULT_CONFIG = {
|
|
18635
|
+
const WEAVE_DEFAULT_CONFIG = {
|
|
18636
|
+
behaviors: { axisLockThreshold: 5 },
|
|
18637
|
+
performance: { upscale: { enabled: false } }
|
|
18638
|
+
};
|
|
18628
18639
|
|
|
18629
18640
|
//#endregion
|
|
18630
18641
|
//#region src/plugins/users-presence/constants.ts
|
|
@@ -18653,6 +18664,9 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
18653
18664
|
constructor(params) {
|
|
18654
18665
|
super();
|
|
18655
18666
|
this.config = mergeExceptArrays(WEAVE_NODES_SELECTION_DEFAULT_CONFIG, params?.config ?? {});
|
|
18667
|
+
this.initialize();
|
|
18668
|
+
}
|
|
18669
|
+
initialize() {
|
|
18656
18670
|
this.defaultEnabledAnchors = this.config.selection?.enabledAnchors ?? [
|
|
18657
18671
|
"top-left",
|
|
18658
18672
|
"top-center",
|
|
@@ -18816,7 +18830,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
18816
18830
|
nodeHovered = void 0;
|
|
18817
18831
|
}
|
|
18818
18832
|
this.instance.getStage().handleMouseover?.();
|
|
18819
|
-
});
|
|
18833
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
18820
18834
|
const handleTransform = (e) => {
|
|
18821
18835
|
const moved = this.checkMoved(e);
|
|
18822
18836
|
if (moved) this.getContextMenuPlugin()?.cancelLongPressTimer();
|
|
@@ -19231,11 +19245,11 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
19231
19245
|
});
|
|
19232
19246
|
return;
|
|
19233
19247
|
}
|
|
19234
|
-
});
|
|
19248
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
19235
19249
|
stage.container().addEventListener("keyup", (e) => {
|
|
19236
19250
|
if (!(e.ctrlKey || e.metaKey)) this.isCtrlMetaPressed = false;
|
|
19237
19251
|
if (e.code === "Space") this.isSpaceKeyPressed = false;
|
|
19238
|
-
});
|
|
19252
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
19239
19253
|
stage.on("pointerdown", (e) => {
|
|
19240
19254
|
this.setTapStart(e);
|
|
19241
19255
|
this.handledClickOrTap = false;
|
|
@@ -19442,7 +19456,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
19442
19456
|
if (existNode) newSelectedNodes.push(existNode);
|
|
19443
19457
|
}
|
|
19444
19458
|
this.tr.nodes([...newSelectedNodes]);
|
|
19445
|
-
this.tr.forceUpdate();
|
|
19459
|
+
if (newSelectedNodes.length > 0) this.tr.forceUpdate();
|
|
19446
19460
|
this.triggerSelectedNodesEvent();
|
|
19447
19461
|
}
|
|
19448
19462
|
getSelectionPlugin() {
|
|
@@ -19695,6 +19709,9 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
|
|
|
19695
19709
|
super();
|
|
19696
19710
|
this.getImageBase64 = params.getImageBase64;
|
|
19697
19711
|
this.config = mergeExceptArrays(WEAVE_COPY_PASTE_CONFIG_DEFAULT, params?.config);
|
|
19712
|
+
this.initialize();
|
|
19713
|
+
}
|
|
19714
|
+
initialize() {
|
|
19698
19715
|
this.actualInternalPaddingX = 0;
|
|
19699
19716
|
this.actualInternalPaddingY = 0;
|
|
19700
19717
|
this.lastInternalPasteSnapshot = "";
|
|
@@ -19800,7 +19817,7 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
|
|
|
19800
19817
|
this.focusPasteCatcher();
|
|
19801
19818
|
if (!this.enabled) return;
|
|
19802
19819
|
}
|
|
19803
|
-
});
|
|
19820
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
19804
19821
|
if (catcher) catcher.addEventListener("paste", async (e) => {
|
|
19805
19822
|
e.preventDefault();
|
|
19806
19823
|
let items = void 0;
|
|
@@ -19819,7 +19836,7 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
|
|
|
19819
19836
|
return;
|
|
19820
19837
|
}
|
|
19821
19838
|
this.sendExternalPasteEvent(void 0, items);
|
|
19822
|
-
});
|
|
19839
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
19823
19840
|
}
|
|
19824
19841
|
sendExternalPasteEvent(dataList, items) {
|
|
19825
19842
|
const stage = this.instance.getStage();
|
|
@@ -21974,11 +21991,34 @@ var WeaveRegisterManager = class {
|
|
|
21974
21991
|
}
|
|
21975
21992
|
}
|
|
21976
21993
|
}
|
|
21994
|
+
resetNodesHandlers() {
|
|
21995
|
+
for (const nodeHandlerId of Object.keys(this.nodesHandlers)) {
|
|
21996
|
+
const nodeHandler = this.nodesHandlers[nodeHandlerId];
|
|
21997
|
+
nodeHandler.initialize?.();
|
|
21998
|
+
}
|
|
21999
|
+
}
|
|
22000
|
+
resetActionsHandlers() {
|
|
22001
|
+
for (const actionHandlerId of Object.keys(this.actionsHandlers)) {
|
|
22002
|
+
const actionHandler = this.actionsHandlers[actionHandlerId];
|
|
22003
|
+
actionHandler.initialize?.();
|
|
22004
|
+
}
|
|
22005
|
+
}
|
|
22006
|
+
resetPlugins() {
|
|
22007
|
+
for (const pluginId of Object.keys(this.plugins)) {
|
|
22008
|
+
const plugin = this.plugins[pluginId];
|
|
22009
|
+
plugin.initialize?.();
|
|
22010
|
+
}
|
|
22011
|
+
}
|
|
22012
|
+
reset() {
|
|
22013
|
+
this.resetNodesHandlers();
|
|
22014
|
+
this.resetActionsHandlers();
|
|
22015
|
+
this.resetPlugins();
|
|
22016
|
+
}
|
|
21977
22017
|
};
|
|
21978
22018
|
|
|
21979
22019
|
//#endregion
|
|
21980
22020
|
//#region package.json
|
|
21981
|
-
var version = "3.
|
|
22021
|
+
var version = "3.6.0-SNAPSHOT.112.1";
|
|
21982
22022
|
|
|
21983
22023
|
//#endregion
|
|
21984
22024
|
//#region src/managers/setup.ts
|
|
@@ -22095,6 +22135,11 @@ var WeaveStageManager = class {
|
|
|
22095
22135
|
initialZIndex: void 0
|
|
22096
22136
|
};
|
|
22097
22137
|
const stage = new Konva.Stage({ ...props });
|
|
22138
|
+
if (!this.instance.isServerSide()) {
|
|
22139
|
+
const containerParent = stage.container().parentNode;
|
|
22140
|
+
stage.width(containerParent.clientWidth);
|
|
22141
|
+
stage.height(containerParent.clientHeight);
|
|
22142
|
+
}
|
|
22098
22143
|
const realContainer = stage.container();
|
|
22099
22144
|
if (realContainer !== void 0 && realContainer.style?.position !== "relative") realContainer.style.position = "relative";
|
|
22100
22145
|
this.setStage(stage);
|
|
@@ -22227,6 +22272,10 @@ var WeaveExportManager = class {
|
|
|
22227
22272
|
exportNodesAsImage(nodes, boundingNodes, options) {
|
|
22228
22273
|
return new Promise((resolve) => {
|
|
22229
22274
|
const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
|
|
22275
|
+
const nodesSelectionPluginPrev = this.getNodesSelectionPlugin()?.isEnabled();
|
|
22276
|
+
const nodesDistanceSnappingPluginPrev = this.getNodesDistanceSnappingPlugin()?.isEnabled();
|
|
22277
|
+
const nodesEdgeSnappingPluginPrev = this.getNodesDistanceSnappingPlugin()?.isEnabled();
|
|
22278
|
+
const nodesStageGridPluginPrev = this.getStageGridPlugin()?.isEnabled();
|
|
22230
22279
|
this.getNodesSelectionPlugin()?.disable();
|
|
22231
22280
|
this.getNodesDistanceSnappingPlugin()?.disable();
|
|
22232
22281
|
this.getNodesEdgeSnappingPlugin()?.disable();
|
|
@@ -22291,16 +22340,80 @@ var WeaveExportManager = class {
|
|
|
22291
22340
|
stage.position(originalPosition);
|
|
22292
22341
|
stage.scale(originalScale);
|
|
22293
22342
|
stage.batchDraw();
|
|
22294
|
-
this.getNodesSelectionPlugin()?.enable();
|
|
22295
|
-
this.getNodesDistanceSnappingPlugin()?.enable();
|
|
22296
|
-
this.getNodesEdgeSnappingPlugin()?.enable();
|
|
22297
|
-
this.getStageGridPlugin()?.enable();
|
|
22343
|
+
if (nodesSelectionPluginPrev) this.getNodesSelectionPlugin()?.enable();
|
|
22344
|
+
if (nodesDistanceSnappingPluginPrev) this.getNodesDistanceSnappingPlugin()?.enable();
|
|
22345
|
+
if (nodesEdgeSnappingPluginPrev) this.getNodesEdgeSnappingPlugin()?.enable();
|
|
22346
|
+
if (nodesStageGridPluginPrev) this.getStageGridPlugin()?.enable();
|
|
22298
22347
|
resolve(img);
|
|
22299
22348
|
}
|
|
22300
22349
|
});
|
|
22301
22350
|
}
|
|
22302
22351
|
});
|
|
22303
22352
|
}
|
|
22353
|
+
exportAreaAsImage(area, options) {
|
|
22354
|
+
return new Promise((resolve) => {
|
|
22355
|
+
const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
|
|
22356
|
+
const nodesSelectionPluginPrev = this.getNodesSelectionPlugin()?.isEnabled();
|
|
22357
|
+
const nodesDistanceSnappingPluginPrev = this.getNodesDistanceSnappingPlugin()?.isEnabled();
|
|
22358
|
+
const nodesEdgeSnappingPluginPrev = this.getNodesDistanceSnappingPlugin()?.isEnabled();
|
|
22359
|
+
const nodesStageGridPluginPrev = this.getStageGridPlugin()?.isEnabled();
|
|
22360
|
+
this.getNodesSelectionPlugin()?.disable();
|
|
22361
|
+
this.getNodesDistanceSnappingPlugin()?.disable();
|
|
22362
|
+
this.getNodesEdgeSnappingPlugin()?.disable();
|
|
22363
|
+
this.getStageGridPlugin()?.disable();
|
|
22364
|
+
const stage = this.instance.getStage();
|
|
22365
|
+
const mainLayer = this.instance.getMainLayer();
|
|
22366
|
+
if (!mainLayer) throw new Error("Main layer not found");
|
|
22367
|
+
const originalPosition = {
|
|
22368
|
+
x: stage.x(),
|
|
22369
|
+
y: stage.y()
|
|
22370
|
+
};
|
|
22371
|
+
const originalScale = {
|
|
22372
|
+
x: stage.scaleX(),
|
|
22373
|
+
y: stage.scaleY()
|
|
22374
|
+
};
|
|
22375
|
+
stage.scale({
|
|
22376
|
+
x: 1,
|
|
22377
|
+
y: 1
|
|
22378
|
+
});
|
|
22379
|
+
stage.position({
|
|
22380
|
+
x: 0,
|
|
22381
|
+
y: 0
|
|
22382
|
+
});
|
|
22383
|
+
const bounds = area;
|
|
22384
|
+
const background = new Konva.Rect({
|
|
22385
|
+
x: bounds.x - padding,
|
|
22386
|
+
y: bounds.y - padding,
|
|
22387
|
+
width: bounds.width + 2 * padding,
|
|
22388
|
+
height: bounds.height + 2 * padding,
|
|
22389
|
+
strokeWidth: 0,
|
|
22390
|
+
fill: backgroundColor
|
|
22391
|
+
});
|
|
22392
|
+
mainLayer.add(background);
|
|
22393
|
+
background.moveToBottom();
|
|
22394
|
+
stage.batchDraw();
|
|
22395
|
+
stage.toImage({
|
|
22396
|
+
x: area.x,
|
|
22397
|
+
y: area.y,
|
|
22398
|
+
width: area.width,
|
|
22399
|
+
height: area.height,
|
|
22400
|
+
mimeType: format,
|
|
22401
|
+
pixelRatio,
|
|
22402
|
+
quality: options.quality ?? 1,
|
|
22403
|
+
callback: (img) => {
|
|
22404
|
+
background.destroy();
|
|
22405
|
+
stage.position(originalPosition);
|
|
22406
|
+
stage.scale(originalScale);
|
|
22407
|
+
stage.batchDraw();
|
|
22408
|
+
if (nodesSelectionPluginPrev) this.getNodesSelectionPlugin()?.enable();
|
|
22409
|
+
if (nodesDistanceSnappingPluginPrev) this.getNodesDistanceSnappingPlugin()?.enable();
|
|
22410
|
+
if (nodesEdgeSnappingPluginPrev) this.getNodesEdgeSnappingPlugin()?.enable();
|
|
22411
|
+
if (nodesStageGridPluginPrev) this.getStageGridPlugin()?.enable();
|
|
22412
|
+
resolve(img);
|
|
22413
|
+
}
|
|
22414
|
+
});
|
|
22415
|
+
});
|
|
22416
|
+
}
|
|
22304
22417
|
async exportNodesServerSide(nodes, boundingNodes, options) {
|
|
22305
22418
|
const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
|
|
22306
22419
|
this.getNodesSelectionPlugin()?.disable();
|
|
@@ -22403,6 +22516,91 @@ var WeaveExportManager = class {
|
|
|
22403
22516
|
height: imageHeight * pixelRatio
|
|
22404
22517
|
};
|
|
22405
22518
|
}
|
|
22519
|
+
async exportAreaServerSide(area, options) {
|
|
22520
|
+
const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
|
|
22521
|
+
this.getNodesSelectionPlugin()?.disable();
|
|
22522
|
+
this.getNodesDistanceSnappingPlugin()?.disable();
|
|
22523
|
+
this.getNodesEdgeSnappingPlugin()?.disable();
|
|
22524
|
+
this.getStageGridPlugin()?.disable();
|
|
22525
|
+
const stage = this.instance.getStage();
|
|
22526
|
+
const mainLayer = this.instance.getMainLayer();
|
|
22527
|
+
if (!mainLayer) throw new Error("Main layer not found");
|
|
22528
|
+
const originalPosition = {
|
|
22529
|
+
x: stage.x(),
|
|
22530
|
+
y: stage.y()
|
|
22531
|
+
};
|
|
22532
|
+
const originalScale = {
|
|
22533
|
+
x: stage.scaleX(),
|
|
22534
|
+
y: stage.scaleY()
|
|
22535
|
+
};
|
|
22536
|
+
stage.scale({
|
|
22537
|
+
x: 1,
|
|
22538
|
+
y: 1
|
|
22539
|
+
});
|
|
22540
|
+
const bounds = area;
|
|
22541
|
+
const scaleX = stage.scaleX();
|
|
22542
|
+
const scaleY = stage.scaleY();
|
|
22543
|
+
const unscaledBounds = {
|
|
22544
|
+
x: bounds.x / scaleX,
|
|
22545
|
+
y: bounds.y / scaleY,
|
|
22546
|
+
width: bounds.width / scaleX,
|
|
22547
|
+
height: bounds.height / scaleY
|
|
22548
|
+
};
|
|
22549
|
+
const background = new Konva.Rect({
|
|
22550
|
+
x: unscaledBounds.x - padding,
|
|
22551
|
+
y: unscaledBounds.y - padding,
|
|
22552
|
+
width: unscaledBounds.width + 2 * padding,
|
|
22553
|
+
height: unscaledBounds.height + 2 * padding,
|
|
22554
|
+
strokeWidth: 0,
|
|
22555
|
+
fill: backgroundColor
|
|
22556
|
+
});
|
|
22557
|
+
mainLayer.add(background);
|
|
22558
|
+
background.moveToBottom();
|
|
22559
|
+
const backgroundRect = background.getClientRect({ relativeTo: stage });
|
|
22560
|
+
const composites = [];
|
|
22561
|
+
const imageWidth = Math.round(backgroundRect.width);
|
|
22562
|
+
const imageHeight = Math.round(backgroundRect.height);
|
|
22563
|
+
const maxRenderSize = 1920;
|
|
22564
|
+
const cols = Math.ceil(imageWidth / maxRenderSize);
|
|
22565
|
+
const rows = Math.ceil(imageHeight / maxRenderSize);
|
|
22566
|
+
const tileWidth = Math.floor(imageWidth / cols);
|
|
22567
|
+
const tileHeight = Math.floor(imageHeight / rows);
|
|
22568
|
+
for (let y = 0; y < imageHeight; y += tileHeight) for (let x = 0; x < imageWidth; x += tileWidth) {
|
|
22569
|
+
const width = Math.min(tileWidth, imageWidth - x);
|
|
22570
|
+
const height = Math.min(tileHeight, imageHeight - y);
|
|
22571
|
+
const canvas = await mainLayer.toCanvas({
|
|
22572
|
+
x: Math.round(backgroundRect.x) + x,
|
|
22573
|
+
y: Math.round(backgroundRect.y) + y,
|
|
22574
|
+
width,
|
|
22575
|
+
height,
|
|
22576
|
+
mimeType: format,
|
|
22577
|
+
pixelRatio,
|
|
22578
|
+
quality: options.quality ?? 1
|
|
22579
|
+
});
|
|
22580
|
+
let buffer = null;
|
|
22581
|
+
if (globalThis._weave_serverSideBackend === WEAVE_KONVA_BACKEND.CANVAS) buffer = canvas.toBuffer();
|
|
22582
|
+
if (globalThis._weave_serverSideBackend === WEAVE_KONVA_BACKEND.SKIA) buffer = await canvas.toBuffer();
|
|
22583
|
+
if (!buffer) throw new Error("Failed to generate image buffer");
|
|
22584
|
+
composites.push({
|
|
22585
|
+
top: y * pixelRatio,
|
|
22586
|
+
left: x * pixelRatio,
|
|
22587
|
+
input: buffer
|
|
22588
|
+
});
|
|
22589
|
+
}
|
|
22590
|
+
background.destroy();
|
|
22591
|
+
stage.position(originalPosition);
|
|
22592
|
+
stage.scale(originalScale);
|
|
22593
|
+
stage.batchDraw();
|
|
22594
|
+
this.getNodesSelectionPlugin()?.enable();
|
|
22595
|
+
this.getNodesDistanceSnappingPlugin()?.enable();
|
|
22596
|
+
this.getNodesEdgeSnappingPlugin()?.enable();
|
|
22597
|
+
this.getStageGridPlugin()?.enable();
|
|
22598
|
+
return {
|
|
22599
|
+
composites,
|
|
22600
|
+
width: imageWidth * pixelRatio,
|
|
22601
|
+
height: imageHeight * pixelRatio
|
|
22602
|
+
};
|
|
22603
|
+
}
|
|
22406
22604
|
imageToBase64(img, mimeType) {
|
|
22407
22605
|
if (img.naturalWidth === 0 && img.naturalHeight === 0) throw new Error("Image has no content");
|
|
22408
22606
|
const canvas = document.createElement("canvas");
|
|
@@ -22682,7 +22880,12 @@ var WeaveAsyncManager = class {
|
|
|
22682
22880
|
this.instance.emitEvent("onAsyncElementChange");
|
|
22683
22881
|
}, new Map());
|
|
22684
22882
|
}
|
|
22883
|
+
reset() {
|
|
22884
|
+
this.asyncElements.clear();
|
|
22885
|
+
this.asyncElementsLoadedEventEmitted = false;
|
|
22886
|
+
}
|
|
22685
22887
|
checkForAsyncElements(elements) {
|
|
22888
|
+
this.instance.emitEvent("onAsyncElementsIdle");
|
|
22686
22889
|
const amountAsyncResourcesExtracted = this.extractAsyncResources(elements);
|
|
22687
22890
|
if (amountAsyncResourcesExtracted === 0 && !this.asyncElementsLoadedEventEmitted) {
|
|
22688
22891
|
this.instance.emitEvent("onAsyncElementsLoaded");
|
|
@@ -22735,7 +22938,7 @@ var WeaveAsyncManager = class {
|
|
|
22735
22938
|
status: WEAVE_ASYNC_STATUS.LOADING
|
|
22736
22939
|
};
|
|
22737
22940
|
this.asyncElements.set(nodeId, element);
|
|
22738
|
-
this.instance.emitEvent("onAsyncElementsLoading", {
|
|
22941
|
+
if (!this.asyncElementsLoadedEventEmitted) this.instance.emitEvent("onAsyncElementsLoading", {
|
|
22739
22942
|
loaded: this.getAmountAsyncElementsLoaded(),
|
|
22740
22943
|
total: this.getAmountAsyncElements()
|
|
22741
22944
|
});
|
|
@@ -22748,11 +22951,11 @@ var WeaveAsyncManager = class {
|
|
|
22748
22951
|
status: WEAVE_ASYNC_STATUS.LOADED
|
|
22749
22952
|
};
|
|
22750
22953
|
this.asyncElements.set(nodeId, element);
|
|
22751
|
-
this.instance.emitEvent("onAsyncElementsLoading", {
|
|
22752
|
-
loaded: this.getAmountAsyncElementsLoaded(),
|
|
22753
|
-
total: this.getAmountAsyncElements()
|
|
22754
|
-
});
|
|
22755
22954
|
if (!this.asyncElementsLoadedEventEmitted) {
|
|
22955
|
+
this.instance.emitEvent("onAsyncElementsLoading", {
|
|
22956
|
+
loaded: this.getAmountAsyncElementsLoaded(),
|
|
22957
|
+
total: this.getAmountAsyncElements()
|
|
22958
|
+
});
|
|
22756
22959
|
const allLoaded = this.asyncElementsLoaded();
|
|
22757
22960
|
if (allLoaded) {
|
|
22758
22961
|
this.instance.emitEvent("onAsyncElementsLoaded");
|
|
@@ -22877,6 +23080,7 @@ var Weave = class {
|
|
|
22877
23080
|
constructor(weaveConfig, stageConfig) {
|
|
22878
23081
|
globalThis._weave_isServerSide = false;
|
|
22879
23082
|
if (typeof window === "undefined") globalThis._weave_isServerSide = true;
|
|
23083
|
+
this.eventsController = void 0;
|
|
22880
23084
|
this.emitter = new Emittery();
|
|
22881
23085
|
Konva.showWarnings = false;
|
|
22882
23086
|
this.id = v4_default();
|
|
@@ -22922,6 +23126,7 @@ var Weave = class {
|
|
|
22922
23126
|
this.initialized = true;
|
|
22923
23127
|
this.status = WEAVE_INSTANCE_STATUS.RUNNING;
|
|
22924
23128
|
this.emitEvent("onInstanceStatus", this.status);
|
|
23129
|
+
this.emitEvent("onRender");
|
|
22925
23130
|
});
|
|
22926
23131
|
}
|
|
22927
23132
|
setStatus(status) {
|
|
@@ -22946,6 +23151,7 @@ var Weave = class {
|
|
|
22946
23151
|
async start() {
|
|
22947
23152
|
this.moduleLogger.info("Start instance");
|
|
22948
23153
|
if (!this.isServerSide()) {
|
|
23154
|
+
this.eventsController = new AbortController();
|
|
22949
23155
|
if (!window.weave) window.weave = this;
|
|
22950
23156
|
}
|
|
22951
23157
|
this.emitEvent("onRoomLoaded", false);
|
|
@@ -22969,8 +23175,39 @@ var Weave = class {
|
|
|
22969
23175
|
store.setup();
|
|
22970
23176
|
store.connect();
|
|
22971
23177
|
}
|
|
23178
|
+
async switchRoom() {
|
|
23179
|
+
this.moduleLogger.info(`Switching room`);
|
|
23180
|
+
const nodeHandlers = this.registerManager.getNodesHandlers();
|
|
23181
|
+
for (const nodeHandlerKey of Object.keys(nodeHandlers)) {
|
|
23182
|
+
const nodeHandler = nodeHandlers[nodeHandlerKey];
|
|
23183
|
+
nodeHandler?.onDestroyInstance();
|
|
23184
|
+
}
|
|
23185
|
+
const stage = this.getStage();
|
|
23186
|
+
if (stage) stage.destroy();
|
|
23187
|
+
if (this.eventsController) this.eventsController.abort();
|
|
23188
|
+
if (!this.isServerSide()) this.eventsController = new AbortController();
|
|
23189
|
+
this.registerManager.reset();
|
|
23190
|
+
this.asyncManager.reset();
|
|
23191
|
+
this.moduleLogger.info("Switching room instance");
|
|
23192
|
+
if (!this.isServerSide()) {
|
|
23193
|
+
if (!window.weave) window.weave = this;
|
|
23194
|
+
}
|
|
23195
|
+
this.emitEvent("onRoomLoaded", false);
|
|
23196
|
+
this.status = WEAVE_INSTANCE_STATUS.STARTING;
|
|
23197
|
+
this.emitEvent("onInstanceStatus", this.status);
|
|
23198
|
+
this.registerManager.reset();
|
|
23199
|
+
this.status = WEAVE_INSTANCE_STATUS.LOADING_FONTS;
|
|
23200
|
+
this.emitEvent("onInstanceStatus", this.status);
|
|
23201
|
+
await this.fontsManager.loadFonts();
|
|
23202
|
+
this.setupManager.setupLog();
|
|
23203
|
+
this.stageManager.initStage();
|
|
23204
|
+
this.status = WEAVE_INSTANCE_STATUS.CONNECTING_TO_ROOM;
|
|
23205
|
+
this.emitEvent("onInstanceStatus", this.status);
|
|
23206
|
+
this.addEventListener("onStoreConnectionStatusChange", this.handleStoreConnectionStatusChange.bind(this));
|
|
23207
|
+
}
|
|
22972
23208
|
destroy() {
|
|
22973
23209
|
this.moduleLogger.info(`Destroying the instance`);
|
|
23210
|
+
if (this.eventsController) this.eventsController.abort();
|
|
22974
23211
|
this.emitter.clearListeners();
|
|
22975
23212
|
this.status = WEAVE_INSTANCE_STATUS.IDLE;
|
|
22976
23213
|
this.emitEvent("onInstanceStatus", this.status);
|
|
@@ -23440,9 +23677,15 @@ var Weave = class {
|
|
|
23440
23677
|
async exportNodesServerSide(nodes, boundingNodes, options) {
|
|
23441
23678
|
return await this.exportManager.exportNodesServerSide(nodes, boundingNodes, options);
|
|
23442
23679
|
}
|
|
23680
|
+
async exportAreaServerSide(area, options) {
|
|
23681
|
+
return await this.exportManager.exportAreaServerSide(area, options);
|
|
23682
|
+
}
|
|
23443
23683
|
async exportNodes(nodes, boundingNodes, options) {
|
|
23444
23684
|
return await this.exportManager.exportNodesAsImage(nodes, boundingNodes, options);
|
|
23445
23685
|
}
|
|
23686
|
+
async exportArea(area, options) {
|
|
23687
|
+
return await this.exportManager.exportAreaAsImage(area, options);
|
|
23688
|
+
}
|
|
23446
23689
|
getExportBoundingBox(nodesIds) {
|
|
23447
23690
|
const nodes = [];
|
|
23448
23691
|
for (const nodeId of nodesIds) {
|
|
@@ -23605,6 +23848,9 @@ var Weave = class {
|
|
|
23605
23848
|
getDragProperties() {
|
|
23606
23849
|
return this.dragAndDropManager.getDragProperties();
|
|
23607
23850
|
}
|
|
23851
|
+
getEventsController() {
|
|
23852
|
+
return this.eventsController;
|
|
23853
|
+
}
|
|
23608
23854
|
};
|
|
23609
23855
|
|
|
23610
23856
|
//#endregion
|
|
@@ -23696,6 +23942,7 @@ const downscaleImageFromURL = (url, options) => {
|
|
|
23696
23942
|
//#endregion
|
|
23697
23943
|
//#region src/internal-utils/upscale.ts
|
|
23698
23944
|
const setupUpscaleStage = (instance, stage) => {
|
|
23945
|
+
if (instance.isServerSide()) return;
|
|
23699
23946
|
const config = instance.getConfiguration();
|
|
23700
23947
|
const doUpscale = config.performance?.upscale?.enabled ?? false;
|
|
23701
23948
|
if (doUpscale) {
|
|
@@ -23727,7 +23974,14 @@ const setupUpscaleStage = (instance, stage) => {
|
|
|
23727
23974
|
innerElement.style.transformOrigin = "0 0";
|
|
23728
23975
|
innerElement.style.transform = `scale(${scaleToCover})`;
|
|
23729
23976
|
}
|
|
23730
|
-
} else
|
|
23977
|
+
} else {
|
|
23978
|
+
const realContainer = stage.container();
|
|
23979
|
+
const containerWidth = realContainer.offsetWidth;
|
|
23980
|
+
const containerHeight = realContainer.offsetHeight;
|
|
23981
|
+
stage.width(containerWidth);
|
|
23982
|
+
stage.height(containerHeight);
|
|
23983
|
+
stage.setAttrs({ upscaleScale: 1 });
|
|
23984
|
+
}
|
|
23731
23985
|
};
|
|
23732
23986
|
|
|
23733
23987
|
//#endregion
|
|
@@ -23738,6 +23992,7 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23738
23992
|
wheelMousePressed = false;
|
|
23739
23993
|
isCmdCtrlPressed = false;
|
|
23740
23994
|
globalEventsInitialized = false;
|
|
23995
|
+
initialize = void 0;
|
|
23741
23996
|
onRender(props) {
|
|
23742
23997
|
const stage = new Konva.Stage({
|
|
23743
23998
|
...props,
|
|
@@ -23756,10 +24011,10 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23756
24011
|
container.setAttribute("tabindex", "0");
|
|
23757
24012
|
stage.container().addEventListener("focus", () => {
|
|
23758
24013
|
this.stageFocused = true;
|
|
23759
|
-
});
|
|
24014
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
23760
24015
|
stage.container().addEventListener("blur", () => {
|
|
23761
24016
|
this.stageFocused = false;
|
|
23762
|
-
});
|
|
24017
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
23763
24018
|
}
|
|
23764
24019
|
Konva.Stage.prototype.mode = function(mode) {
|
|
23765
24020
|
if (typeof mode !== "undefined") this._mode = mode;
|
|
@@ -23829,7 +24084,7 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23829
24084
|
const selectedNode = transformer.nodes()[0];
|
|
23830
24085
|
selectedNode.fire("onCmdCtrlPressed");
|
|
23831
24086
|
}
|
|
23832
|
-
});
|
|
24087
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
23833
24088
|
window.addEventListener("keyup", (e) => {
|
|
23834
24089
|
if (!(e.ctrlKey || e.metaKey)) {
|
|
23835
24090
|
this.isCmdCtrlPressed = false;
|
|
@@ -23840,7 +24095,7 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23840
24095
|
const selectedNode = transformer.nodes()[0];
|
|
23841
24096
|
selectedNode.fire("onCmdCtrlReleased");
|
|
23842
24097
|
}
|
|
23843
|
-
});
|
|
24098
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
23844
24099
|
this.globalEventsInitialized = true;
|
|
23845
24100
|
}
|
|
23846
24101
|
isOnlyCtrlOrMeta(event) {
|
|
@@ -23860,6 +24115,7 @@ const WEAVE_LAYER_NODE_TYPE = "layer";
|
|
|
23860
24115
|
//#region src/nodes/layer/layer.ts
|
|
23861
24116
|
var WeaveLayerNode = class extends WeaveNode {
|
|
23862
24117
|
nodeType = WEAVE_LAYER_NODE_TYPE;
|
|
24118
|
+
initialize = void 0;
|
|
23863
24119
|
onRender(props) {
|
|
23864
24120
|
const layer = new Konva.Layer({ ...props });
|
|
23865
24121
|
layer.canMoveToContainer = function() {
|
|
@@ -23907,6 +24163,7 @@ const WEAVE_GROUP_NODE_TYPE = "group";
|
|
|
23907
24163
|
//#region src/nodes/group/group.ts
|
|
23908
24164
|
var WeaveGroupNode = class extends WeaveNode {
|
|
23909
24165
|
nodeType = WEAVE_GROUP_NODE_TYPE;
|
|
24166
|
+
initialize = void 0;
|
|
23910
24167
|
constructor(params) {
|
|
23911
24168
|
super();
|
|
23912
24169
|
const { config } = params ?? {};
|
|
@@ -23999,6 +24256,7 @@ const WEAVE_RECTANGLE_NODE_TYPE = "rectangle";
|
|
|
23999
24256
|
//#region src/nodes/rectangle/rectangle.ts
|
|
24000
24257
|
var WeaveRectangleNode = class extends WeaveNode {
|
|
24001
24258
|
nodeType = WEAVE_RECTANGLE_NODE_TYPE;
|
|
24259
|
+
initialize = void 0;
|
|
24002
24260
|
constructor(params) {
|
|
24003
24261
|
super();
|
|
24004
24262
|
const { config } = params ?? {};
|
|
@@ -24042,6 +24300,7 @@ const WEAVE_ELLIPSE_NODE_TYPE = "ellipse";
|
|
|
24042
24300
|
//#region src/nodes/ellipse/ellipse.ts
|
|
24043
24301
|
var WeaveEllipseNode = class extends WeaveNode {
|
|
24044
24302
|
nodeType = WEAVE_ELLIPSE_NODE_TYPE;
|
|
24303
|
+
initialize = void 0;
|
|
24045
24304
|
constructor(params) {
|
|
24046
24305
|
super();
|
|
24047
24306
|
const { config } = params ?? {};
|
|
@@ -24187,13 +24446,16 @@ var WeaveLineNode = class extends WeaveNode {
|
|
|
24187
24446
|
constructor(params) {
|
|
24188
24447
|
super();
|
|
24189
24448
|
this.config = mergeExceptArrays(WEAVE_LINE_NODE_DEFAULT_CONFIG, params?.config ?? {});
|
|
24190
|
-
this.handleNodeChanges = null;
|
|
24191
|
-
this.handleZoomChanges = null;
|
|
24192
24449
|
this.snapper = new GreedySnapper({
|
|
24193
24450
|
snapAngles: this.config.snapAngles.angles,
|
|
24194
24451
|
activateThreshold: this.config.snapAngles.activateThreshold,
|
|
24195
24452
|
releaseThreshold: this.config.snapAngles.releaseThreshold
|
|
24196
24453
|
});
|
|
24454
|
+
this.initialize();
|
|
24455
|
+
}
|
|
24456
|
+
initialize() {
|
|
24457
|
+
this.handleNodeChanges = null;
|
|
24458
|
+
this.handleZoomChanges = null;
|
|
24197
24459
|
}
|
|
24198
24460
|
onRender(props) {
|
|
24199
24461
|
const line = new Konva.Line({
|
|
@@ -24498,17 +24760,19 @@ const TEXT_LAYOUT = {
|
|
|
24498
24760
|
//#region src/nodes/text/text.ts
|
|
24499
24761
|
var WeaveTextNode = class extends WeaveNode {
|
|
24500
24762
|
nodeType = WEAVE_TEXT_NODE_TYPE;
|
|
24501
|
-
editing = false;
|
|
24502
|
-
textAreaSuperContainer = null;
|
|
24503
|
-
textAreaContainer = null;
|
|
24504
|
-
textArea = null;
|
|
24505
|
-
eventsInitialized = false;
|
|
24506
|
-
isCtrlMetaPressed = false;
|
|
24507
24763
|
constructor(params) {
|
|
24508
24764
|
super();
|
|
24509
24765
|
const { config } = params ?? {};
|
|
24510
24766
|
this.config = (0, import_lodash.merge)({}, WEAVE_TEXT_NODE_DEFAULT_CONFIG, config);
|
|
24767
|
+
this.initialize();
|
|
24768
|
+
}
|
|
24769
|
+
initialize() {
|
|
24511
24770
|
this.keyPressHandler = void 0;
|
|
24771
|
+
this.eventsInitialized = false;
|
|
24772
|
+
this.isCtrlMetaPressed = false;
|
|
24773
|
+
this.textAreaSuperContainer = null;
|
|
24774
|
+
this.textAreaContainer = null;
|
|
24775
|
+
this.textArea = null;
|
|
24512
24776
|
this.editing = false;
|
|
24513
24777
|
this.textArea = null;
|
|
24514
24778
|
}
|
|
@@ -24516,10 +24780,10 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24516
24780
|
if (!this.eventsInitialized && !globalThis._weave_isServerSide) {
|
|
24517
24781
|
window.addEventListener("keydown", (e) => {
|
|
24518
24782
|
if (e.ctrlKey || e.metaKey) this.isCtrlMetaPressed = true;
|
|
24519
|
-
});
|
|
24783
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24520
24784
|
window.addEventListener("keyup", (e) => {
|
|
24521
24785
|
if (!(e.ctrlKey || e.metaKey)) this.isCtrlMetaPressed = false;
|
|
24522
|
-
});
|
|
24786
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24523
24787
|
this.eventsInitialized = true;
|
|
24524
24788
|
}
|
|
24525
24789
|
}
|
|
@@ -24547,7 +24811,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24547
24811
|
onAdd() {
|
|
24548
24812
|
if (!this.instance.isServerSide() && !this.keyPressHandler) {
|
|
24549
24813
|
this.keyPressHandler = this.handleKeyPress.bind(this);
|
|
24550
|
-
window.addEventListener("keypress", this.keyPressHandler);
|
|
24814
|
+
window.addEventListener("keypress", this.keyPressHandler, { signal: this.instance.getEventsController()?.signal });
|
|
24551
24815
|
}
|
|
24552
24816
|
}
|
|
24553
24817
|
onRender(props) {
|
|
@@ -24701,7 +24965,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24701
24965
|
});
|
|
24702
24966
|
if (!this.instance.isServerSide() && !this.keyPressHandler) {
|
|
24703
24967
|
this.keyPressHandler = this.handleKeyPress.bind(this);
|
|
24704
|
-
window.addEventListener("keypress", this.keyPressHandler);
|
|
24968
|
+
window.addEventListener("keypress", this.keyPressHandler, { signal: this.instance.getEventsController()?.signal });
|
|
24705
24969
|
}
|
|
24706
24970
|
return text;
|
|
24707
24971
|
}
|
|
@@ -24960,17 +25224,17 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24960
25224
|
this.textAreaSuperContainer.scrollTop = 0;
|
|
24961
25225
|
this.textAreaSuperContainer.scrollLeft = 0;
|
|
24962
25226
|
}
|
|
24963
|
-
});
|
|
25227
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24964
25228
|
this.textAreaContainer.addEventListener("scroll", () => {
|
|
24965
25229
|
if (!this.textAreaContainer) return;
|
|
24966
25230
|
this.textAreaContainer.scrollTop = 0;
|
|
24967
25231
|
this.textAreaContainer.scrollLeft = 0;
|
|
24968
|
-
});
|
|
25232
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24969
25233
|
this.textArea.addEventListener("scroll", () => {
|
|
24970
25234
|
if (!this.textArea) return;
|
|
24971
25235
|
this.textArea.scrollTop = 0;
|
|
24972
25236
|
this.textArea.scrollLeft = 0;
|
|
24973
|
-
});
|
|
25237
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24974
25238
|
const rotation = textNode.getAbsoluteRotation();
|
|
24975
25239
|
if (rotation) {
|
|
24976
25240
|
const transform = "rotate(" + rotation + "deg)";
|
|
@@ -25019,8 +25283,8 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
25019
25283
|
this.textAreaDomResize(textNode);
|
|
25020
25284
|
}
|
|
25021
25285
|
};
|
|
25022
|
-
this.textArea.addEventListener("keydown", handleKeyDown);
|
|
25023
|
-
this.textArea.addEventListener("keyup", handleKeyUp);
|
|
25286
|
+
this.textArea.addEventListener("keydown", handleKeyDown, { signal: this.instance.getEventsController()?.signal });
|
|
25287
|
+
this.textArea.addEventListener("keyup", handleKeyUp, { signal: this.instance.getEventsController()?.signal });
|
|
25024
25288
|
this.textArea.tabIndex = 1;
|
|
25025
25289
|
this.textArea.focus();
|
|
25026
25290
|
const handleOutsideClick = (e) => {
|
|
@@ -25046,7 +25310,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
25046
25310
|
}
|
|
25047
25311
|
};
|
|
25048
25312
|
setTimeout(() => {
|
|
25049
|
-
window.addEventListener("pointerup", handleOutsideClick);
|
|
25313
|
+
window.addEventListener("pointerup", handleOutsideClick, { signal: this.instance.getEventsController()?.signal });
|
|
25050
25314
|
}, 0);
|
|
25051
25315
|
this.instance.getStage().mode(WEAVE_STAGE_TEXT_EDITION_MODE);
|
|
25052
25316
|
this.editing = true;
|
|
@@ -25382,7 +25646,7 @@ var WeaveImageCrop = class WeaveImageCrop {
|
|
|
25382
25646
|
utilityLayer?.add(this.transformer);
|
|
25383
25647
|
this.transformer?.forceUpdate();
|
|
25384
25648
|
this.cropGroup.show();
|
|
25385
|
-
window.addEventListener("keydown", this.handleHide);
|
|
25649
|
+
window.addEventListener("keydown", this.handleHide, { signal: this.instance.getEventsController()?.signal });
|
|
25386
25650
|
if (options.cmdCtrl.triggered) {
|
|
25387
25651
|
utilityLayer?.hide();
|
|
25388
25652
|
const stage = this.instance.getStage();
|
|
@@ -25832,24 +26096,21 @@ const isAllowedUrl = (value) => {
|
|
|
25832
26096
|
//#endregion
|
|
25833
26097
|
//#region src/nodes/image/image.ts
|
|
25834
26098
|
var WeaveImageNode = class extends WeaveNode {
|
|
25835
|
-
imageBitmapCache = {};
|
|
25836
|
-
imageSource = {};
|
|
25837
|
-
imageFallback = {};
|
|
25838
|
-
imageState = {};
|
|
25839
|
-
imageTryoutAttempts = {};
|
|
25840
|
-
imageTryoutIds = {};
|
|
25841
26099
|
nodeType = WEAVE_IMAGE_NODE_TYPE;
|
|
25842
26100
|
cursorsFallback = { loading: "wait" };
|
|
25843
26101
|
cursors = {};
|
|
25844
26102
|
constructor(params) {
|
|
25845
26103
|
super();
|
|
25846
26104
|
const { config } = params ?? {};
|
|
26105
|
+
this.config = mergeExceptArrays(WEAVE_IMAGE_DEFAULT_CONFIG, config);
|
|
26106
|
+
this.initialize();
|
|
26107
|
+
}
|
|
26108
|
+
initialize() {
|
|
25847
26109
|
this.tapStart = {
|
|
25848
26110
|
x: 0,
|
|
25849
26111
|
y: 0,
|
|
25850
26112
|
time: 0
|
|
25851
26113
|
};
|
|
25852
|
-
this.config = mergeExceptArrays(WEAVE_IMAGE_DEFAULT_CONFIG, config);
|
|
25853
26114
|
this.imageCrop = null;
|
|
25854
26115
|
this.imageBitmapCache = {};
|
|
25855
26116
|
this.imageSource = {};
|
|
@@ -26073,7 +26334,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26073
26334
|
};
|
|
26074
26335
|
this.updateImageCrop(image);
|
|
26075
26336
|
} else {
|
|
26076
|
-
this.updatePlaceholderSize(image
|
|
26337
|
+
this.updatePlaceholderSize(image);
|
|
26077
26338
|
this.loadImage(imageProps, image, true);
|
|
26078
26339
|
}
|
|
26079
26340
|
if (this.config.performance.cache.enabled) image.on("transformend", () => {
|
|
@@ -26456,7 +26717,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26456
26717
|
}
|
|
26457
26718
|
this.loadAsyncElement(id);
|
|
26458
26719
|
preloadFunction(id, realImageURL ?? "", {
|
|
26459
|
-
onLoad: () => {
|
|
26720
|
+
onLoad: async () => {
|
|
26460
26721
|
if (useFallback) this.imageTryoutIds[id] = setTimeout(() => {
|
|
26461
26722
|
const node = this.instance.getStage().findOne(`#${id}`);
|
|
26462
26723
|
if (node) {
|
|
@@ -26507,7 +26768,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26507
26768
|
error: false
|
|
26508
26769
|
};
|
|
26509
26770
|
this.updateImageCrop(image);
|
|
26510
|
-
this.resolveAsyncElement(id);
|
|
26771
|
+
if (!useFallback) this.resolveAsyncElement(id);
|
|
26511
26772
|
this.cacheNode(image);
|
|
26512
26773
|
}
|
|
26513
26774
|
},
|
|
@@ -26548,13 +26809,9 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26548
26809
|
}
|
|
26549
26810
|
}, loadTryout);
|
|
26550
26811
|
}
|
|
26551
|
-
updatePlaceholderSize(image
|
|
26812
|
+
updatePlaceholderSize(image) {
|
|
26552
26813
|
const imageAttrs = image.getAttrs();
|
|
26553
26814
|
if (!this.imageState[imageAttrs.id ?? ""]?.loaded) return;
|
|
26554
|
-
if (!imageAttrs.adding && !imageAttrs.cropInfo) {
|
|
26555
|
-
imagePlaceholder.width(imageAttrs.uncroppedImage.width);
|
|
26556
|
-
imagePlaceholder.height(imageAttrs.uncroppedImage.height);
|
|
26557
|
-
}
|
|
26558
26815
|
}
|
|
26559
26816
|
updateImageCrop(image) {
|
|
26560
26817
|
const imageAttrs = image.getAttrs();
|
|
@@ -26688,6 +26945,7 @@ const WEAVE_STAR_NODE_TYPE = "star";
|
|
|
26688
26945
|
//#region src/nodes/star/star.ts
|
|
26689
26946
|
var WeaveStarNode = class extends WeaveNode {
|
|
26690
26947
|
nodeType = WEAVE_STAR_NODE_TYPE;
|
|
26948
|
+
initialize = void 0;
|
|
26691
26949
|
constructor(params) {
|
|
26692
26950
|
super();
|
|
26693
26951
|
const { config } = params ?? {};
|
|
@@ -26773,6 +27031,7 @@ const WEAVE_ARROW_NODE_TYPE = "arrow";
|
|
|
26773
27031
|
//#region src/nodes/arrow/arrow.ts
|
|
26774
27032
|
var WeaveArrowNode = class extends WeaveNode {
|
|
26775
27033
|
nodeType = WEAVE_ARROW_NODE_TYPE;
|
|
27034
|
+
initialize = void 0;
|
|
26776
27035
|
constructor(params) {
|
|
26777
27036
|
super();
|
|
26778
27037
|
const { config } = params ?? {};
|
|
@@ -26829,6 +27088,7 @@ const WEAVE_REGULAR_POLYGON_NODE_TYPE = "regular-polygon";
|
|
|
26829
27088
|
//#region src/nodes/regular-polygon/regular-polygon.ts
|
|
26830
27089
|
var WeaveRegularPolygonNode = class extends WeaveNode {
|
|
26831
27090
|
nodeType = WEAVE_REGULAR_POLYGON_NODE_TYPE;
|
|
27091
|
+
initialize = void 0;
|
|
26832
27092
|
constructor(params) {
|
|
26833
27093
|
super();
|
|
26834
27094
|
const { config } = params ?? {};
|
|
@@ -26942,6 +27202,7 @@ var GroupFrame = class extends Konva.Group {
|
|
|
26942
27202
|
//#region src/nodes/frame/frame.ts
|
|
26943
27203
|
var WeaveFrameNode = class extends WeaveNode {
|
|
26944
27204
|
nodeType = WEAVE_FRAME_NODE_TYPE;
|
|
27205
|
+
initialize = void 0;
|
|
26945
27206
|
constructor(params) {
|
|
26946
27207
|
super();
|
|
26947
27208
|
const { config } = params ?? {};
|
|
@@ -27242,6 +27503,7 @@ const WEAVE_STROKE_NODE_DEFAULT_CONFIG = {
|
|
|
27242
27503
|
//#region src/nodes/stroke/stroke.ts
|
|
27243
27504
|
var WeaveStrokeNode = class extends WeaveNode {
|
|
27244
27505
|
nodeType = WEAVE_STROKE_NODE_TYPE;
|
|
27506
|
+
initialize = void 0;
|
|
27245
27507
|
constructor(params) {
|
|
27246
27508
|
super();
|
|
27247
27509
|
const { config } = params ?? {};
|
|
@@ -27818,8 +28080,6 @@ var WeaveSquareLineTipManager = class extends WeaveBaseLineTipManager {
|
|
|
27818
28080
|
//#endregion
|
|
27819
28081
|
//#region src/nodes/stroke-single/stroke-single.ts
|
|
27820
28082
|
var WeaveStrokeSingleNode = class extends WeaveNode {
|
|
27821
|
-
startHandle = null;
|
|
27822
|
-
endHandle = null;
|
|
27823
28083
|
nodeType = WEAVE_STROKE_SINGLE_NODE_TYPE;
|
|
27824
28084
|
tipManagers = {
|
|
27825
28085
|
[WEAVE_STROKE_SINGLE_NODE_TIP_TYPE.ARROW]: new WeaveArrowLineTipManager(),
|
|
@@ -27830,24 +28090,29 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
|
|
|
27830
28090
|
constructor(params) {
|
|
27831
28091
|
super();
|
|
27832
28092
|
this.config = mergeExceptArrays(WEAVE_STROKE_SINGLE_NODE_DEFAULT_CONFIG, params?.config ?? {});
|
|
27833
|
-
this.handleNodeChanges = null;
|
|
27834
|
-
this.handleZoomChanges = null;
|
|
27835
|
-
this.shiftPressed = false;
|
|
27836
28093
|
this.snapper = new GreedySnapper({
|
|
27837
28094
|
snapAngles: this.config.snapAngles.angles,
|
|
27838
28095
|
activateThreshold: this.config.snapAngles.activateThreshold,
|
|
27839
28096
|
releaseThreshold: this.config.snapAngles.releaseThreshold
|
|
27840
28097
|
});
|
|
28098
|
+
this.initialize();
|
|
28099
|
+
}
|
|
28100
|
+
initialize() {
|
|
27841
28101
|
this.eventsInitialized = false;
|
|
28102
|
+
this.startHandle = null;
|
|
28103
|
+
this.endHandle = null;
|
|
28104
|
+
this.handleNodeChanges = null;
|
|
28105
|
+
this.handleZoomChanges = null;
|
|
28106
|
+
this.shiftPressed = false;
|
|
27842
28107
|
}
|
|
27843
28108
|
initEvents() {
|
|
27844
28109
|
if (this.eventsInitialized) return;
|
|
27845
28110
|
window.addEventListener("keydown", (e) => {
|
|
27846
28111
|
if (e.key === "Shift") this.shiftPressed = true;
|
|
27847
|
-
});
|
|
28112
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
27848
28113
|
window.addEventListener("keyup", (e) => {
|
|
27849
28114
|
if (e.key === "Shift") this.shiftPressed = false;
|
|
27850
|
-
});
|
|
28115
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
27851
28116
|
this.eventsInitialized = true;
|
|
27852
28117
|
}
|
|
27853
28118
|
onRender(props) {
|
|
@@ -28334,6 +28599,9 @@ var WeaveCommentNode = class extends WeaveNode {
|
|
|
28334
28599
|
constructor(params) {
|
|
28335
28600
|
super();
|
|
28336
28601
|
this.config = mergeExceptArrays(WEAVE_COMMENT_NODE_DEFAULTS, params.config);
|
|
28602
|
+
this.initialize();
|
|
28603
|
+
}
|
|
28604
|
+
initialize() {
|
|
28337
28605
|
this.commentDomVisibleId = null;
|
|
28338
28606
|
this.commentDomVisible = false;
|
|
28339
28607
|
this.commentDomAction = null;
|
|
@@ -28962,10 +29230,6 @@ const WEAVE_VIDEO_DEFAULT_CONFIG = {
|
|
|
28962
29230
|
//#endregion
|
|
28963
29231
|
//#region src/nodes/video/video.ts
|
|
28964
29232
|
var WeaveVideoNode = class extends WeaveNode {
|
|
28965
|
-
videoState = {};
|
|
28966
|
-
videoSourceFrameId = {};
|
|
28967
|
-
videoSource = {};
|
|
28968
|
-
videoPlaceholder = {};
|
|
28969
29233
|
nodeType = WEAVE_VIDEO_NODE_TYPE;
|
|
28970
29234
|
constructor(params) {
|
|
28971
29235
|
super();
|
|
@@ -28978,6 +29242,13 @@ var WeaveVideoNode = class extends WeaveNode {
|
|
|
28978
29242
|
this.videoIconImage.src = this.config.style.icon.dataURL;
|
|
28979
29243
|
}
|
|
28980
29244
|
}
|
|
29245
|
+
initialize() {
|
|
29246
|
+
this.videoState = {};
|
|
29247
|
+
this.videoSource = {};
|
|
29248
|
+
this.videoSourceFrameId = {};
|
|
29249
|
+
this.videoPlaceholder = {};
|
|
29250
|
+
this.videoIconImage = void 0;
|
|
29251
|
+
}
|
|
28981
29252
|
async loadPlaceholder(params, video) {
|
|
28982
29253
|
const videoProps = params;
|
|
28983
29254
|
const { id } = videoProps;
|
|
@@ -29472,6 +29743,7 @@ const WEAVE_MEASURE_NODE_DEFAULT_CONFIG = { style: {
|
|
|
29472
29743
|
var WeaveMeasureNode = class extends WeaveNode {
|
|
29473
29744
|
nodeType = WEAVE_MEASURE_NODE_TYPE;
|
|
29474
29745
|
handlePointCircleRadius = 6;
|
|
29746
|
+
initialize = void 0;
|
|
29475
29747
|
constructor(params) {
|
|
29476
29748
|
super();
|
|
29477
29749
|
this.config = mergeExceptArrays(WEAVE_MEASURE_NODE_DEFAULT_CONFIG, params?.config ?? {});
|
|
@@ -30762,6 +31034,7 @@ var WeaveConnectorNode = class extends WeaveNode {
|
|
|
30762
31034
|
[WEAVE_CONNECTOR_NODE_DECORATOR_TYPE.DOT]: setupNodeDecoratorDot,
|
|
30763
31035
|
[WEAVE_CONNECTOR_NODE_DECORATOR_TYPE.ARROW]: setupNodeDecoratorArrow
|
|
30764
31036
|
};
|
|
31037
|
+
initialize = void 0;
|
|
30765
31038
|
constructor(params) {
|
|
30766
31039
|
super();
|
|
30767
31040
|
this.config = mergeExceptArrays(WEAVE_CONNECTOR_NODE_DEFAULT_CONFIG, params?.config);
|
|
@@ -31512,10 +31785,6 @@ const WEAVE_STAGE_ZOOM_DEFAULT_CONFIG = {
|
|
|
31512
31785
|
var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
31513
31786
|
getLayerName = void 0;
|
|
31514
31787
|
initLayer = void 0;
|
|
31515
|
-
pinching = false;
|
|
31516
|
-
zooming = false;
|
|
31517
|
-
isTrackpad = false;
|
|
31518
|
-
zoomVelocity = 0;
|
|
31519
31788
|
zoomInertiaType = WEAVE_STAGE_ZOOM_TYPE.MOUSE_WHEEL;
|
|
31520
31789
|
defaultStep = 3;
|
|
31521
31790
|
constructor(params) {
|
|
@@ -31523,8 +31792,13 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31523
31792
|
const { config } = params ?? {};
|
|
31524
31793
|
this.config = mergeExceptArrays(WEAVE_STAGE_ZOOM_DEFAULT_CONFIG, config);
|
|
31525
31794
|
if (!this.config.zoomSteps.includes(this.config.defaultZoom)) throw new Error(`Default zoom ${this.config.defaultZoom} is not in zoom steps`);
|
|
31795
|
+
this.initialize();
|
|
31796
|
+
}
|
|
31797
|
+
initialize() {
|
|
31526
31798
|
this.pinching = false;
|
|
31799
|
+
this.zooming = false;
|
|
31527
31800
|
this.isTrackpad = false;
|
|
31801
|
+
this.zoomVelocity = 0;
|
|
31528
31802
|
this.isCtrlOrMetaPressed = false;
|
|
31529
31803
|
this.updatedMinimumZoom = false;
|
|
31530
31804
|
this.actualStep = this.config.zoomSteps.findIndex((step) => step === this.config.defaultZoom);
|
|
@@ -31811,6 +32085,15 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31811
32085
|
if (box.width === 0 || box.height === 0) return;
|
|
31812
32086
|
this.fitToElements(box, finalOptions);
|
|
31813
32087
|
}
|
|
32088
|
+
fitToArea(area, options) {
|
|
32089
|
+
const finalOptions = mergeExceptArrays({
|
|
32090
|
+
smartZoom: false,
|
|
32091
|
+
overrideZoom: true
|
|
32092
|
+
}, options);
|
|
32093
|
+
if (!this.enabled) return;
|
|
32094
|
+
if (area.width === 0 || area.height === 0) return;
|
|
32095
|
+
this.fitToElements(area, finalOptions);
|
|
32096
|
+
}
|
|
31814
32097
|
enable() {
|
|
31815
32098
|
this.enabled = true;
|
|
31816
32099
|
}
|
|
@@ -31829,10 +32112,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31829
32112
|
initEvents() {
|
|
31830
32113
|
window.addEventListener("keydown", (e) => {
|
|
31831
32114
|
if (e.ctrlKey || e.metaKey) this.isCtrlOrMetaPressed = true;
|
|
31832
|
-
});
|
|
32115
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
31833
32116
|
window.addEventListener("keyup", (e) => {
|
|
31834
32117
|
if (!(e.ctrlKey || e.metaKey)) this.isCtrlOrMetaPressed = false;
|
|
31835
|
-
});
|
|
32118
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
31836
32119
|
const stage = this.instance.getStage();
|
|
31837
32120
|
let lastCenter = null;
|
|
31838
32121
|
let lastDist = 0;
|
|
@@ -31857,7 +32140,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31857
32140
|
return;
|
|
31858
32141
|
}
|
|
31859
32142
|
}
|
|
31860
|
-
}, {
|
|
32143
|
+
}, {
|
|
32144
|
+
passive: false,
|
|
32145
|
+
signal: this.instance.getEventsController()?.signal
|
|
32146
|
+
});
|
|
31861
32147
|
stage.getContent().addEventListener("touchmove", (e) => {
|
|
31862
32148
|
e.preventDefault();
|
|
31863
32149
|
if (e.touches.length === 2) {
|
|
@@ -31897,12 +32183,18 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31897
32183
|
lastDist = dist;
|
|
31898
32184
|
lastCenter = newCenter;
|
|
31899
32185
|
}
|
|
31900
|
-
}, {
|
|
32186
|
+
}, {
|
|
32187
|
+
passive: false,
|
|
32188
|
+
signal: this.instance.getEventsController()?.signal
|
|
32189
|
+
});
|
|
31901
32190
|
stage.getContent().addEventListener("touchend", () => {
|
|
31902
32191
|
this.pinching = false;
|
|
31903
32192
|
lastDist = 0;
|
|
31904
32193
|
lastCenter = null;
|
|
31905
|
-
}, {
|
|
32194
|
+
}, {
|
|
32195
|
+
passive: false,
|
|
32196
|
+
signal: this.instance.getEventsController()?.signal
|
|
32197
|
+
});
|
|
31906
32198
|
let doZoom = false;
|
|
31907
32199
|
const handleWheelImmediate = (e) => {
|
|
31908
32200
|
const performZoom = this.isCtrlOrMetaPressed || !this.isCtrlOrMetaPressed && e.ctrlKey && e.deltaMode === 0;
|
|
@@ -31920,7 +32212,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31920
32212
|
e.preventDefault();
|
|
31921
32213
|
doZoom = true;
|
|
31922
32214
|
};
|
|
31923
|
-
window.addEventListener("wheel", handleWheelImmediate, {
|
|
32215
|
+
window.addEventListener("wheel", handleWheelImmediate, {
|
|
32216
|
+
signal: this.instance.getEventsController()?.signal,
|
|
32217
|
+
passive: false
|
|
32218
|
+
});
|
|
31924
32219
|
const handleWheel = (e) => {
|
|
31925
32220
|
if (!doZoom) return;
|
|
31926
32221
|
const delta = e.deltaY > 0 ? 1 : -1;
|
|
@@ -31933,7 +32228,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31933
32228
|
}
|
|
31934
32229
|
};
|
|
31935
32230
|
const throttledHandleWheel = (0, import_lodash.throttle)(handleWheel, DEFAULT_THROTTLE_MS);
|
|
31936
|
-
window.addEventListener("wheel", throttledHandleWheel, {
|
|
32231
|
+
window.addEventListener("wheel", throttledHandleWheel, {
|
|
32232
|
+
signal: this.instance.getEventsController()?.signal,
|
|
32233
|
+
passive: true
|
|
32234
|
+
});
|
|
31937
32235
|
}
|
|
31938
32236
|
getInertiaScale() {
|
|
31939
32237
|
const stage = this.instance.getStage();
|
|
@@ -31991,6 +32289,7 @@ const ZOOM_OUT_TOOL_ACTION_NAME = "zoomOutTool";
|
|
|
31991
32289
|
//#region src/actions/zoom-out-tool/zoom-out-tool.ts
|
|
31992
32290
|
var WeaveZoomOutToolAction = class extends WeaveAction {
|
|
31993
32291
|
onPropsChange = void 0;
|
|
32292
|
+
initialize = void 0;
|
|
31994
32293
|
getName() {
|
|
31995
32294
|
return ZOOM_OUT_TOOL_ACTION_NAME;
|
|
31996
32295
|
}
|
|
@@ -32025,6 +32324,10 @@ const ZOOM_IN_TOOL_ACTION_NAME = "zoomInTool";
|
|
|
32025
32324
|
//#region src/actions/zoom-in-tool/zoom-in-tool.ts
|
|
32026
32325
|
var WeaveZoomInToolAction = class extends WeaveAction {
|
|
32027
32326
|
onPropsChange = void 0;
|
|
32327
|
+
initialize = void 0;
|
|
32328
|
+
constructor() {
|
|
32329
|
+
super();
|
|
32330
|
+
}
|
|
32028
32331
|
getName() {
|
|
32029
32332
|
return ZOOM_IN_TOOL_ACTION_NAME;
|
|
32030
32333
|
}
|
|
@@ -32059,6 +32362,10 @@ const FIT_TO_SCREEN_TOOL_ACTION_NAME = "fitToScreenTool";
|
|
|
32059
32362
|
//#region src/actions/fit-to-screen-tool/fit-to-screen-tool.ts
|
|
32060
32363
|
var WeaveFitToScreenToolAction = class extends WeaveAction {
|
|
32061
32364
|
onPropsChange = void 0;
|
|
32365
|
+
initialize = void 0;
|
|
32366
|
+
constructor() {
|
|
32367
|
+
super();
|
|
32368
|
+
}
|
|
32062
32369
|
getName() {
|
|
32063
32370
|
return FIT_TO_SCREEN_TOOL_ACTION_NAME;
|
|
32064
32371
|
}
|
|
@@ -32092,6 +32399,10 @@ const FIT_TO_SELECTION_TOOL_ACTION_NAME = "fitToSelectionTool";
|
|
|
32092
32399
|
//#region src/actions/fit-to-selection-tool/fit-to-selection-tool.ts
|
|
32093
32400
|
var WeaveFitToSelectionToolAction = class extends WeaveAction {
|
|
32094
32401
|
onPropsChange = void 0;
|
|
32402
|
+
initialize = void 0;
|
|
32403
|
+
constructor() {
|
|
32404
|
+
super();
|
|
32405
|
+
}
|
|
32095
32406
|
getName() {
|
|
32096
32407
|
return FIT_TO_SELECTION_TOOL_ACTION_NAME;
|
|
32097
32408
|
}
|
|
@@ -32134,6 +32445,9 @@ var WeaveMoveToolAction = class extends WeaveAction {
|
|
|
32134
32445
|
onInit = void 0;
|
|
32135
32446
|
constructor() {
|
|
32136
32447
|
super();
|
|
32448
|
+
this.initialize();
|
|
32449
|
+
}
|
|
32450
|
+
initialize() {
|
|
32137
32451
|
this.initialized = false;
|
|
32138
32452
|
this.state = MOVE_TOOL_STATE.IDLE;
|
|
32139
32453
|
}
|
|
@@ -32147,7 +32461,7 @@ var WeaveMoveToolAction = class extends WeaveAction {
|
|
|
32147
32461
|
this.cancelAction();
|
|
32148
32462
|
return;
|
|
32149
32463
|
}
|
|
32150
|
-
});
|
|
32464
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32151
32465
|
stage.on("pointerdown", () => {
|
|
32152
32466
|
if ([MOVE_TOOL_ACTION_NAME].includes(this.instance.getActiveAction() ?? "")) stage.container().style.cursor = "grabbing";
|
|
32153
32467
|
});
|
|
@@ -32206,6 +32520,9 @@ var WeaveSelectionToolAction = class extends WeaveAction {
|
|
|
32206
32520
|
onInit = void 0;
|
|
32207
32521
|
constructor() {
|
|
32208
32522
|
super();
|
|
32523
|
+
this.initialize();
|
|
32524
|
+
}
|
|
32525
|
+
initialize() {
|
|
32209
32526
|
this.initialized = false;
|
|
32210
32527
|
this.state = SELECTION_TOOL_STATE.IDLE;
|
|
32211
32528
|
}
|
|
@@ -32269,6 +32586,9 @@ var WeaveEraserToolAction = class extends WeaveAction {
|
|
|
32269
32586
|
onInit = void 0;
|
|
32270
32587
|
constructor() {
|
|
32271
32588
|
super();
|
|
32589
|
+
this.initialize();
|
|
32590
|
+
}
|
|
32591
|
+
initialize() {
|
|
32272
32592
|
this.initialized = false;
|
|
32273
32593
|
this.erasing = false;
|
|
32274
32594
|
this.state = ERASER_TOOL_STATE.IDLE;
|
|
@@ -32302,7 +32622,7 @@ var WeaveEraserToolAction = class extends WeaveAction {
|
|
|
32302
32622
|
this.cancelAction();
|
|
32303
32623
|
return;
|
|
32304
32624
|
}
|
|
32305
|
-
});
|
|
32625
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32306
32626
|
this.initialized = true;
|
|
32307
32627
|
}
|
|
32308
32628
|
setState(state) {
|
|
@@ -32369,6 +32689,9 @@ var WeaveRectangleToolAction = class extends WeaveAction {
|
|
|
32369
32689
|
onInit = void 0;
|
|
32370
32690
|
constructor() {
|
|
32371
32691
|
super();
|
|
32692
|
+
this.initialize();
|
|
32693
|
+
}
|
|
32694
|
+
initialize() {
|
|
32372
32695
|
this.pointers = new Map();
|
|
32373
32696
|
this.initialized = false;
|
|
32374
32697
|
this.state = RECTANGLE_TOOL_STATE.IDLE;
|
|
@@ -32404,7 +32727,7 @@ var WeaveRectangleToolAction = class extends WeaveAction {
|
|
|
32404
32727
|
this.cancelAction();
|
|
32405
32728
|
return;
|
|
32406
32729
|
}
|
|
32407
|
-
});
|
|
32730
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32408
32731
|
stage.on("pointermove", () => {
|
|
32409
32732
|
if (this.state === RECTANGLE_TOOL_STATE.IDLE) return;
|
|
32410
32733
|
this.setCursor();
|
|
@@ -32578,6 +32901,9 @@ var WeaveEllipseToolAction = class extends WeaveAction {
|
|
|
32578
32901
|
onInit = void 0;
|
|
32579
32902
|
constructor() {
|
|
32580
32903
|
super();
|
|
32904
|
+
this.initialize();
|
|
32905
|
+
}
|
|
32906
|
+
initialize() {
|
|
32581
32907
|
this.pointers = new Map();
|
|
32582
32908
|
this.initialized = false;
|
|
32583
32909
|
this.state = ELLIPSE_TOOL_STATE.IDLE;
|
|
@@ -32613,7 +32939,7 @@ var WeaveEllipseToolAction = class extends WeaveAction {
|
|
|
32613
32939
|
this.cancelAction();
|
|
32614
32940
|
return;
|
|
32615
32941
|
}
|
|
32616
|
-
});
|
|
32942
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32617
32943
|
stage.on("pointerdown", (e) => {
|
|
32618
32944
|
this.setTapStart(e);
|
|
32619
32945
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -32794,6 +33120,9 @@ var WeavePenToolAction = class extends WeaveAction {
|
|
|
32794
33120
|
onInit = void 0;
|
|
32795
33121
|
constructor() {
|
|
32796
33122
|
super();
|
|
33123
|
+
this.initialize();
|
|
33124
|
+
}
|
|
33125
|
+
initialize() {
|
|
32797
33126
|
this.pointers = new Map();
|
|
32798
33127
|
this.initialized = false;
|
|
32799
33128
|
this.state = PEN_TOOL_STATE.IDLE;
|
|
@@ -32829,7 +33158,7 @@ var WeavePenToolAction = class extends WeaveAction {
|
|
|
32829
33158
|
this.cancelAction();
|
|
32830
33159
|
return;
|
|
32831
33160
|
}
|
|
32832
|
-
});
|
|
33161
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32833
33162
|
stage.on("pointerdown", (e) => {
|
|
32834
33163
|
this.setTapStart(e);
|
|
32835
33164
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -33066,6 +33395,9 @@ var WeaveLineToolAction = class extends WeaveAction {
|
|
|
33066
33395
|
constructor(params) {
|
|
33067
33396
|
super();
|
|
33068
33397
|
this.config = mergeExceptArrays(LINE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
|
|
33398
|
+
this.initialize();
|
|
33399
|
+
}
|
|
33400
|
+
initialize() {
|
|
33069
33401
|
this.pointers = new Map();
|
|
33070
33402
|
this.initialized = false;
|
|
33071
33403
|
this.state = LINE_TOOL_STATE.IDLE;
|
|
@@ -33110,13 +33442,13 @@ var WeaveLineToolAction = class extends WeaveAction {
|
|
|
33110
33442
|
this.snappedAngle = null;
|
|
33111
33443
|
this.shiftPressed = true;
|
|
33112
33444
|
}
|
|
33113
|
-
});
|
|
33445
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33114
33446
|
window.addEventListener("keyup", (e) => {
|
|
33115
33447
|
if (e.key === "Shift" && this.instance.getActiveAction() === LINE_TOOL_ACTION_NAME) {
|
|
33116
33448
|
this.snappedAngle = null;
|
|
33117
33449
|
this.shiftPressed = false;
|
|
33118
33450
|
}
|
|
33119
|
-
});
|
|
33451
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33120
33452
|
stage.on("pointerdown", (e) => {
|
|
33121
33453
|
this.setTapStart(e);
|
|
33122
33454
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -33331,6 +33663,9 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
33331
33663
|
constructor(params) {
|
|
33332
33664
|
super();
|
|
33333
33665
|
this.config = mergeExceptArrays(BRUSH_TOOL_DEFAULT_CONFIG, params?.config ?? {});
|
|
33666
|
+
this.initialize();
|
|
33667
|
+
}
|
|
33668
|
+
initialize() {
|
|
33334
33669
|
this.initialized = false;
|
|
33335
33670
|
this.state = BRUSH_TOOL_STATE.INACTIVE;
|
|
33336
33671
|
this.strokeId = null;
|
|
@@ -33359,7 +33694,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
33359
33694
|
const stage = this.instance.getStage();
|
|
33360
33695
|
window.addEventListener("keyup", (e) => {
|
|
33361
33696
|
if (e.code === "Space" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) this.isSpacePressed = false;
|
|
33362
|
-
});
|
|
33697
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33363
33698
|
window.addEventListener("keydown", (e) => {
|
|
33364
33699
|
if (e.code === "Enter" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) {
|
|
33365
33700
|
e.stopPropagation();
|
|
@@ -33375,7 +33710,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
33375
33710
|
e.stopPropagation();
|
|
33376
33711
|
this.cancelAction();
|
|
33377
33712
|
}
|
|
33378
|
-
});
|
|
33713
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33379
33714
|
const handlePointerDown = (e) => {
|
|
33380
33715
|
if (this.state === BRUSH_TOOL_STATE.INACTIVE) return;
|
|
33381
33716
|
if (this.state !== BRUSH_TOOL_STATE.IDLE) return;
|
|
@@ -33584,6 +33919,9 @@ var WeaveTextToolAction = class extends WeaveAction {
|
|
|
33584
33919
|
onInit = void 0;
|
|
33585
33920
|
constructor() {
|
|
33586
33921
|
super();
|
|
33922
|
+
this.initialize();
|
|
33923
|
+
}
|
|
33924
|
+
initialize() {
|
|
33587
33925
|
this.initialized = false;
|
|
33588
33926
|
this.state = TEXT_TOOL_STATE.IDLE;
|
|
33589
33927
|
this.textId = null;
|
|
@@ -33613,7 +33951,7 @@ var WeaveTextToolAction = class extends WeaveAction {
|
|
|
33613
33951
|
this.cancelAction();
|
|
33614
33952
|
return;
|
|
33615
33953
|
}
|
|
33616
|
-
});
|
|
33954
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33617
33955
|
stage.on("pointermove", () => {
|
|
33618
33956
|
if (this.state === TEXT_TOOL_STATE.IDLE) return;
|
|
33619
33957
|
this.setCursor();
|
|
@@ -33741,6 +34079,9 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
33741
34079
|
constructor(params) {
|
|
33742
34080
|
super();
|
|
33743
34081
|
this.config = mergeExceptArrays(WEAVE_IMAGE_TOOL_CONFIG_DEFAULT, params?.config ?? {});
|
|
34082
|
+
this.initialize();
|
|
34083
|
+
}
|
|
34084
|
+
initialize() {
|
|
33744
34085
|
this.pointers = new Map();
|
|
33745
34086
|
this.initialized = false;
|
|
33746
34087
|
this.imageId = null;
|
|
@@ -33784,7 +34125,7 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
33784
34125
|
this.cancelAction();
|
|
33785
34126
|
return;
|
|
33786
34127
|
}
|
|
33787
|
-
});
|
|
34128
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33788
34129
|
stage.on("pointerdown", (e) => {
|
|
33789
34130
|
this.setTapStart(e);
|
|
33790
34131
|
if (this.ignorePointerEvents) return;
|
|
@@ -34181,6 +34522,9 @@ var WeaveImagesToolAction = class extends WeaveAction {
|
|
|
34181
34522
|
constructor(params) {
|
|
34182
34523
|
super();
|
|
34183
34524
|
this.config = mergeExceptArrays(WEAVE_IMAGES_TOOL_DEFAULT_CONFIG, params ?? {});
|
|
34525
|
+
this.initialize();
|
|
34526
|
+
}
|
|
34527
|
+
initialize() {
|
|
34184
34528
|
this.pointers = new Map();
|
|
34185
34529
|
this.initialized = false;
|
|
34186
34530
|
this.tempPointerFeedbackNode = null;
|
|
@@ -34227,7 +34571,7 @@ var WeaveImagesToolAction = class extends WeaveAction {
|
|
|
34227
34571
|
const stage = this.instance.getStage();
|
|
34228
34572
|
stage.container().addEventListener("keydown", (e) => {
|
|
34229
34573
|
if (e.key === "Escape" && this.instance.getActiveAction() === WEAVE_IMAGES_TOOL_ACTION_NAME) this.cancelAction();
|
|
34230
|
-
});
|
|
34574
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
34231
34575
|
stage.on("pointerdown", (e) => {
|
|
34232
34576
|
this.setTapStart(e);
|
|
34233
34577
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -34609,6 +34953,9 @@ var WeaveStarToolAction = class extends WeaveAction {
|
|
|
34609
34953
|
onInit = void 0;
|
|
34610
34954
|
constructor() {
|
|
34611
34955
|
super();
|
|
34956
|
+
this.initialize();
|
|
34957
|
+
}
|
|
34958
|
+
initialize() {
|
|
34612
34959
|
this.pointers = new Map();
|
|
34613
34960
|
this.initialized = false;
|
|
34614
34961
|
this.state = STAR_TOOL_STATE.IDLE;
|
|
@@ -34645,7 +34992,7 @@ var WeaveStarToolAction = class extends WeaveAction {
|
|
|
34645
34992
|
this.cancelAction();
|
|
34646
34993
|
return;
|
|
34647
34994
|
}
|
|
34648
|
-
});
|
|
34995
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
34649
34996
|
stage.on("pointerdown", (e) => {
|
|
34650
34997
|
this.setTapStart(e);
|
|
34651
34998
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -34810,8 +35157,8 @@ var WeaveStarToolAction = class extends WeaveAction {
|
|
|
34810
35157
|
|
|
34811
35158
|
//#endregion
|
|
34812
35159
|
//#region src/actions/arrow-tool/constants.ts
|
|
34813
|
-
const
|
|
34814
|
-
const
|
|
35160
|
+
const WEAVE_ARROW_TOOL_ACTION_NAME = "arrowTool";
|
|
35161
|
+
const WEAVE_ARROW_TOOL_STATE = {
|
|
34815
35162
|
["IDLE"]: "idle",
|
|
34816
35163
|
["ADDING"]: "adding",
|
|
34817
35164
|
["DEFINING_SIZE"]: "definingSize",
|
|
@@ -34827,9 +35174,12 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34827
35174
|
onInit = void 0;
|
|
34828
35175
|
constructor() {
|
|
34829
35176
|
super();
|
|
35177
|
+
this.initialize();
|
|
35178
|
+
}
|
|
35179
|
+
initialize() {
|
|
34830
35180
|
this.pointers = new Map();
|
|
34831
35181
|
this.initialized = false;
|
|
34832
|
-
this.state =
|
|
35182
|
+
this.state = WEAVE_ARROW_TOOL_STATE.IDLE;
|
|
34833
35183
|
this.arrowId = null;
|
|
34834
35184
|
this.tempArrowId = null;
|
|
34835
35185
|
this.tempMainArrowNode = null;
|
|
@@ -34842,7 +35192,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34842
35192
|
this.props = this.initProps();
|
|
34843
35193
|
}
|
|
34844
35194
|
getName() {
|
|
34845
|
-
return
|
|
35195
|
+
return WEAVE_ARROW_TOOL_ACTION_NAME;
|
|
34846
35196
|
}
|
|
34847
35197
|
initProps() {
|
|
34848
35198
|
return {
|
|
@@ -34859,40 +35209,37 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34859
35209
|
setupEvents() {
|
|
34860
35210
|
const stage = this.instance.getStage();
|
|
34861
35211
|
window.addEventListener("keydown", (e) => {
|
|
34862
|
-
if (e.code === "Enter" && this.instance.getActiveAction() ===
|
|
34863
|
-
this.cancelAction();
|
|
34864
|
-
return;
|
|
34865
|
-
}
|
|
34866
|
-
if (e.code === "Escape" && this.instance.getActiveAction() === ARROW_TOOL_ACTION_NAME) {
|
|
35212
|
+
if (e.code === "Enter" && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
|
|
34867
35213
|
this.cancelAction();
|
|
34868
35214
|
return;
|
|
34869
35215
|
}
|
|
34870
|
-
|
|
35216
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) this.cancelAction();
|
|
35217
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
34871
35218
|
stage.on("pointerdown", (e) => {
|
|
34872
35219
|
this.setTapStart(e);
|
|
34873
35220
|
this.pointers.set(e.evt.pointerId, {
|
|
34874
35221
|
x: e.evt.clientX,
|
|
34875
35222
|
y: e.evt.clientY
|
|
34876
35223
|
});
|
|
34877
|
-
if (this.pointers.size === 2 && this.instance.getActiveAction() ===
|
|
34878
|
-
this.state =
|
|
35224
|
+
if (this.pointers.size === 2 && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
|
|
35225
|
+
this.state = WEAVE_ARROW_TOOL_STATE.ADDING;
|
|
34879
35226
|
return;
|
|
34880
35227
|
}
|
|
34881
|
-
if (!this.tempMainArrowNode && this.state ===
|
|
34882
|
-
if (this.tempMainArrowNode && this.state ===
|
|
35228
|
+
if (!this.tempMainArrowNode && this.state === WEAVE_ARROW_TOOL_STATE.ADDING) this.handleAdding();
|
|
35229
|
+
if (this.tempMainArrowNode && this.state === WEAVE_ARROW_TOOL_STATE.ADDING) this.state = WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE;
|
|
34883
35230
|
});
|
|
34884
35231
|
stage.on("pointermove", () => {
|
|
34885
|
-
if (this.state ===
|
|
35232
|
+
if (this.state === WEAVE_ARROW_TOOL_STATE.IDLE) return;
|
|
34886
35233
|
this.setCursor();
|
|
34887
|
-
if (this.pointers.size === 2 && this.instance.getActiveAction() ===
|
|
34888
|
-
this.state =
|
|
35234
|
+
if (this.pointers.size === 2 && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
|
|
35235
|
+
this.state = WEAVE_ARROW_TOOL_STATE.ADDING;
|
|
34889
35236
|
return;
|
|
34890
35237
|
}
|
|
34891
|
-
if (this.state ===
|
|
35238
|
+
if (this.state === WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) this.handleMovement();
|
|
34892
35239
|
});
|
|
34893
35240
|
stage.on("pointerup", (e) => {
|
|
34894
35241
|
this.pointers.delete(e.evt.pointerId);
|
|
34895
|
-
if (this.state ===
|
|
35242
|
+
if (this.state === WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) this.handleSettingSize();
|
|
34896
35243
|
});
|
|
34897
35244
|
this.initialized = true;
|
|
34898
35245
|
}
|
|
@@ -34906,7 +35253,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34906
35253
|
this.tempPoint = void 0;
|
|
34907
35254
|
this.tempNextPoint = void 0;
|
|
34908
35255
|
this.clickPoint = null;
|
|
34909
|
-
this.setState(
|
|
35256
|
+
this.setState(WEAVE_ARROW_TOOL_STATE.ADDING);
|
|
34910
35257
|
}
|
|
34911
35258
|
handleAdding() {
|
|
34912
35259
|
const stage = this.instance.getStage();
|
|
@@ -34957,7 +35304,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34957
35304
|
this.measureContainer?.add(this.tempNextPoint);
|
|
34958
35305
|
this.tempPoint.moveToTop();
|
|
34959
35306
|
this.tempNextPoint.moveToTop();
|
|
34960
|
-
this.setState(
|
|
35307
|
+
this.setState(WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE);
|
|
34961
35308
|
}
|
|
34962
35309
|
}
|
|
34963
35310
|
handleSettingSize() {
|
|
@@ -34984,11 +35331,11 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34984
35331
|
y: mousePoint.y,
|
|
34985
35332
|
points: [0, 0]
|
|
34986
35333
|
});
|
|
34987
|
-
this.setState(
|
|
35334
|
+
this.setState(WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE);
|
|
34988
35335
|
}
|
|
34989
35336
|
}
|
|
34990
35337
|
handleMovement() {
|
|
34991
|
-
if (this.state !==
|
|
35338
|
+
if (this.state !== WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) return;
|
|
34992
35339
|
if (this.arrowId && this.tempArrowNode && this.measureContainer && this.tempNextPoint) {
|
|
34993
35340
|
const { mousePoint } = this.instance.getMousePointerRelativeToContainer(this.measureContainer);
|
|
34994
35341
|
this.tempArrowNode.setAttrs({
|
|
@@ -35055,7 +35402,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
35055
35402
|
this.container = void 0;
|
|
35056
35403
|
this.measureContainer = void 0;
|
|
35057
35404
|
this.clickPoint = null;
|
|
35058
|
-
this.setState(
|
|
35405
|
+
this.setState(WEAVE_ARROW_TOOL_STATE.IDLE);
|
|
35059
35406
|
}
|
|
35060
35407
|
setCursor() {
|
|
35061
35408
|
const stage = this.instance.getStage();
|
|
@@ -35099,13 +35446,15 @@ const WEAVE_STROKE_TOOL_DEFAULT_CONFIG = { snapAngles: {
|
|
|
35099
35446
|
var WeaveStrokeToolAction = class extends WeaveAction {
|
|
35100
35447
|
initialized = false;
|
|
35101
35448
|
initialCursor = null;
|
|
35102
|
-
snappedAngle = null;
|
|
35103
35449
|
shiftPressed = false;
|
|
35104
35450
|
onPropsChange = void 0;
|
|
35105
35451
|
onInit = void 0;
|
|
35106
35452
|
constructor(params) {
|
|
35107
35453
|
super();
|
|
35108
35454
|
this.config = mergeExceptArrays(WEAVE_STROKE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
|
|
35455
|
+
this.initialize();
|
|
35456
|
+
}
|
|
35457
|
+
initialize() {
|
|
35109
35458
|
this.pointers = new Map();
|
|
35110
35459
|
this.initialized = false;
|
|
35111
35460
|
this.state = WEAVE_STROKE_TOOL_STATE.IDLE;
|
|
@@ -35114,7 +35463,6 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35114
35463
|
this.tempLineId = null;
|
|
35115
35464
|
this.tempLineNode = null;
|
|
35116
35465
|
this.container = void 0;
|
|
35117
|
-
this.snappedAngle = null;
|
|
35118
35466
|
this.measureContainer = void 0;
|
|
35119
35467
|
this.clickPoint = null;
|
|
35120
35468
|
this.snapper = new GreedySnapper({
|
|
@@ -35127,6 +35475,9 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35127
35475
|
getName() {
|
|
35128
35476
|
return WEAVE_STROKE_TOOL_ACTION_NAME;
|
|
35129
35477
|
}
|
|
35478
|
+
getNames() {
|
|
35479
|
+
return [WEAVE_STROKE_TOOL_ACTION_NAME, ...WEAVE_STROKE_TOOL_ACTION_NAME_ALIASES];
|
|
35480
|
+
}
|
|
35130
35481
|
hasAliases() {
|
|
35131
35482
|
return true;
|
|
35132
35483
|
}
|
|
@@ -35145,32 +35496,26 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35145
35496
|
setupEvents() {
|
|
35146
35497
|
const stage = this.instance.getStage();
|
|
35147
35498
|
window.addEventListener("keydown", (e) => {
|
|
35148
|
-
if (e.code === "Enter" && this.instance.getActiveAction()
|
|
35499
|
+
if (e.code === "Enter" && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
|
|
35149
35500
|
this.cancelAction();
|
|
35150
35501
|
return;
|
|
35151
35502
|
}
|
|
35152
|
-
if (e.code === "Escape" && this.instance.getActiveAction()
|
|
35503
|
+
if (e.code === "Escape" && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
|
|
35153
35504
|
this.cancelAction();
|
|
35154
35505
|
return;
|
|
35155
35506
|
}
|
|
35156
|
-
if (e.key === "Shift" && this.instance.getActiveAction()
|
|
35157
|
-
|
|
35158
|
-
this.shiftPressed = true;
|
|
35159
|
-
}
|
|
35160
|
-
});
|
|
35507
|
+
if (e.key === "Shift" && this.getNames().includes(this.instance.getActiveAction() ?? "")) this.shiftPressed = true;
|
|
35508
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35161
35509
|
window.addEventListener("keyup", (e) => {
|
|
35162
|
-
if (e.key === "Shift" && this.instance.getActiveAction()
|
|
35163
|
-
|
|
35164
|
-
this.shiftPressed = false;
|
|
35165
|
-
}
|
|
35166
|
-
});
|
|
35510
|
+
if (e.key === "Shift" && this.getNames().includes(this.instance.getActiveAction() ?? "")) this.shiftPressed = false;
|
|
35511
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35167
35512
|
stage.on("pointerdown", (e) => {
|
|
35168
35513
|
this.setTapStart(e);
|
|
35169
35514
|
this.pointers.set(e.evt.pointerId, {
|
|
35170
35515
|
x: e.evt.clientX,
|
|
35171
35516
|
y: e.evt.clientY
|
|
35172
35517
|
});
|
|
35173
|
-
if (this.pointers.size === 2 && this.instance.getActiveAction()
|
|
35518
|
+
if (this.pointers.size === 2 && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
|
|
35174
35519
|
this.state = WEAVE_STROKE_TOOL_STATE.ADDING;
|
|
35175
35520
|
return;
|
|
35176
35521
|
}
|
|
@@ -35180,7 +35525,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35180
35525
|
stage.on("pointermove", () => {
|
|
35181
35526
|
if (this.state === WEAVE_STROKE_TOOL_STATE.IDLE) return;
|
|
35182
35527
|
this.setCursor();
|
|
35183
|
-
if (this.pointers.size === 2 && this.instance.getActiveAction()
|
|
35528
|
+
if (this.pointers.size === 2 && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
|
|
35184
35529
|
this.state = WEAVE_STROKE_TOOL_STATE.ADDING;
|
|
35185
35530
|
return;
|
|
35186
35531
|
}
|
|
@@ -35198,7 +35543,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35198
35543
|
addLine() {
|
|
35199
35544
|
this.setCursor();
|
|
35200
35545
|
this.setFocusStage();
|
|
35201
|
-
this.instance.emitEvent("onAddingStroke", { actionName: this.instance.getActiveAction() ??
|
|
35546
|
+
this.instance.emitEvent("onAddingStroke", { actionName: this.instance.getActiveAction() ?? "not-defined" });
|
|
35202
35547
|
this.shiftPressed = false;
|
|
35203
35548
|
this.clickPoint = null;
|
|
35204
35549
|
this.setState(WEAVE_STROKE_TOOL_STATE.ADDING);
|
|
@@ -35306,7 +35651,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35306
35651
|
});
|
|
35307
35652
|
delete finalLine.props.dragBoundFunc;
|
|
35308
35653
|
this.instance.addNode(finalLine, this.container?.getAttrs().id);
|
|
35309
|
-
this.instance.emitEvent("onAddedStroke", { actionName: this.instance.getActiveAction() ??
|
|
35654
|
+
this.instance.emitEvent("onAddedStroke", { actionName: this.instance.getActiveAction() ?? "not-defined" });
|
|
35310
35655
|
nodeCreated = true;
|
|
35311
35656
|
}
|
|
35312
35657
|
}
|
|
@@ -35356,6 +35701,9 @@ var WeaveRegularPolygonToolAction = class extends WeaveAction {
|
|
|
35356
35701
|
onInit = void 0;
|
|
35357
35702
|
constructor() {
|
|
35358
35703
|
super();
|
|
35704
|
+
this.initialize();
|
|
35705
|
+
}
|
|
35706
|
+
initialize() {
|
|
35359
35707
|
this.pointers = new Map();
|
|
35360
35708
|
this.initialized = false;
|
|
35361
35709
|
this.state = REGULAR_POLYGON_TOOL_STATE.IDLE;
|
|
@@ -35390,7 +35738,7 @@ var WeaveRegularPolygonToolAction = class extends WeaveAction {
|
|
|
35390
35738
|
this.cancelAction();
|
|
35391
35739
|
return;
|
|
35392
35740
|
}
|
|
35393
|
-
});
|
|
35741
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35394
35742
|
stage.on("pointerdown", (e) => {
|
|
35395
35743
|
this.setTapStart(e);
|
|
35396
35744
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -35564,6 +35912,9 @@ var WeaveFrameToolAction = class extends WeaveAction {
|
|
|
35564
35912
|
onInit = void 0;
|
|
35565
35913
|
constructor() {
|
|
35566
35914
|
super();
|
|
35915
|
+
this.initialize();
|
|
35916
|
+
}
|
|
35917
|
+
initialize() {
|
|
35567
35918
|
this.initialized = false;
|
|
35568
35919
|
this.state = FRAME_TOOL_STATE.IDLE;
|
|
35569
35920
|
this.frameId = null;
|
|
@@ -35591,7 +35942,7 @@ var WeaveFrameToolAction = class extends WeaveAction {
|
|
|
35591
35942
|
this.cancelAction();
|
|
35592
35943
|
return;
|
|
35593
35944
|
}
|
|
35594
|
-
});
|
|
35945
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35595
35946
|
stage.on("pointermove", () => {
|
|
35596
35947
|
if (this.state === FRAME_TOOL_STATE.IDLE) return;
|
|
35597
35948
|
this.setCursor();
|
|
@@ -35693,6 +36044,10 @@ var WeaveExportStageToolAction = class extends WeaveAction {
|
|
|
35693
36044
|
};
|
|
35694
36045
|
onPropsChange = void 0;
|
|
35695
36046
|
onInit = void 0;
|
|
36047
|
+
initialize = void 0;
|
|
36048
|
+
constructor() {
|
|
36049
|
+
super();
|
|
36050
|
+
}
|
|
35696
36051
|
getName() {
|
|
35697
36052
|
return EXPORT_STAGE_TOOL_ACTION_NAME;
|
|
35698
36053
|
}
|
|
@@ -35740,6 +36095,10 @@ var WeaveExportNodesToolAction = class extends WeaveAction {
|
|
|
35740
36095
|
};
|
|
35741
36096
|
onPropsChange = void 0;
|
|
35742
36097
|
onInit = void 0;
|
|
36098
|
+
initialize = void 0;
|
|
36099
|
+
constructor() {
|
|
36100
|
+
super();
|
|
36101
|
+
}
|
|
35743
36102
|
getName() {
|
|
35744
36103
|
return EXPORT_NODES_TOOL_ACTION_NAME;
|
|
35745
36104
|
}
|
|
@@ -35792,6 +36151,9 @@ var WeaveAlignNodesToolAction = class extends WeaveAction {
|
|
|
35792
36151
|
onInit = void 0;
|
|
35793
36152
|
constructor() {
|
|
35794
36153
|
super();
|
|
36154
|
+
this.initialize();
|
|
36155
|
+
}
|
|
36156
|
+
initialize() {
|
|
35795
36157
|
this.initialized = false;
|
|
35796
36158
|
this.state = ALIGN_NODES_TOOL_STATE.IDLE;
|
|
35797
36159
|
}
|
|
@@ -36041,6 +36403,9 @@ var WeaveCommentToolAction = class extends WeaveAction {
|
|
|
36041
36403
|
super();
|
|
36042
36404
|
const { config } = params ?? {};
|
|
36043
36405
|
this.config = mergeExceptArrays(WEAVE_COMMENT_TOOL_DEFAULT_CONFIG, config);
|
|
36406
|
+
this.initialize();
|
|
36407
|
+
}
|
|
36408
|
+
initialize() {
|
|
36044
36409
|
this.pointers = new Map();
|
|
36045
36410
|
this.initialized = false;
|
|
36046
36411
|
this.state = WEAVE_COMMENT_TOOL_STATE.IDLE;
|
|
@@ -36118,7 +36483,7 @@ var WeaveCommentToolAction = class extends WeaveAction {
|
|
|
36118
36483
|
return;
|
|
36119
36484
|
}
|
|
36120
36485
|
if (e.code === "Escape" && this.state === WEAVE_COMMENT_TOOL_STATE.CREATING_COMMENT) this.setState(WEAVE_COMMENT_TOOL_STATE.ADDING);
|
|
36121
|
-
});
|
|
36486
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
36122
36487
|
stage.on("pointermove", (e) => {
|
|
36123
36488
|
if (this.state === WEAVE_COMMENT_TOOL_STATE.IDLE) return;
|
|
36124
36489
|
if (commentNodeHandler?.isCommentViewing()) {
|
|
@@ -36269,6 +36634,9 @@ var WeaveVideoToolAction = class extends WeaveAction {
|
|
|
36269
36634
|
update = void 0;
|
|
36270
36635
|
constructor() {
|
|
36271
36636
|
super();
|
|
36637
|
+
this.initialize();
|
|
36638
|
+
}
|
|
36639
|
+
initialize() {
|
|
36272
36640
|
this.pointers = new Map();
|
|
36273
36641
|
this.initialized = false;
|
|
36274
36642
|
this.state = VIDEO_TOOL_STATE.IDLE;
|
|
@@ -36315,7 +36683,7 @@ var WeaveVideoToolAction = class extends WeaveAction {
|
|
|
36315
36683
|
this.cancelAction();
|
|
36316
36684
|
return;
|
|
36317
36685
|
}
|
|
36318
|
-
});
|
|
36686
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
36319
36687
|
stage.on("pointerdown", (e) => {
|
|
36320
36688
|
this.setTapStart(e);
|
|
36321
36689
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -36448,6 +36816,9 @@ var WeaveMeasureToolAction = class extends WeaveAction {
|
|
|
36448
36816
|
constructor(params) {
|
|
36449
36817
|
super();
|
|
36450
36818
|
this.config = mergeExceptArrays(WEAVE_MEASURE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
|
|
36819
|
+
this.initialize();
|
|
36820
|
+
}
|
|
36821
|
+
initialize() {
|
|
36451
36822
|
this.initialized = false;
|
|
36452
36823
|
this.state = MEASURE_TOOL_STATE.IDLE;
|
|
36453
36824
|
this.measureId = null;
|
|
@@ -36474,7 +36845,7 @@ var WeaveMeasureToolAction = class extends WeaveAction {
|
|
|
36474
36845
|
const stage = this.instance.getStage();
|
|
36475
36846
|
window.addEventListener("keydown", (e) => {
|
|
36476
36847
|
if (e.code === "Escape" && this.instance.getActiveAction() === MEASURE_TOOL_ACTION_NAME) this.cancelAction();
|
|
36477
|
-
});
|
|
36848
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
36478
36849
|
stage.on("pointermove", () => {
|
|
36479
36850
|
if (this.state === MEASURE_TOOL_STATE.IDLE) return;
|
|
36480
36851
|
if (this.state === MEASURE_TOOL_STATE.SET_TO) {
|
|
@@ -36744,6 +37115,9 @@ var WeaveConnectorToolAction = class extends WeaveAction {
|
|
|
36744
37115
|
constructor(params) {
|
|
36745
37116
|
super();
|
|
36746
37117
|
this.config = mergeExceptArrays(CONNECTOR_TOOL_DEFAULT_CONFIG, params?.config);
|
|
37118
|
+
this.initialize();
|
|
37119
|
+
}
|
|
37120
|
+
initialize() {
|
|
36747
37121
|
this.pointers = new Map();
|
|
36748
37122
|
this.initialized = false;
|
|
36749
37123
|
this.tempLineNode = null;
|
|
@@ -36782,7 +37156,7 @@ var WeaveConnectorToolAction = class extends WeaveAction {
|
|
|
36782
37156
|
return;
|
|
36783
37157
|
}
|
|
36784
37158
|
if (e.code === "Escape" && this.instance.getActiveAction() === CONNECTOR_TOOL_ACTION_NAME) this.cancelAction();
|
|
36785
|
-
});
|
|
37159
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
36786
37160
|
let nodeHovered = void 0;
|
|
36787
37161
|
stage.on("pointermove", () => {
|
|
36788
37162
|
if (!(this.state === CONNECTOR_TOOL_STATE.SELECTING_INITIAL || this.state === CONNECTOR_TOOL_STATE.SELECTING_FINAL)) return;
|
|
@@ -37097,10 +37471,6 @@ var WeaveConnectorToolAction = class extends WeaveAction {
|
|
|
37097
37471
|
//#endregion
|
|
37098
37472
|
//#region src/plugins/stage-grid/stage-grid.ts
|
|
37099
37473
|
var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
37100
|
-
actStageZoomX = 1;
|
|
37101
|
-
actStageZoomY = 1;
|
|
37102
|
-
actStagePosX = 0;
|
|
37103
|
-
actStagePosY = 0;
|
|
37104
37474
|
constructor(params) {
|
|
37105
37475
|
super();
|
|
37106
37476
|
const { config } = params ?? {};
|
|
@@ -37116,6 +37486,10 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37116
37486
|
this.isMouseMiddleButtonPressed = false;
|
|
37117
37487
|
this.isSpaceKeyPressed = false;
|
|
37118
37488
|
this.forceStageChange = false;
|
|
37489
|
+
this.actStagePosX = 0;
|
|
37490
|
+
this.actStagePosY = 0;
|
|
37491
|
+
this.actStageZoomX = 1;
|
|
37492
|
+
this.actStageZoomY = 1;
|
|
37119
37493
|
}
|
|
37120
37494
|
getName() {
|
|
37121
37495
|
return WEAVE_STAGE_GRID_PLUGIN_KEY;
|
|
@@ -37140,10 +37514,10 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37140
37514
|
const stage = this.instance.getStage();
|
|
37141
37515
|
window.addEventListener("keydown", (e) => {
|
|
37142
37516
|
if (e.code === "Space") this.isSpaceKeyPressed = true;
|
|
37143
|
-
});
|
|
37517
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37144
37518
|
window.addEventListener("keyup", (e) => {
|
|
37145
37519
|
if (e.code === "Space") this.isSpaceKeyPressed = false;
|
|
37146
|
-
});
|
|
37520
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37147
37521
|
this.instance.addEventListener("onStageMove", () => {
|
|
37148
37522
|
this.onRender();
|
|
37149
37523
|
});
|
|
@@ -37409,15 +37783,14 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37409
37783
|
//#endregion
|
|
37410
37784
|
//#region src/plugins/stage-panning/stage-panning.ts
|
|
37411
37785
|
var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
37412
|
-
panning = false;
|
|
37413
|
-
currentPointer = null;
|
|
37414
|
-
stageScrollInterval = void 0;
|
|
37415
|
-
panEdgeTargets = {};
|
|
37416
37786
|
getLayerName = void 0;
|
|
37417
37787
|
initLayer = void 0;
|
|
37418
37788
|
constructor(params) {
|
|
37419
37789
|
super();
|
|
37420
37790
|
this.config = mergeExceptArrays(WEAVE_STAGE_PANNING_DEFAULT_CONFIG, params?.config ?? {});
|
|
37791
|
+
this.initialize();
|
|
37792
|
+
}
|
|
37793
|
+
initialize() {
|
|
37421
37794
|
this.pointers = new Map();
|
|
37422
37795
|
this.panning = false;
|
|
37423
37796
|
this.isDragging = false;
|
|
@@ -37429,6 +37802,9 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37429
37802
|
this.isCtrlOrMetaPressed = false;
|
|
37430
37803
|
this.isSpaceKeyPressed = false;
|
|
37431
37804
|
this.previousPointer = null;
|
|
37805
|
+
this.currentPointer = null;
|
|
37806
|
+
this.stageScrollInterval = void 0;
|
|
37807
|
+
this.panEdgeTargets = {};
|
|
37432
37808
|
}
|
|
37433
37809
|
getName() {
|
|
37434
37810
|
return WEAVE_STAGE_PANNING_KEY;
|
|
@@ -37462,7 +37838,7 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37462
37838
|
this.isSpaceKeyPressed = true;
|
|
37463
37839
|
this.setCursor();
|
|
37464
37840
|
}
|
|
37465
|
-
});
|
|
37841
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37466
37842
|
window.addEventListener("keyup", (e) => {
|
|
37467
37843
|
if (e.key === "Meta" || e.key === "Control") this.isCtrlOrMetaPressed = false;
|
|
37468
37844
|
if (e.code === "Space") {
|
|
@@ -37473,7 +37849,7 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37473
37849
|
this.isSpaceKeyPressed = false;
|
|
37474
37850
|
this.disableMove();
|
|
37475
37851
|
}
|
|
37476
|
-
});
|
|
37852
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37477
37853
|
let lastPos = null;
|
|
37478
37854
|
stage.on("pointerdown", (e) => {
|
|
37479
37855
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -37546,7 +37922,10 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37546
37922
|
this.instance.emitEvent("onStageMove");
|
|
37547
37923
|
};
|
|
37548
37924
|
const handleWheelThrottled = (0, import_lodash.throttle)(handleWheel, WEAVE_STAGE_PANNING_THROTTLE_MS);
|
|
37549
|
-
window.addEventListener("wheel", handleWheelThrottled, {
|
|
37925
|
+
window.addEventListener("wheel", handleWheelThrottled, {
|
|
37926
|
+
passive: true,
|
|
37927
|
+
signal: this.instance.getEventsController()?.signal
|
|
37928
|
+
});
|
|
37550
37929
|
stage.on("dragstart", (e) => {
|
|
37551
37930
|
const duration = 1e3 / 60;
|
|
37552
37931
|
if (this.panEdgeTargets[e.target.getAttrs().id ?? ""] !== void 0) return;
|
|
@@ -37604,7 +37983,10 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37604
37983
|
stage.container().style.setProperty("-webkit-user-drag", "none");
|
|
37605
37984
|
stage.getContent().addEventListener("touchmove", function(e) {
|
|
37606
37985
|
e.preventDefault();
|
|
37607
|
-
}, {
|
|
37986
|
+
}, {
|
|
37987
|
+
passive: false,
|
|
37988
|
+
signal: this.instance.getEventsController()?.signal
|
|
37989
|
+
});
|
|
37608
37990
|
}
|
|
37609
37991
|
isPanning() {
|
|
37610
37992
|
return this.panning;
|
|
@@ -37682,6 +38064,9 @@ var WeaveStageMinimapPlugin = class extends WeavePlugin {
|
|
|
37682
38064
|
constructor(params) {
|
|
37683
38065
|
super();
|
|
37684
38066
|
this.config = mergeExceptArrays(STAGE_MINIMAP_DEFAULT_CONFIG, params.config);
|
|
38067
|
+
this.initialize();
|
|
38068
|
+
}
|
|
38069
|
+
initialize() {
|
|
37685
38070
|
this.initialized = false;
|
|
37686
38071
|
}
|
|
37687
38072
|
getName() {
|
|
@@ -37859,6 +38244,7 @@ const WEAVE_STAGE_RESIZE_KEY = "stageResize";
|
|
|
37859
38244
|
var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
37860
38245
|
getLayerName = void 0;
|
|
37861
38246
|
initLayer = void 0;
|
|
38247
|
+
initialize = void 0;
|
|
37862
38248
|
getName() {
|
|
37863
38249
|
return WEAVE_STAGE_RESIZE_KEY;
|
|
37864
38250
|
}
|
|
@@ -37878,6 +38264,10 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
|
37878
38264
|
const pluginInstance = plugins[pluginId];
|
|
37879
38265
|
pluginInstance.onRender?.();
|
|
37880
38266
|
}
|
|
38267
|
+
this.instance.emitEvent("onStageResize", {
|
|
38268
|
+
width: stage.width(),
|
|
38269
|
+
height: stage.height()
|
|
38270
|
+
});
|
|
37881
38271
|
}
|
|
37882
38272
|
}
|
|
37883
38273
|
onInit() {
|
|
@@ -37886,7 +38276,7 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
|
37886
38276
|
}, DEFAULT_THROTTLE_MS);
|
|
37887
38277
|
window.addEventListener("resize", () => {
|
|
37888
38278
|
throttledResize();
|
|
37889
|
-
});
|
|
38279
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37890
38280
|
const resizeObserver = new ResizeObserver(() => {
|
|
37891
38281
|
throttledResize();
|
|
37892
38282
|
});
|
|
@@ -37904,10 +38294,12 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
|
37904
38294
|
//#endregion
|
|
37905
38295
|
//#region src/plugins/nodes-multi-selection-feedback/nodes-multi-selection-feedback.ts
|
|
37906
38296
|
var WeaveNodesMultiSelectionFeedbackPlugin = class extends WeavePlugin {
|
|
37907
|
-
selectedHalos = {};
|
|
37908
38297
|
constructor(params) {
|
|
37909
38298
|
super();
|
|
37910
38299
|
this.config = mergeExceptArrays(WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_DEFAULT_CONFIG, params?.config ?? {});
|
|
38300
|
+
this.initialize();
|
|
38301
|
+
}
|
|
38302
|
+
initialize() {
|
|
37911
38303
|
this.selectedHalos = {};
|
|
37912
38304
|
}
|
|
37913
38305
|
getName() {
|
|
@@ -38073,12 +38465,14 @@ var WeaveNodesMultiSelectionFeedbackPlugin = class extends WeavePlugin {
|
|
|
38073
38465
|
//#endregion
|
|
38074
38466
|
//#region src/plugins/connected-users/connected-users.ts
|
|
38075
38467
|
var WeaveConnectedUsersPlugin = class extends WeavePlugin {
|
|
38076
|
-
connectedUsers = {};
|
|
38077
38468
|
getLayerName = void 0;
|
|
38078
38469
|
constructor(params) {
|
|
38079
38470
|
super();
|
|
38080
38471
|
const { config } = params ?? {};
|
|
38081
38472
|
this.config = config;
|
|
38473
|
+
this.initialize();
|
|
38474
|
+
}
|
|
38475
|
+
initialize() {
|
|
38082
38476
|
this.connectedUsers = {};
|
|
38083
38477
|
}
|
|
38084
38478
|
getName() {
|
|
@@ -38125,6 +38519,9 @@ var WeaveUsersSelectionPlugin = class extends WeavePlugin {
|
|
|
38125
38519
|
this.config = config;
|
|
38126
38520
|
this.config.getUser = memoize(this.config.getUser);
|
|
38127
38521
|
this.config.getUserColor = memoize(this.config.getUserColor);
|
|
38522
|
+
this.initialize();
|
|
38523
|
+
}
|
|
38524
|
+
initialize() {
|
|
38128
38525
|
this.usersSelection = {};
|
|
38129
38526
|
}
|
|
38130
38527
|
getName() {
|
|
@@ -38317,6 +38714,9 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
38317
38714
|
this.config.getUser = memoize(this.config.getUser);
|
|
38318
38715
|
this.config.getUserBackgroundColor = memoize(this.config.getUserBackgroundColor);
|
|
38319
38716
|
this.config.getUserForegroundColor = memoize(this.config.getUserForegroundColor);
|
|
38717
|
+
this.initialize();
|
|
38718
|
+
}
|
|
38719
|
+
initialize() {
|
|
38320
38720
|
this.usersPointers = {};
|
|
38321
38721
|
this.usersOperations = {};
|
|
38322
38722
|
}
|
|
@@ -38527,6 +38927,9 @@ var WeaveUsersPresencePlugin = class extends WeavePlugin {
|
|
|
38527
38927
|
super();
|
|
38528
38928
|
const { config } = params;
|
|
38529
38929
|
this.config = mergeExceptArrays(WEAVE_USERS_PRESENCE_CONFIG_DEFAULT_PROPS, config);
|
|
38930
|
+
this.initialize();
|
|
38931
|
+
}
|
|
38932
|
+
initialize() {
|
|
38530
38933
|
this.userPresence = {};
|
|
38531
38934
|
}
|
|
38532
38935
|
getName() {
|
|
@@ -38602,6 +39005,9 @@ var WeaveStageDropAreaPlugin = class extends WeavePlugin {
|
|
|
38602
39005
|
initLayer = void 0;
|
|
38603
39006
|
constructor() {
|
|
38604
39007
|
super();
|
|
39008
|
+
this.initialize();
|
|
39009
|
+
}
|
|
39010
|
+
initialize() {
|
|
38605
39011
|
this.enabled = true;
|
|
38606
39012
|
}
|
|
38607
39013
|
getName() {
|
|
@@ -38615,14 +39021,20 @@ var WeaveStageDropAreaPlugin = class extends WeavePlugin {
|
|
|
38615
39021
|
stage.container().addEventListener("dragover", (e) => {
|
|
38616
39022
|
e.preventDefault();
|
|
38617
39023
|
e.stopPropagation();
|
|
38618
|
-
});
|
|
39024
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
38619
39025
|
stage.container().addEventListener("drop", (e) => {
|
|
38620
39026
|
e.preventDefault();
|
|
38621
39027
|
e.stopPropagation();
|
|
38622
39028
|
this.instance.emitEvent("onStageDrop", e);
|
|
39029
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
39030
|
+
window.addEventListener("dragover", (e) => e.preventDefault(), {
|
|
39031
|
+
signal: this.instance.getEventsController()?.signal,
|
|
39032
|
+
passive: false
|
|
39033
|
+
});
|
|
39034
|
+
window.addEventListener("drop", (e) => e.preventDefault(), {
|
|
39035
|
+
signal: this.instance.getEventsController()?.signal,
|
|
39036
|
+
passive: false
|
|
38623
39037
|
});
|
|
38624
|
-
window.addEventListener("dragover", (e) => e.preventDefault(), { passive: false });
|
|
38625
|
-
window.addEventListener("drop", (e) => e.preventDefault(), { passive: false });
|
|
38626
39038
|
}
|
|
38627
39039
|
enable() {
|
|
38628
39040
|
this.enabled = true;
|
|
@@ -38641,6 +39053,9 @@ var WeaveNodesEdgeSnappingPlugin = class extends WeavePlugin {
|
|
|
38641
39053
|
this.guideLineConfig = config?.guideLine ?? GUIDE_LINE_DEFAULT_CONFIG;
|
|
38642
39054
|
this.dragSnappingThreshold = config?.dragSnappingThreshold ?? GUIDE_LINE_DRAG_SNAPPING_THRESHOLD;
|
|
38643
39055
|
this.transformSnappingThreshold = config?.transformSnappingThreshold ?? GUIDE_LINE_TRANSFORM_SNAPPING_THRESHOLD;
|
|
39056
|
+
this.initialize();
|
|
39057
|
+
}
|
|
39058
|
+
initialize() {
|
|
38644
39059
|
this.enabled = true;
|
|
38645
39060
|
}
|
|
38646
39061
|
getName() {
|
|
@@ -39017,6 +39432,9 @@ var WeaveNodesDistanceSnappingPlugin = class extends WeavePlugin {
|
|
|
39017
39432
|
this.enterSnappingTolerance = config?.enterSnappingTolerance ?? GUIDE_ENTER_SNAPPING_TOLERANCE;
|
|
39018
39433
|
this.exitSnappingTolerance = config?.exitSnappingTolerance ?? GUIDE_EXIT_SNAPPING_TOLERANCE;
|
|
39019
39434
|
this.uiConfig = mergeExceptArrays(GUIDE_DISTANCE_LINE_DEFAULT_CONFIG, config?.ui);
|
|
39435
|
+
this.initialize();
|
|
39436
|
+
}
|
|
39437
|
+
initialize() {
|
|
39020
39438
|
this.enabled = true;
|
|
39021
39439
|
}
|
|
39022
39440
|
getName() {
|
|
@@ -39663,12 +40081,14 @@ var WeaveNodesDistanceSnappingPlugin = class extends WeavePlugin {
|
|
|
39663
40081
|
//#endregion
|
|
39664
40082
|
//#region src/plugins/comments-renderer/comments-renderer.ts
|
|
39665
40083
|
var WeaveCommentsRendererPlugin = class extends WeavePlugin {
|
|
39666
|
-
comments = [];
|
|
39667
40084
|
getLayerName = void 0;
|
|
39668
40085
|
constructor(params) {
|
|
39669
40086
|
super();
|
|
39670
40087
|
const { config } = params ?? {};
|
|
39671
40088
|
this.config = config;
|
|
40089
|
+
this.initialize();
|
|
40090
|
+
}
|
|
40091
|
+
initialize() {
|
|
39672
40092
|
this.comments = [];
|
|
39673
40093
|
}
|
|
39674
40094
|
getName() {
|
|
@@ -39759,6 +40179,7 @@ const WEAVE_STAGE_KEYBOARD_MOVE_DEFAULT_CONFIG = { movementDelta: 5 };
|
|
|
39759
40179
|
var WeaveStageKeyboardMovePlugin = class extends WeavePlugin {
|
|
39760
40180
|
getLayerName = void 0;
|
|
39761
40181
|
initLayer = void 0;
|
|
40182
|
+
initialize = void 0;
|
|
39762
40183
|
constructor(params) {
|
|
39763
40184
|
super();
|
|
39764
40185
|
this.config = mergeExceptArrays(WEAVE_STAGE_KEYBOARD_MOVE_DEFAULT_CONFIG, params?.config ?? {});
|
|
@@ -39797,7 +40218,7 @@ var WeaveStageKeyboardMovePlugin = class extends WeavePlugin {
|
|
|
39797
40218
|
if (e.code === "ArrowLeft" && e.shiftKey) this.handleNodesMovement("left");
|
|
39798
40219
|
if (e.code === "ArrowRight" && e.shiftKey) this.handleNodesMovement("right");
|
|
39799
40220
|
if (e.code === "ArrowDown" && e.shiftKey) this.handleNodesMovement("down");
|
|
39800
|
-
});
|
|
40221
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
39801
40222
|
}
|
|
39802
40223
|
enable() {
|
|
39803
40224
|
this.enabled = true;
|
|
@@ -39854,4 +40275,4 @@ function getJSONFromYjsBinary(actualState) {
|
|
|
39854
40275
|
}
|
|
39855
40276
|
|
|
39856
40277
|
//#endregion
|
|
39857
|
-
export { ALIGN_NODES_ALIGN_TO, ALIGN_NODES_TOOL_ACTION_NAME, ALIGN_NODES_TOOL_STATE,
|
|
40278
|
+
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_CONFIG, WEAVE_GRID_DOT_TYPES, 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 };
|