@inditextech/weave-sdk 3.4.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 +728 -268
- package/dist/sdk.node.js +728 -268
- package/dist/types.d.ts +161 -36
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +728 -268
- 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() {
|
|
@@ -18577,16 +18585,23 @@ const WEAVE_GRID_TYPES = {
|
|
|
18577
18585
|
["LINES"]: "lines",
|
|
18578
18586
|
["DOTS"]: "dots"
|
|
18579
18587
|
};
|
|
18580
|
-
const
|
|
18581
|
-
|
|
18582
|
-
|
|
18583
|
-
|
|
18584
|
-
const
|
|
18585
|
-
|
|
18586
|
-
|
|
18587
|
-
|
|
18588
|
-
|
|
18589
|
-
|
|
18588
|
+
const WEAVE_GRID_DOT_TYPES = {
|
|
18589
|
+
["SQUARE"]: "square",
|
|
18590
|
+
["CIRCLE"]: "circle"
|
|
18591
|
+
};
|
|
18592
|
+
const WEAVE_GRID_DEFAULT_CONFIG = {
|
|
18593
|
+
type: WEAVE_GRID_TYPES.LINES,
|
|
18594
|
+
gridColor: "#b3b3b3",
|
|
18595
|
+
gridMajorColor: "#b3b3b3",
|
|
18596
|
+
gridOriginColor: "#ff746c",
|
|
18597
|
+
gridSize: 20,
|
|
18598
|
+
gridMajorEvery: 10,
|
|
18599
|
+
gridMajorRatio: 2,
|
|
18600
|
+
gridStroke: 1,
|
|
18601
|
+
gridDotType: WEAVE_GRID_DOT_TYPES.CIRCLE,
|
|
18602
|
+
gridDotRadius: 1,
|
|
18603
|
+
gridDotRectSize: 2
|
|
18604
|
+
};
|
|
18590
18605
|
const WEAVE_GRID_LAYER_ID = "gridLayer";
|
|
18591
18606
|
|
|
18592
18607
|
//#endregion
|
|
@@ -18617,7 +18632,10 @@ const DEFAULT_ADD_NODE_OPTIONS = { emitUserChangeEvent: false };
|
|
|
18617
18632
|
const DEFAULT_UPDATE_NODE_OPTIONS = { emitUserChangeEvent: false };
|
|
18618
18633
|
const DEFAULT_REMOVE_NODE_OPTIONS = { emitUserChangeEvent: false };
|
|
18619
18634
|
const DEFAULT_MOVE_NODE_OPTIONS = { emitUserChangeEvent: false };
|
|
18620
|
-
const WEAVE_DEFAULT_CONFIG = {
|
|
18635
|
+
const WEAVE_DEFAULT_CONFIG = {
|
|
18636
|
+
behaviors: { axisLockThreshold: 5 },
|
|
18637
|
+
performance: { upscale: { enabled: false } }
|
|
18638
|
+
};
|
|
18621
18639
|
|
|
18622
18640
|
//#endregion
|
|
18623
18641
|
//#region src/plugins/users-presence/constants.ts
|
|
@@ -18646,6 +18664,9 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
18646
18664
|
constructor(params) {
|
|
18647
18665
|
super();
|
|
18648
18666
|
this.config = mergeExceptArrays(WEAVE_NODES_SELECTION_DEFAULT_CONFIG, params?.config ?? {});
|
|
18667
|
+
this.initialize();
|
|
18668
|
+
}
|
|
18669
|
+
initialize() {
|
|
18649
18670
|
this.defaultEnabledAnchors = this.config.selection?.enabledAnchors ?? [
|
|
18650
18671
|
"top-left",
|
|
18651
18672
|
"top-center",
|
|
@@ -18809,7 +18830,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
18809
18830
|
nodeHovered = void 0;
|
|
18810
18831
|
}
|
|
18811
18832
|
this.instance.getStage().handleMouseover?.();
|
|
18812
|
-
});
|
|
18833
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
18813
18834
|
const handleTransform = (e) => {
|
|
18814
18835
|
const moved = this.checkMoved(e);
|
|
18815
18836
|
if (moved) this.getContextMenuPlugin()?.cancelLongPressTimer();
|
|
@@ -19224,11 +19245,11 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
19224
19245
|
});
|
|
19225
19246
|
return;
|
|
19226
19247
|
}
|
|
19227
|
-
});
|
|
19248
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
19228
19249
|
stage.container().addEventListener("keyup", (e) => {
|
|
19229
19250
|
if (!(e.ctrlKey || e.metaKey)) this.isCtrlMetaPressed = false;
|
|
19230
19251
|
if (e.code === "Space") this.isSpaceKeyPressed = false;
|
|
19231
|
-
});
|
|
19252
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
19232
19253
|
stage.on("pointerdown", (e) => {
|
|
19233
19254
|
this.setTapStart(e);
|
|
19234
19255
|
this.handledClickOrTap = false;
|
|
@@ -19435,7 +19456,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
19435
19456
|
if (existNode) newSelectedNodes.push(existNode);
|
|
19436
19457
|
}
|
|
19437
19458
|
this.tr.nodes([...newSelectedNodes]);
|
|
19438
|
-
this.tr.forceUpdate();
|
|
19459
|
+
if (newSelectedNodes.length > 0) this.tr.forceUpdate();
|
|
19439
19460
|
this.triggerSelectedNodesEvent();
|
|
19440
19461
|
}
|
|
19441
19462
|
getSelectionPlugin() {
|
|
@@ -19688,6 +19709,9 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
|
|
|
19688
19709
|
super();
|
|
19689
19710
|
this.getImageBase64 = params.getImageBase64;
|
|
19690
19711
|
this.config = mergeExceptArrays(WEAVE_COPY_PASTE_CONFIG_DEFAULT, params?.config);
|
|
19712
|
+
this.initialize();
|
|
19713
|
+
}
|
|
19714
|
+
initialize() {
|
|
19691
19715
|
this.actualInternalPaddingX = 0;
|
|
19692
19716
|
this.actualInternalPaddingY = 0;
|
|
19693
19717
|
this.lastInternalPasteSnapshot = "";
|
|
@@ -19793,7 +19817,7 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
|
|
|
19793
19817
|
this.focusPasteCatcher();
|
|
19794
19818
|
if (!this.enabled) return;
|
|
19795
19819
|
}
|
|
19796
|
-
});
|
|
19820
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
19797
19821
|
if (catcher) catcher.addEventListener("paste", async (e) => {
|
|
19798
19822
|
e.preventDefault();
|
|
19799
19823
|
let items = void 0;
|
|
@@ -19812,7 +19836,7 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
|
|
|
19812
19836
|
return;
|
|
19813
19837
|
}
|
|
19814
19838
|
this.sendExternalPasteEvent(void 0, items);
|
|
19815
|
-
});
|
|
19839
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
19816
19840
|
}
|
|
19817
19841
|
sendExternalPasteEvent(dataList, items) {
|
|
19818
19842
|
const stage = this.instance.getStage();
|
|
@@ -21967,11 +21991,34 @@ var WeaveRegisterManager = class {
|
|
|
21967
21991
|
}
|
|
21968
21992
|
}
|
|
21969
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
|
+
}
|
|
21970
22017
|
};
|
|
21971
22018
|
|
|
21972
22019
|
//#endregion
|
|
21973
22020
|
//#region package.json
|
|
21974
|
-
var version = "3.
|
|
22021
|
+
var version = "3.6.0-SNAPSHOT.112.1";
|
|
21975
22022
|
|
|
21976
22023
|
//#endregion
|
|
21977
22024
|
//#region src/managers/setup.ts
|
|
@@ -22088,6 +22135,11 @@ var WeaveStageManager = class {
|
|
|
22088
22135
|
initialZIndex: void 0
|
|
22089
22136
|
};
|
|
22090
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
|
+
}
|
|
22091
22143
|
const realContainer = stage.container();
|
|
22092
22144
|
if (realContainer !== void 0 && realContainer.style?.position !== "relative") realContainer.style.position = "relative";
|
|
22093
22145
|
this.setStage(stage);
|
|
@@ -22220,6 +22272,10 @@ var WeaveExportManager = class {
|
|
|
22220
22272
|
exportNodesAsImage(nodes, boundingNodes, options) {
|
|
22221
22273
|
return new Promise((resolve) => {
|
|
22222
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();
|
|
22223
22279
|
this.getNodesSelectionPlugin()?.disable();
|
|
22224
22280
|
this.getNodesDistanceSnappingPlugin()?.disable();
|
|
22225
22281
|
this.getNodesEdgeSnappingPlugin()?.disable();
|
|
@@ -22284,16 +22340,80 @@ var WeaveExportManager = class {
|
|
|
22284
22340
|
stage.position(originalPosition);
|
|
22285
22341
|
stage.scale(originalScale);
|
|
22286
22342
|
stage.batchDraw();
|
|
22287
|
-
this.getNodesSelectionPlugin()?.enable();
|
|
22288
|
-
this.getNodesDistanceSnappingPlugin()?.enable();
|
|
22289
|
-
this.getNodesEdgeSnappingPlugin()?.enable();
|
|
22290
|
-
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();
|
|
22291
22347
|
resolve(img);
|
|
22292
22348
|
}
|
|
22293
22349
|
});
|
|
22294
22350
|
}
|
|
22295
22351
|
});
|
|
22296
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
|
+
}
|
|
22297
22417
|
async exportNodesServerSide(nodes, boundingNodes, options) {
|
|
22298
22418
|
const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
|
|
22299
22419
|
this.getNodesSelectionPlugin()?.disable();
|
|
@@ -22396,6 +22516,91 @@ var WeaveExportManager = class {
|
|
|
22396
22516
|
height: imageHeight * pixelRatio
|
|
22397
22517
|
};
|
|
22398
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
|
+
}
|
|
22399
22604
|
imageToBase64(img, mimeType) {
|
|
22400
22605
|
if (img.naturalWidth === 0 && img.naturalHeight === 0) throw new Error("Image has no content");
|
|
22401
22606
|
const canvas = document.createElement("canvas");
|
|
@@ -22675,7 +22880,12 @@ var WeaveAsyncManager = class {
|
|
|
22675
22880
|
this.instance.emitEvent("onAsyncElementChange");
|
|
22676
22881
|
}, new Map());
|
|
22677
22882
|
}
|
|
22883
|
+
reset() {
|
|
22884
|
+
this.asyncElements.clear();
|
|
22885
|
+
this.asyncElementsLoadedEventEmitted = false;
|
|
22886
|
+
}
|
|
22678
22887
|
checkForAsyncElements(elements) {
|
|
22888
|
+
this.instance.emitEvent("onAsyncElementsIdle");
|
|
22679
22889
|
const amountAsyncResourcesExtracted = this.extractAsyncResources(elements);
|
|
22680
22890
|
if (amountAsyncResourcesExtracted === 0 && !this.asyncElementsLoadedEventEmitted) {
|
|
22681
22891
|
this.instance.emitEvent("onAsyncElementsLoaded");
|
|
@@ -22728,7 +22938,7 @@ var WeaveAsyncManager = class {
|
|
|
22728
22938
|
status: WEAVE_ASYNC_STATUS.LOADING
|
|
22729
22939
|
};
|
|
22730
22940
|
this.asyncElements.set(nodeId, element);
|
|
22731
|
-
this.instance.emitEvent("onAsyncElementsLoading", {
|
|
22941
|
+
if (!this.asyncElementsLoadedEventEmitted) this.instance.emitEvent("onAsyncElementsLoading", {
|
|
22732
22942
|
loaded: this.getAmountAsyncElementsLoaded(),
|
|
22733
22943
|
total: this.getAmountAsyncElements()
|
|
22734
22944
|
});
|
|
@@ -22741,11 +22951,11 @@ var WeaveAsyncManager = class {
|
|
|
22741
22951
|
status: WEAVE_ASYNC_STATUS.LOADED
|
|
22742
22952
|
};
|
|
22743
22953
|
this.asyncElements.set(nodeId, element);
|
|
22744
|
-
this.instance.emitEvent("onAsyncElementsLoading", {
|
|
22745
|
-
loaded: this.getAmountAsyncElementsLoaded(),
|
|
22746
|
-
total: this.getAmountAsyncElements()
|
|
22747
|
-
});
|
|
22748
22954
|
if (!this.asyncElementsLoadedEventEmitted) {
|
|
22955
|
+
this.instance.emitEvent("onAsyncElementsLoading", {
|
|
22956
|
+
loaded: this.getAmountAsyncElementsLoaded(),
|
|
22957
|
+
total: this.getAmountAsyncElements()
|
|
22958
|
+
});
|
|
22749
22959
|
const allLoaded = this.asyncElementsLoaded();
|
|
22750
22960
|
if (allLoaded) {
|
|
22751
22961
|
this.instance.emitEvent("onAsyncElementsLoaded");
|
|
@@ -22870,6 +23080,7 @@ var Weave = class {
|
|
|
22870
23080
|
constructor(weaveConfig, stageConfig) {
|
|
22871
23081
|
globalThis._weave_isServerSide = false;
|
|
22872
23082
|
if (typeof window === "undefined") globalThis._weave_isServerSide = true;
|
|
23083
|
+
this.eventsController = void 0;
|
|
22873
23084
|
this.emitter = new Emittery();
|
|
22874
23085
|
Konva.showWarnings = false;
|
|
22875
23086
|
this.id = v4_default();
|
|
@@ -22915,6 +23126,7 @@ var Weave = class {
|
|
|
22915
23126
|
this.initialized = true;
|
|
22916
23127
|
this.status = WEAVE_INSTANCE_STATUS.RUNNING;
|
|
22917
23128
|
this.emitEvent("onInstanceStatus", this.status);
|
|
23129
|
+
this.emitEvent("onRender");
|
|
22918
23130
|
});
|
|
22919
23131
|
}
|
|
22920
23132
|
setStatus(status) {
|
|
@@ -22939,6 +23151,7 @@ var Weave = class {
|
|
|
22939
23151
|
async start() {
|
|
22940
23152
|
this.moduleLogger.info("Start instance");
|
|
22941
23153
|
if (!this.isServerSide()) {
|
|
23154
|
+
this.eventsController = new AbortController();
|
|
22942
23155
|
if (!window.weave) window.weave = this;
|
|
22943
23156
|
}
|
|
22944
23157
|
this.emitEvent("onRoomLoaded", false);
|
|
@@ -22962,8 +23175,39 @@ var Weave = class {
|
|
|
22962
23175
|
store.setup();
|
|
22963
23176
|
store.connect();
|
|
22964
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
|
+
}
|
|
22965
23208
|
destroy() {
|
|
22966
23209
|
this.moduleLogger.info(`Destroying the instance`);
|
|
23210
|
+
if (this.eventsController) this.eventsController.abort();
|
|
22967
23211
|
this.emitter.clearListeners();
|
|
22968
23212
|
this.status = WEAVE_INSTANCE_STATUS.IDLE;
|
|
22969
23213
|
this.emitEvent("onInstanceStatus", this.status);
|
|
@@ -23433,9 +23677,15 @@ var Weave = class {
|
|
|
23433
23677
|
async exportNodesServerSide(nodes, boundingNodes, options) {
|
|
23434
23678
|
return await this.exportManager.exportNodesServerSide(nodes, boundingNodes, options);
|
|
23435
23679
|
}
|
|
23680
|
+
async exportAreaServerSide(area, options) {
|
|
23681
|
+
return await this.exportManager.exportAreaServerSide(area, options);
|
|
23682
|
+
}
|
|
23436
23683
|
async exportNodes(nodes, boundingNodes, options) {
|
|
23437
23684
|
return await this.exportManager.exportNodesAsImage(nodes, boundingNodes, options);
|
|
23438
23685
|
}
|
|
23686
|
+
async exportArea(area, options) {
|
|
23687
|
+
return await this.exportManager.exportAreaAsImage(area, options);
|
|
23688
|
+
}
|
|
23439
23689
|
getExportBoundingBox(nodesIds) {
|
|
23440
23690
|
const nodes = [];
|
|
23441
23691
|
for (const nodeId of nodesIds) {
|
|
@@ -23598,6 +23848,9 @@ var Weave = class {
|
|
|
23598
23848
|
getDragProperties() {
|
|
23599
23849
|
return this.dragAndDropManager.getDragProperties();
|
|
23600
23850
|
}
|
|
23851
|
+
getEventsController() {
|
|
23852
|
+
return this.eventsController;
|
|
23853
|
+
}
|
|
23601
23854
|
};
|
|
23602
23855
|
|
|
23603
23856
|
//#endregion
|
|
@@ -23689,6 +23942,7 @@ const downscaleImageFromURL = (url, options) => {
|
|
|
23689
23942
|
//#endregion
|
|
23690
23943
|
//#region src/internal-utils/upscale.ts
|
|
23691
23944
|
const setupUpscaleStage = (instance, stage) => {
|
|
23945
|
+
if (instance.isServerSide()) return;
|
|
23692
23946
|
const config = instance.getConfiguration();
|
|
23693
23947
|
const doUpscale = config.performance?.upscale?.enabled ?? false;
|
|
23694
23948
|
if (doUpscale) {
|
|
@@ -23720,7 +23974,14 @@ const setupUpscaleStage = (instance, stage) => {
|
|
|
23720
23974
|
innerElement.style.transformOrigin = "0 0";
|
|
23721
23975
|
innerElement.style.transform = `scale(${scaleToCover})`;
|
|
23722
23976
|
}
|
|
23723
|
-
} 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
|
+
}
|
|
23724
23985
|
};
|
|
23725
23986
|
|
|
23726
23987
|
//#endregion
|
|
@@ -23731,6 +23992,7 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23731
23992
|
wheelMousePressed = false;
|
|
23732
23993
|
isCmdCtrlPressed = false;
|
|
23733
23994
|
globalEventsInitialized = false;
|
|
23995
|
+
initialize = void 0;
|
|
23734
23996
|
onRender(props) {
|
|
23735
23997
|
const stage = new Konva.Stage({
|
|
23736
23998
|
...props,
|
|
@@ -23749,10 +24011,10 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23749
24011
|
container.setAttribute("tabindex", "0");
|
|
23750
24012
|
stage.container().addEventListener("focus", () => {
|
|
23751
24013
|
this.stageFocused = true;
|
|
23752
|
-
});
|
|
24014
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
23753
24015
|
stage.container().addEventListener("blur", () => {
|
|
23754
24016
|
this.stageFocused = false;
|
|
23755
|
-
});
|
|
24017
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
23756
24018
|
}
|
|
23757
24019
|
Konva.Stage.prototype.mode = function(mode) {
|
|
23758
24020
|
if (typeof mode !== "undefined") this._mode = mode;
|
|
@@ -23822,7 +24084,7 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23822
24084
|
const selectedNode = transformer.nodes()[0];
|
|
23823
24085
|
selectedNode.fire("onCmdCtrlPressed");
|
|
23824
24086
|
}
|
|
23825
|
-
});
|
|
24087
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
23826
24088
|
window.addEventListener("keyup", (e) => {
|
|
23827
24089
|
if (!(e.ctrlKey || e.metaKey)) {
|
|
23828
24090
|
this.isCmdCtrlPressed = false;
|
|
@@ -23833,7 +24095,7 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23833
24095
|
const selectedNode = transformer.nodes()[0];
|
|
23834
24096
|
selectedNode.fire("onCmdCtrlReleased");
|
|
23835
24097
|
}
|
|
23836
|
-
});
|
|
24098
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
23837
24099
|
this.globalEventsInitialized = true;
|
|
23838
24100
|
}
|
|
23839
24101
|
isOnlyCtrlOrMeta(event) {
|
|
@@ -23853,6 +24115,7 @@ const WEAVE_LAYER_NODE_TYPE = "layer";
|
|
|
23853
24115
|
//#region src/nodes/layer/layer.ts
|
|
23854
24116
|
var WeaveLayerNode = class extends WeaveNode {
|
|
23855
24117
|
nodeType = WEAVE_LAYER_NODE_TYPE;
|
|
24118
|
+
initialize = void 0;
|
|
23856
24119
|
onRender(props) {
|
|
23857
24120
|
const layer = new Konva.Layer({ ...props });
|
|
23858
24121
|
layer.canMoveToContainer = function() {
|
|
@@ -23900,6 +24163,7 @@ const WEAVE_GROUP_NODE_TYPE = "group";
|
|
|
23900
24163
|
//#region src/nodes/group/group.ts
|
|
23901
24164
|
var WeaveGroupNode = class extends WeaveNode {
|
|
23902
24165
|
nodeType = WEAVE_GROUP_NODE_TYPE;
|
|
24166
|
+
initialize = void 0;
|
|
23903
24167
|
constructor(params) {
|
|
23904
24168
|
super();
|
|
23905
24169
|
const { config } = params ?? {};
|
|
@@ -23992,6 +24256,7 @@ const WEAVE_RECTANGLE_NODE_TYPE = "rectangle";
|
|
|
23992
24256
|
//#region src/nodes/rectangle/rectangle.ts
|
|
23993
24257
|
var WeaveRectangleNode = class extends WeaveNode {
|
|
23994
24258
|
nodeType = WEAVE_RECTANGLE_NODE_TYPE;
|
|
24259
|
+
initialize = void 0;
|
|
23995
24260
|
constructor(params) {
|
|
23996
24261
|
super();
|
|
23997
24262
|
const { config } = params ?? {};
|
|
@@ -24035,6 +24300,7 @@ const WEAVE_ELLIPSE_NODE_TYPE = "ellipse";
|
|
|
24035
24300
|
//#region src/nodes/ellipse/ellipse.ts
|
|
24036
24301
|
var WeaveEllipseNode = class extends WeaveNode {
|
|
24037
24302
|
nodeType = WEAVE_ELLIPSE_NODE_TYPE;
|
|
24303
|
+
initialize = void 0;
|
|
24038
24304
|
constructor(params) {
|
|
24039
24305
|
super();
|
|
24040
24306
|
const { config } = params ?? {};
|
|
@@ -24180,13 +24446,16 @@ var WeaveLineNode = class extends WeaveNode {
|
|
|
24180
24446
|
constructor(params) {
|
|
24181
24447
|
super();
|
|
24182
24448
|
this.config = mergeExceptArrays(WEAVE_LINE_NODE_DEFAULT_CONFIG, params?.config ?? {});
|
|
24183
|
-
this.handleNodeChanges = null;
|
|
24184
|
-
this.handleZoomChanges = null;
|
|
24185
24449
|
this.snapper = new GreedySnapper({
|
|
24186
24450
|
snapAngles: this.config.snapAngles.angles,
|
|
24187
24451
|
activateThreshold: this.config.snapAngles.activateThreshold,
|
|
24188
24452
|
releaseThreshold: this.config.snapAngles.releaseThreshold
|
|
24189
24453
|
});
|
|
24454
|
+
this.initialize();
|
|
24455
|
+
}
|
|
24456
|
+
initialize() {
|
|
24457
|
+
this.handleNodeChanges = null;
|
|
24458
|
+
this.handleZoomChanges = null;
|
|
24190
24459
|
}
|
|
24191
24460
|
onRender(props) {
|
|
24192
24461
|
const line = new Konva.Line({
|
|
@@ -24491,17 +24760,19 @@ const TEXT_LAYOUT = {
|
|
|
24491
24760
|
//#region src/nodes/text/text.ts
|
|
24492
24761
|
var WeaveTextNode = class extends WeaveNode {
|
|
24493
24762
|
nodeType = WEAVE_TEXT_NODE_TYPE;
|
|
24494
|
-
editing = false;
|
|
24495
|
-
textAreaSuperContainer = null;
|
|
24496
|
-
textAreaContainer = null;
|
|
24497
|
-
textArea = null;
|
|
24498
|
-
eventsInitialized = false;
|
|
24499
|
-
isCtrlMetaPressed = false;
|
|
24500
24763
|
constructor(params) {
|
|
24501
24764
|
super();
|
|
24502
24765
|
const { config } = params ?? {};
|
|
24503
24766
|
this.config = (0, import_lodash.merge)({}, WEAVE_TEXT_NODE_DEFAULT_CONFIG, config);
|
|
24767
|
+
this.initialize();
|
|
24768
|
+
}
|
|
24769
|
+
initialize() {
|
|
24504
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;
|
|
24505
24776
|
this.editing = false;
|
|
24506
24777
|
this.textArea = null;
|
|
24507
24778
|
}
|
|
@@ -24509,10 +24780,10 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24509
24780
|
if (!this.eventsInitialized && !globalThis._weave_isServerSide) {
|
|
24510
24781
|
window.addEventListener("keydown", (e) => {
|
|
24511
24782
|
if (e.ctrlKey || e.metaKey) this.isCtrlMetaPressed = true;
|
|
24512
|
-
});
|
|
24783
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24513
24784
|
window.addEventListener("keyup", (e) => {
|
|
24514
24785
|
if (!(e.ctrlKey || e.metaKey)) this.isCtrlMetaPressed = false;
|
|
24515
|
-
});
|
|
24786
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24516
24787
|
this.eventsInitialized = true;
|
|
24517
24788
|
}
|
|
24518
24789
|
}
|
|
@@ -24540,7 +24811,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24540
24811
|
onAdd() {
|
|
24541
24812
|
if (!this.instance.isServerSide() && !this.keyPressHandler) {
|
|
24542
24813
|
this.keyPressHandler = this.handleKeyPress.bind(this);
|
|
24543
|
-
window.addEventListener("keypress", this.keyPressHandler);
|
|
24814
|
+
window.addEventListener("keypress", this.keyPressHandler, { signal: this.instance.getEventsController()?.signal });
|
|
24544
24815
|
}
|
|
24545
24816
|
}
|
|
24546
24817
|
onRender(props) {
|
|
@@ -24694,7 +24965,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24694
24965
|
});
|
|
24695
24966
|
if (!this.instance.isServerSide() && !this.keyPressHandler) {
|
|
24696
24967
|
this.keyPressHandler = this.handleKeyPress.bind(this);
|
|
24697
|
-
window.addEventListener("keypress", this.keyPressHandler);
|
|
24968
|
+
window.addEventListener("keypress", this.keyPressHandler, { signal: this.instance.getEventsController()?.signal });
|
|
24698
24969
|
}
|
|
24699
24970
|
return text;
|
|
24700
24971
|
}
|
|
@@ -24953,17 +25224,17 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24953
25224
|
this.textAreaSuperContainer.scrollTop = 0;
|
|
24954
25225
|
this.textAreaSuperContainer.scrollLeft = 0;
|
|
24955
25226
|
}
|
|
24956
|
-
});
|
|
25227
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24957
25228
|
this.textAreaContainer.addEventListener("scroll", () => {
|
|
24958
25229
|
if (!this.textAreaContainer) return;
|
|
24959
25230
|
this.textAreaContainer.scrollTop = 0;
|
|
24960
25231
|
this.textAreaContainer.scrollLeft = 0;
|
|
24961
|
-
});
|
|
25232
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24962
25233
|
this.textArea.addEventListener("scroll", () => {
|
|
24963
25234
|
if (!this.textArea) return;
|
|
24964
25235
|
this.textArea.scrollTop = 0;
|
|
24965
25236
|
this.textArea.scrollLeft = 0;
|
|
24966
|
-
});
|
|
25237
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24967
25238
|
const rotation = textNode.getAbsoluteRotation();
|
|
24968
25239
|
if (rotation) {
|
|
24969
25240
|
const transform = "rotate(" + rotation + "deg)";
|
|
@@ -25012,8 +25283,8 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
25012
25283
|
this.textAreaDomResize(textNode);
|
|
25013
25284
|
}
|
|
25014
25285
|
};
|
|
25015
|
-
this.textArea.addEventListener("keydown", handleKeyDown);
|
|
25016
|
-
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 });
|
|
25017
25288
|
this.textArea.tabIndex = 1;
|
|
25018
25289
|
this.textArea.focus();
|
|
25019
25290
|
const handleOutsideClick = (e) => {
|
|
@@ -25039,7 +25310,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
25039
25310
|
}
|
|
25040
25311
|
};
|
|
25041
25312
|
setTimeout(() => {
|
|
25042
|
-
window.addEventListener("pointerup", handleOutsideClick);
|
|
25313
|
+
window.addEventListener("pointerup", handleOutsideClick, { signal: this.instance.getEventsController()?.signal });
|
|
25043
25314
|
}, 0);
|
|
25044
25315
|
this.instance.getStage().mode(WEAVE_STAGE_TEXT_EDITION_MODE);
|
|
25045
25316
|
this.editing = true;
|
|
@@ -25375,7 +25646,7 @@ var WeaveImageCrop = class WeaveImageCrop {
|
|
|
25375
25646
|
utilityLayer?.add(this.transformer);
|
|
25376
25647
|
this.transformer?.forceUpdate();
|
|
25377
25648
|
this.cropGroup.show();
|
|
25378
|
-
window.addEventListener("keydown", this.handleHide);
|
|
25649
|
+
window.addEventListener("keydown", this.handleHide, { signal: this.instance.getEventsController()?.signal });
|
|
25379
25650
|
if (options.cmdCtrl.triggered) {
|
|
25380
25651
|
utilityLayer?.hide();
|
|
25381
25652
|
const stage = this.instance.getStage();
|
|
@@ -25825,24 +26096,21 @@ const isAllowedUrl = (value) => {
|
|
|
25825
26096
|
//#endregion
|
|
25826
26097
|
//#region src/nodes/image/image.ts
|
|
25827
26098
|
var WeaveImageNode = class extends WeaveNode {
|
|
25828
|
-
imageBitmapCache = {};
|
|
25829
|
-
imageSource = {};
|
|
25830
|
-
imageFallback = {};
|
|
25831
|
-
imageState = {};
|
|
25832
|
-
imageTryoutAttempts = {};
|
|
25833
|
-
imageTryoutIds = {};
|
|
25834
26099
|
nodeType = WEAVE_IMAGE_NODE_TYPE;
|
|
25835
26100
|
cursorsFallback = { loading: "wait" };
|
|
25836
26101
|
cursors = {};
|
|
25837
26102
|
constructor(params) {
|
|
25838
26103
|
super();
|
|
25839
26104
|
const { config } = params ?? {};
|
|
26105
|
+
this.config = mergeExceptArrays(WEAVE_IMAGE_DEFAULT_CONFIG, config);
|
|
26106
|
+
this.initialize();
|
|
26107
|
+
}
|
|
26108
|
+
initialize() {
|
|
25840
26109
|
this.tapStart = {
|
|
25841
26110
|
x: 0,
|
|
25842
26111
|
y: 0,
|
|
25843
26112
|
time: 0
|
|
25844
26113
|
};
|
|
25845
|
-
this.config = mergeExceptArrays(WEAVE_IMAGE_DEFAULT_CONFIG, config);
|
|
25846
26114
|
this.imageCrop = null;
|
|
25847
26115
|
this.imageBitmapCache = {};
|
|
25848
26116
|
this.imageSource = {};
|
|
@@ -26066,7 +26334,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26066
26334
|
};
|
|
26067
26335
|
this.updateImageCrop(image);
|
|
26068
26336
|
} else {
|
|
26069
|
-
this.updatePlaceholderSize(image
|
|
26337
|
+
this.updatePlaceholderSize(image);
|
|
26070
26338
|
this.loadImage(imageProps, image, true);
|
|
26071
26339
|
}
|
|
26072
26340
|
if (this.config.performance.cache.enabled) image.on("transformend", () => {
|
|
@@ -26449,7 +26717,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26449
26717
|
}
|
|
26450
26718
|
this.loadAsyncElement(id);
|
|
26451
26719
|
preloadFunction(id, realImageURL ?? "", {
|
|
26452
|
-
onLoad: () => {
|
|
26720
|
+
onLoad: async () => {
|
|
26453
26721
|
if (useFallback) this.imageTryoutIds[id] = setTimeout(() => {
|
|
26454
26722
|
const node = this.instance.getStage().findOne(`#${id}`);
|
|
26455
26723
|
if (node) {
|
|
@@ -26500,7 +26768,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26500
26768
|
error: false
|
|
26501
26769
|
};
|
|
26502
26770
|
this.updateImageCrop(image);
|
|
26503
|
-
this.resolveAsyncElement(id);
|
|
26771
|
+
if (!useFallback) this.resolveAsyncElement(id);
|
|
26504
26772
|
this.cacheNode(image);
|
|
26505
26773
|
}
|
|
26506
26774
|
},
|
|
@@ -26541,13 +26809,9 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26541
26809
|
}
|
|
26542
26810
|
}, loadTryout);
|
|
26543
26811
|
}
|
|
26544
|
-
updatePlaceholderSize(image
|
|
26812
|
+
updatePlaceholderSize(image) {
|
|
26545
26813
|
const imageAttrs = image.getAttrs();
|
|
26546
26814
|
if (!this.imageState[imageAttrs.id ?? ""]?.loaded) return;
|
|
26547
|
-
if (!imageAttrs.adding && !imageAttrs.cropInfo) {
|
|
26548
|
-
imagePlaceholder.width(imageAttrs.uncroppedImage.width);
|
|
26549
|
-
imagePlaceholder.height(imageAttrs.uncroppedImage.height);
|
|
26550
|
-
}
|
|
26551
26815
|
}
|
|
26552
26816
|
updateImageCrop(image) {
|
|
26553
26817
|
const imageAttrs = image.getAttrs();
|
|
@@ -26681,6 +26945,7 @@ const WEAVE_STAR_NODE_TYPE = "star";
|
|
|
26681
26945
|
//#region src/nodes/star/star.ts
|
|
26682
26946
|
var WeaveStarNode = class extends WeaveNode {
|
|
26683
26947
|
nodeType = WEAVE_STAR_NODE_TYPE;
|
|
26948
|
+
initialize = void 0;
|
|
26684
26949
|
constructor(params) {
|
|
26685
26950
|
super();
|
|
26686
26951
|
const { config } = params ?? {};
|
|
@@ -26766,6 +27031,7 @@ const WEAVE_ARROW_NODE_TYPE = "arrow";
|
|
|
26766
27031
|
//#region src/nodes/arrow/arrow.ts
|
|
26767
27032
|
var WeaveArrowNode = class extends WeaveNode {
|
|
26768
27033
|
nodeType = WEAVE_ARROW_NODE_TYPE;
|
|
27034
|
+
initialize = void 0;
|
|
26769
27035
|
constructor(params) {
|
|
26770
27036
|
super();
|
|
26771
27037
|
const { config } = params ?? {};
|
|
@@ -26822,6 +27088,7 @@ const WEAVE_REGULAR_POLYGON_NODE_TYPE = "regular-polygon";
|
|
|
26822
27088
|
//#region src/nodes/regular-polygon/regular-polygon.ts
|
|
26823
27089
|
var WeaveRegularPolygonNode = class extends WeaveNode {
|
|
26824
27090
|
nodeType = WEAVE_REGULAR_POLYGON_NODE_TYPE;
|
|
27091
|
+
initialize = void 0;
|
|
26825
27092
|
constructor(params) {
|
|
26826
27093
|
super();
|
|
26827
27094
|
const { config } = params ?? {};
|
|
@@ -26935,6 +27202,7 @@ var GroupFrame = class extends Konva.Group {
|
|
|
26935
27202
|
//#region src/nodes/frame/frame.ts
|
|
26936
27203
|
var WeaveFrameNode = class extends WeaveNode {
|
|
26937
27204
|
nodeType = WEAVE_FRAME_NODE_TYPE;
|
|
27205
|
+
initialize = void 0;
|
|
26938
27206
|
constructor(params) {
|
|
26939
27207
|
super();
|
|
26940
27208
|
const { config } = params ?? {};
|
|
@@ -27235,6 +27503,7 @@ const WEAVE_STROKE_NODE_DEFAULT_CONFIG = {
|
|
|
27235
27503
|
//#region src/nodes/stroke/stroke.ts
|
|
27236
27504
|
var WeaveStrokeNode = class extends WeaveNode {
|
|
27237
27505
|
nodeType = WEAVE_STROKE_NODE_TYPE;
|
|
27506
|
+
initialize = void 0;
|
|
27238
27507
|
constructor(params) {
|
|
27239
27508
|
super();
|
|
27240
27509
|
const { config } = params ?? {};
|
|
@@ -27811,8 +28080,6 @@ var WeaveSquareLineTipManager = class extends WeaveBaseLineTipManager {
|
|
|
27811
28080
|
//#endregion
|
|
27812
28081
|
//#region src/nodes/stroke-single/stroke-single.ts
|
|
27813
28082
|
var WeaveStrokeSingleNode = class extends WeaveNode {
|
|
27814
|
-
startHandle = null;
|
|
27815
|
-
endHandle = null;
|
|
27816
28083
|
nodeType = WEAVE_STROKE_SINGLE_NODE_TYPE;
|
|
27817
28084
|
tipManagers = {
|
|
27818
28085
|
[WEAVE_STROKE_SINGLE_NODE_TIP_TYPE.ARROW]: new WeaveArrowLineTipManager(),
|
|
@@ -27823,24 +28090,29 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
|
|
|
27823
28090
|
constructor(params) {
|
|
27824
28091
|
super();
|
|
27825
28092
|
this.config = mergeExceptArrays(WEAVE_STROKE_SINGLE_NODE_DEFAULT_CONFIG, params?.config ?? {});
|
|
27826
|
-
this.handleNodeChanges = null;
|
|
27827
|
-
this.handleZoomChanges = null;
|
|
27828
|
-
this.shiftPressed = false;
|
|
27829
28093
|
this.snapper = new GreedySnapper({
|
|
27830
28094
|
snapAngles: this.config.snapAngles.angles,
|
|
27831
28095
|
activateThreshold: this.config.snapAngles.activateThreshold,
|
|
27832
28096
|
releaseThreshold: this.config.snapAngles.releaseThreshold
|
|
27833
28097
|
});
|
|
28098
|
+
this.initialize();
|
|
28099
|
+
}
|
|
28100
|
+
initialize() {
|
|
27834
28101
|
this.eventsInitialized = false;
|
|
28102
|
+
this.startHandle = null;
|
|
28103
|
+
this.endHandle = null;
|
|
28104
|
+
this.handleNodeChanges = null;
|
|
28105
|
+
this.handleZoomChanges = null;
|
|
28106
|
+
this.shiftPressed = false;
|
|
27835
28107
|
}
|
|
27836
28108
|
initEvents() {
|
|
27837
28109
|
if (this.eventsInitialized) return;
|
|
27838
28110
|
window.addEventListener("keydown", (e) => {
|
|
27839
28111
|
if (e.key === "Shift") this.shiftPressed = true;
|
|
27840
|
-
});
|
|
28112
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
27841
28113
|
window.addEventListener("keyup", (e) => {
|
|
27842
28114
|
if (e.key === "Shift") this.shiftPressed = false;
|
|
27843
|
-
});
|
|
28115
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
27844
28116
|
this.eventsInitialized = true;
|
|
27845
28117
|
}
|
|
27846
28118
|
onRender(props) {
|
|
@@ -28327,6 +28599,9 @@ var WeaveCommentNode = class extends WeaveNode {
|
|
|
28327
28599
|
constructor(params) {
|
|
28328
28600
|
super();
|
|
28329
28601
|
this.config = mergeExceptArrays(WEAVE_COMMENT_NODE_DEFAULTS, params.config);
|
|
28602
|
+
this.initialize();
|
|
28603
|
+
}
|
|
28604
|
+
initialize() {
|
|
28330
28605
|
this.commentDomVisibleId = null;
|
|
28331
28606
|
this.commentDomVisible = false;
|
|
28332
28607
|
this.commentDomAction = null;
|
|
@@ -28955,10 +29230,6 @@ const WEAVE_VIDEO_DEFAULT_CONFIG = {
|
|
|
28955
29230
|
//#endregion
|
|
28956
29231
|
//#region src/nodes/video/video.ts
|
|
28957
29232
|
var WeaveVideoNode = class extends WeaveNode {
|
|
28958
|
-
videoState = {};
|
|
28959
|
-
videoSourceFrameId = {};
|
|
28960
|
-
videoSource = {};
|
|
28961
|
-
videoPlaceholder = {};
|
|
28962
29233
|
nodeType = WEAVE_VIDEO_NODE_TYPE;
|
|
28963
29234
|
constructor(params) {
|
|
28964
29235
|
super();
|
|
@@ -28971,6 +29242,13 @@ var WeaveVideoNode = class extends WeaveNode {
|
|
|
28971
29242
|
this.videoIconImage.src = this.config.style.icon.dataURL;
|
|
28972
29243
|
}
|
|
28973
29244
|
}
|
|
29245
|
+
initialize() {
|
|
29246
|
+
this.videoState = {};
|
|
29247
|
+
this.videoSource = {};
|
|
29248
|
+
this.videoSourceFrameId = {};
|
|
29249
|
+
this.videoPlaceholder = {};
|
|
29250
|
+
this.videoIconImage = void 0;
|
|
29251
|
+
}
|
|
28974
29252
|
async loadPlaceholder(params, video) {
|
|
28975
29253
|
const videoProps = params;
|
|
28976
29254
|
const { id } = videoProps;
|
|
@@ -29465,6 +29743,7 @@ const WEAVE_MEASURE_NODE_DEFAULT_CONFIG = { style: {
|
|
|
29465
29743
|
var WeaveMeasureNode = class extends WeaveNode {
|
|
29466
29744
|
nodeType = WEAVE_MEASURE_NODE_TYPE;
|
|
29467
29745
|
handlePointCircleRadius = 6;
|
|
29746
|
+
initialize = void 0;
|
|
29468
29747
|
constructor(params) {
|
|
29469
29748
|
super();
|
|
29470
29749
|
this.config = mergeExceptArrays(WEAVE_MEASURE_NODE_DEFAULT_CONFIG, params?.config ?? {});
|
|
@@ -30755,6 +31034,7 @@ var WeaveConnectorNode = class extends WeaveNode {
|
|
|
30755
31034
|
[WEAVE_CONNECTOR_NODE_DECORATOR_TYPE.DOT]: setupNodeDecoratorDot,
|
|
30756
31035
|
[WEAVE_CONNECTOR_NODE_DECORATOR_TYPE.ARROW]: setupNodeDecoratorArrow
|
|
30757
31036
|
};
|
|
31037
|
+
initialize = void 0;
|
|
30758
31038
|
constructor(params) {
|
|
30759
31039
|
super();
|
|
30760
31040
|
this.config = mergeExceptArrays(WEAVE_CONNECTOR_NODE_DEFAULT_CONFIG, params?.config);
|
|
@@ -31505,10 +31785,6 @@ const WEAVE_STAGE_ZOOM_DEFAULT_CONFIG = {
|
|
|
31505
31785
|
var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
31506
31786
|
getLayerName = void 0;
|
|
31507
31787
|
initLayer = void 0;
|
|
31508
|
-
pinching = false;
|
|
31509
|
-
zooming = false;
|
|
31510
|
-
isTrackpad = false;
|
|
31511
|
-
zoomVelocity = 0;
|
|
31512
31788
|
zoomInertiaType = WEAVE_STAGE_ZOOM_TYPE.MOUSE_WHEEL;
|
|
31513
31789
|
defaultStep = 3;
|
|
31514
31790
|
constructor(params) {
|
|
@@ -31516,8 +31792,13 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31516
31792
|
const { config } = params ?? {};
|
|
31517
31793
|
this.config = mergeExceptArrays(WEAVE_STAGE_ZOOM_DEFAULT_CONFIG, config);
|
|
31518
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() {
|
|
31519
31798
|
this.pinching = false;
|
|
31799
|
+
this.zooming = false;
|
|
31520
31800
|
this.isTrackpad = false;
|
|
31801
|
+
this.zoomVelocity = 0;
|
|
31521
31802
|
this.isCtrlOrMetaPressed = false;
|
|
31522
31803
|
this.updatedMinimumZoom = false;
|
|
31523
31804
|
this.actualStep = this.config.zoomSteps.findIndex((step) => step === this.config.defaultZoom);
|
|
@@ -31804,6 +32085,15 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31804
32085
|
if (box.width === 0 || box.height === 0) return;
|
|
31805
32086
|
this.fitToElements(box, finalOptions);
|
|
31806
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
|
+
}
|
|
31807
32097
|
enable() {
|
|
31808
32098
|
this.enabled = true;
|
|
31809
32099
|
}
|
|
@@ -31822,10 +32112,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31822
32112
|
initEvents() {
|
|
31823
32113
|
window.addEventListener("keydown", (e) => {
|
|
31824
32114
|
if (e.ctrlKey || e.metaKey) this.isCtrlOrMetaPressed = true;
|
|
31825
|
-
});
|
|
32115
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
31826
32116
|
window.addEventListener("keyup", (e) => {
|
|
31827
32117
|
if (!(e.ctrlKey || e.metaKey)) this.isCtrlOrMetaPressed = false;
|
|
31828
|
-
});
|
|
32118
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
31829
32119
|
const stage = this.instance.getStage();
|
|
31830
32120
|
let lastCenter = null;
|
|
31831
32121
|
let lastDist = 0;
|
|
@@ -31850,7 +32140,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31850
32140
|
return;
|
|
31851
32141
|
}
|
|
31852
32142
|
}
|
|
31853
|
-
}, {
|
|
32143
|
+
}, {
|
|
32144
|
+
passive: false,
|
|
32145
|
+
signal: this.instance.getEventsController()?.signal
|
|
32146
|
+
});
|
|
31854
32147
|
stage.getContent().addEventListener("touchmove", (e) => {
|
|
31855
32148
|
e.preventDefault();
|
|
31856
32149
|
if (e.touches.length === 2) {
|
|
@@ -31890,12 +32183,18 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31890
32183
|
lastDist = dist;
|
|
31891
32184
|
lastCenter = newCenter;
|
|
31892
32185
|
}
|
|
31893
|
-
}, {
|
|
32186
|
+
}, {
|
|
32187
|
+
passive: false,
|
|
32188
|
+
signal: this.instance.getEventsController()?.signal
|
|
32189
|
+
});
|
|
31894
32190
|
stage.getContent().addEventListener("touchend", () => {
|
|
31895
32191
|
this.pinching = false;
|
|
31896
32192
|
lastDist = 0;
|
|
31897
32193
|
lastCenter = null;
|
|
31898
|
-
}, {
|
|
32194
|
+
}, {
|
|
32195
|
+
passive: false,
|
|
32196
|
+
signal: this.instance.getEventsController()?.signal
|
|
32197
|
+
});
|
|
31899
32198
|
let doZoom = false;
|
|
31900
32199
|
const handleWheelImmediate = (e) => {
|
|
31901
32200
|
const performZoom = this.isCtrlOrMetaPressed || !this.isCtrlOrMetaPressed && e.ctrlKey && e.deltaMode === 0;
|
|
@@ -31913,7 +32212,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31913
32212
|
e.preventDefault();
|
|
31914
32213
|
doZoom = true;
|
|
31915
32214
|
};
|
|
31916
|
-
window.addEventListener("wheel", handleWheelImmediate, {
|
|
32215
|
+
window.addEventListener("wheel", handleWheelImmediate, {
|
|
32216
|
+
signal: this.instance.getEventsController()?.signal,
|
|
32217
|
+
passive: false
|
|
32218
|
+
});
|
|
31917
32219
|
const handleWheel = (e) => {
|
|
31918
32220
|
if (!doZoom) return;
|
|
31919
32221
|
const delta = e.deltaY > 0 ? 1 : -1;
|
|
@@ -31926,7 +32228,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31926
32228
|
}
|
|
31927
32229
|
};
|
|
31928
32230
|
const throttledHandleWheel = (0, import_lodash.throttle)(handleWheel, DEFAULT_THROTTLE_MS);
|
|
31929
|
-
window.addEventListener("wheel", throttledHandleWheel, {
|
|
32231
|
+
window.addEventListener("wheel", throttledHandleWheel, {
|
|
32232
|
+
signal: this.instance.getEventsController()?.signal,
|
|
32233
|
+
passive: true
|
|
32234
|
+
});
|
|
31930
32235
|
}
|
|
31931
32236
|
getInertiaScale() {
|
|
31932
32237
|
const stage = this.instance.getStage();
|
|
@@ -31984,6 +32289,7 @@ const ZOOM_OUT_TOOL_ACTION_NAME = "zoomOutTool";
|
|
|
31984
32289
|
//#region src/actions/zoom-out-tool/zoom-out-tool.ts
|
|
31985
32290
|
var WeaveZoomOutToolAction = class extends WeaveAction {
|
|
31986
32291
|
onPropsChange = void 0;
|
|
32292
|
+
initialize = void 0;
|
|
31987
32293
|
getName() {
|
|
31988
32294
|
return ZOOM_OUT_TOOL_ACTION_NAME;
|
|
31989
32295
|
}
|
|
@@ -32018,6 +32324,10 @@ const ZOOM_IN_TOOL_ACTION_NAME = "zoomInTool";
|
|
|
32018
32324
|
//#region src/actions/zoom-in-tool/zoom-in-tool.ts
|
|
32019
32325
|
var WeaveZoomInToolAction = class extends WeaveAction {
|
|
32020
32326
|
onPropsChange = void 0;
|
|
32327
|
+
initialize = void 0;
|
|
32328
|
+
constructor() {
|
|
32329
|
+
super();
|
|
32330
|
+
}
|
|
32021
32331
|
getName() {
|
|
32022
32332
|
return ZOOM_IN_TOOL_ACTION_NAME;
|
|
32023
32333
|
}
|
|
@@ -32052,6 +32362,10 @@ const FIT_TO_SCREEN_TOOL_ACTION_NAME = "fitToScreenTool";
|
|
|
32052
32362
|
//#region src/actions/fit-to-screen-tool/fit-to-screen-tool.ts
|
|
32053
32363
|
var WeaveFitToScreenToolAction = class extends WeaveAction {
|
|
32054
32364
|
onPropsChange = void 0;
|
|
32365
|
+
initialize = void 0;
|
|
32366
|
+
constructor() {
|
|
32367
|
+
super();
|
|
32368
|
+
}
|
|
32055
32369
|
getName() {
|
|
32056
32370
|
return FIT_TO_SCREEN_TOOL_ACTION_NAME;
|
|
32057
32371
|
}
|
|
@@ -32085,6 +32399,10 @@ const FIT_TO_SELECTION_TOOL_ACTION_NAME = "fitToSelectionTool";
|
|
|
32085
32399
|
//#region src/actions/fit-to-selection-tool/fit-to-selection-tool.ts
|
|
32086
32400
|
var WeaveFitToSelectionToolAction = class extends WeaveAction {
|
|
32087
32401
|
onPropsChange = void 0;
|
|
32402
|
+
initialize = void 0;
|
|
32403
|
+
constructor() {
|
|
32404
|
+
super();
|
|
32405
|
+
}
|
|
32088
32406
|
getName() {
|
|
32089
32407
|
return FIT_TO_SELECTION_TOOL_ACTION_NAME;
|
|
32090
32408
|
}
|
|
@@ -32127,6 +32445,9 @@ var WeaveMoveToolAction = class extends WeaveAction {
|
|
|
32127
32445
|
onInit = void 0;
|
|
32128
32446
|
constructor() {
|
|
32129
32447
|
super();
|
|
32448
|
+
this.initialize();
|
|
32449
|
+
}
|
|
32450
|
+
initialize() {
|
|
32130
32451
|
this.initialized = false;
|
|
32131
32452
|
this.state = MOVE_TOOL_STATE.IDLE;
|
|
32132
32453
|
}
|
|
@@ -32140,7 +32461,7 @@ var WeaveMoveToolAction = class extends WeaveAction {
|
|
|
32140
32461
|
this.cancelAction();
|
|
32141
32462
|
return;
|
|
32142
32463
|
}
|
|
32143
|
-
});
|
|
32464
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32144
32465
|
stage.on("pointerdown", () => {
|
|
32145
32466
|
if ([MOVE_TOOL_ACTION_NAME].includes(this.instance.getActiveAction() ?? "")) stage.container().style.cursor = "grabbing";
|
|
32146
32467
|
});
|
|
@@ -32199,6 +32520,9 @@ var WeaveSelectionToolAction = class extends WeaveAction {
|
|
|
32199
32520
|
onInit = void 0;
|
|
32200
32521
|
constructor() {
|
|
32201
32522
|
super();
|
|
32523
|
+
this.initialize();
|
|
32524
|
+
}
|
|
32525
|
+
initialize() {
|
|
32202
32526
|
this.initialized = false;
|
|
32203
32527
|
this.state = SELECTION_TOOL_STATE.IDLE;
|
|
32204
32528
|
}
|
|
@@ -32262,6 +32586,9 @@ var WeaveEraserToolAction = class extends WeaveAction {
|
|
|
32262
32586
|
onInit = void 0;
|
|
32263
32587
|
constructor() {
|
|
32264
32588
|
super();
|
|
32589
|
+
this.initialize();
|
|
32590
|
+
}
|
|
32591
|
+
initialize() {
|
|
32265
32592
|
this.initialized = false;
|
|
32266
32593
|
this.erasing = false;
|
|
32267
32594
|
this.state = ERASER_TOOL_STATE.IDLE;
|
|
@@ -32295,7 +32622,7 @@ var WeaveEraserToolAction = class extends WeaveAction {
|
|
|
32295
32622
|
this.cancelAction();
|
|
32296
32623
|
return;
|
|
32297
32624
|
}
|
|
32298
|
-
});
|
|
32625
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32299
32626
|
this.initialized = true;
|
|
32300
32627
|
}
|
|
32301
32628
|
setState(state) {
|
|
@@ -32362,6 +32689,9 @@ var WeaveRectangleToolAction = class extends WeaveAction {
|
|
|
32362
32689
|
onInit = void 0;
|
|
32363
32690
|
constructor() {
|
|
32364
32691
|
super();
|
|
32692
|
+
this.initialize();
|
|
32693
|
+
}
|
|
32694
|
+
initialize() {
|
|
32365
32695
|
this.pointers = new Map();
|
|
32366
32696
|
this.initialized = false;
|
|
32367
32697
|
this.state = RECTANGLE_TOOL_STATE.IDLE;
|
|
@@ -32397,7 +32727,7 @@ var WeaveRectangleToolAction = class extends WeaveAction {
|
|
|
32397
32727
|
this.cancelAction();
|
|
32398
32728
|
return;
|
|
32399
32729
|
}
|
|
32400
|
-
});
|
|
32730
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32401
32731
|
stage.on("pointermove", () => {
|
|
32402
32732
|
if (this.state === RECTANGLE_TOOL_STATE.IDLE) return;
|
|
32403
32733
|
this.setCursor();
|
|
@@ -32571,6 +32901,9 @@ var WeaveEllipseToolAction = class extends WeaveAction {
|
|
|
32571
32901
|
onInit = void 0;
|
|
32572
32902
|
constructor() {
|
|
32573
32903
|
super();
|
|
32904
|
+
this.initialize();
|
|
32905
|
+
}
|
|
32906
|
+
initialize() {
|
|
32574
32907
|
this.pointers = new Map();
|
|
32575
32908
|
this.initialized = false;
|
|
32576
32909
|
this.state = ELLIPSE_TOOL_STATE.IDLE;
|
|
@@ -32606,7 +32939,7 @@ var WeaveEllipseToolAction = class extends WeaveAction {
|
|
|
32606
32939
|
this.cancelAction();
|
|
32607
32940
|
return;
|
|
32608
32941
|
}
|
|
32609
|
-
});
|
|
32942
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32610
32943
|
stage.on("pointerdown", (e) => {
|
|
32611
32944
|
this.setTapStart(e);
|
|
32612
32945
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -32787,6 +33120,9 @@ var WeavePenToolAction = class extends WeaveAction {
|
|
|
32787
33120
|
onInit = void 0;
|
|
32788
33121
|
constructor() {
|
|
32789
33122
|
super();
|
|
33123
|
+
this.initialize();
|
|
33124
|
+
}
|
|
33125
|
+
initialize() {
|
|
32790
33126
|
this.pointers = new Map();
|
|
32791
33127
|
this.initialized = false;
|
|
32792
33128
|
this.state = PEN_TOOL_STATE.IDLE;
|
|
@@ -32822,7 +33158,7 @@ var WeavePenToolAction = class extends WeaveAction {
|
|
|
32822
33158
|
this.cancelAction();
|
|
32823
33159
|
return;
|
|
32824
33160
|
}
|
|
32825
|
-
});
|
|
33161
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32826
33162
|
stage.on("pointerdown", (e) => {
|
|
32827
33163
|
this.setTapStart(e);
|
|
32828
33164
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -33059,6 +33395,9 @@ var WeaveLineToolAction = class extends WeaveAction {
|
|
|
33059
33395
|
constructor(params) {
|
|
33060
33396
|
super();
|
|
33061
33397
|
this.config = mergeExceptArrays(LINE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
|
|
33398
|
+
this.initialize();
|
|
33399
|
+
}
|
|
33400
|
+
initialize() {
|
|
33062
33401
|
this.pointers = new Map();
|
|
33063
33402
|
this.initialized = false;
|
|
33064
33403
|
this.state = LINE_TOOL_STATE.IDLE;
|
|
@@ -33103,13 +33442,13 @@ var WeaveLineToolAction = class extends WeaveAction {
|
|
|
33103
33442
|
this.snappedAngle = null;
|
|
33104
33443
|
this.shiftPressed = true;
|
|
33105
33444
|
}
|
|
33106
|
-
});
|
|
33445
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33107
33446
|
window.addEventListener("keyup", (e) => {
|
|
33108
33447
|
if (e.key === "Shift" && this.instance.getActiveAction() === LINE_TOOL_ACTION_NAME) {
|
|
33109
33448
|
this.snappedAngle = null;
|
|
33110
33449
|
this.shiftPressed = false;
|
|
33111
33450
|
}
|
|
33112
|
-
});
|
|
33451
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33113
33452
|
stage.on("pointerdown", (e) => {
|
|
33114
33453
|
this.setTapStart(e);
|
|
33115
33454
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -33324,6 +33663,9 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
33324
33663
|
constructor(params) {
|
|
33325
33664
|
super();
|
|
33326
33665
|
this.config = mergeExceptArrays(BRUSH_TOOL_DEFAULT_CONFIG, params?.config ?? {});
|
|
33666
|
+
this.initialize();
|
|
33667
|
+
}
|
|
33668
|
+
initialize() {
|
|
33327
33669
|
this.initialized = false;
|
|
33328
33670
|
this.state = BRUSH_TOOL_STATE.INACTIVE;
|
|
33329
33671
|
this.strokeId = null;
|
|
@@ -33352,7 +33694,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
33352
33694
|
const stage = this.instance.getStage();
|
|
33353
33695
|
window.addEventListener("keyup", (e) => {
|
|
33354
33696
|
if (e.code === "Space" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) this.isSpacePressed = false;
|
|
33355
|
-
});
|
|
33697
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33356
33698
|
window.addEventListener("keydown", (e) => {
|
|
33357
33699
|
if (e.code === "Enter" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) {
|
|
33358
33700
|
e.stopPropagation();
|
|
@@ -33368,7 +33710,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
33368
33710
|
e.stopPropagation();
|
|
33369
33711
|
this.cancelAction();
|
|
33370
33712
|
}
|
|
33371
|
-
});
|
|
33713
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33372
33714
|
const handlePointerDown = (e) => {
|
|
33373
33715
|
if (this.state === BRUSH_TOOL_STATE.INACTIVE) return;
|
|
33374
33716
|
if (this.state !== BRUSH_TOOL_STATE.IDLE) return;
|
|
@@ -33577,6 +33919,9 @@ var WeaveTextToolAction = class extends WeaveAction {
|
|
|
33577
33919
|
onInit = void 0;
|
|
33578
33920
|
constructor() {
|
|
33579
33921
|
super();
|
|
33922
|
+
this.initialize();
|
|
33923
|
+
}
|
|
33924
|
+
initialize() {
|
|
33580
33925
|
this.initialized = false;
|
|
33581
33926
|
this.state = TEXT_TOOL_STATE.IDLE;
|
|
33582
33927
|
this.textId = null;
|
|
@@ -33606,7 +33951,7 @@ var WeaveTextToolAction = class extends WeaveAction {
|
|
|
33606
33951
|
this.cancelAction();
|
|
33607
33952
|
return;
|
|
33608
33953
|
}
|
|
33609
|
-
});
|
|
33954
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33610
33955
|
stage.on("pointermove", () => {
|
|
33611
33956
|
if (this.state === TEXT_TOOL_STATE.IDLE) return;
|
|
33612
33957
|
this.setCursor();
|
|
@@ -33734,6 +34079,9 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
33734
34079
|
constructor(params) {
|
|
33735
34080
|
super();
|
|
33736
34081
|
this.config = mergeExceptArrays(WEAVE_IMAGE_TOOL_CONFIG_DEFAULT, params?.config ?? {});
|
|
34082
|
+
this.initialize();
|
|
34083
|
+
}
|
|
34084
|
+
initialize() {
|
|
33737
34085
|
this.pointers = new Map();
|
|
33738
34086
|
this.initialized = false;
|
|
33739
34087
|
this.imageId = null;
|
|
@@ -33777,7 +34125,7 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
33777
34125
|
this.cancelAction();
|
|
33778
34126
|
return;
|
|
33779
34127
|
}
|
|
33780
|
-
});
|
|
34128
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33781
34129
|
stage.on("pointerdown", (e) => {
|
|
33782
34130
|
this.setTapStart(e);
|
|
33783
34131
|
if (this.ignorePointerEvents) return;
|
|
@@ -34174,6 +34522,9 @@ var WeaveImagesToolAction = class extends WeaveAction {
|
|
|
34174
34522
|
constructor(params) {
|
|
34175
34523
|
super();
|
|
34176
34524
|
this.config = mergeExceptArrays(WEAVE_IMAGES_TOOL_DEFAULT_CONFIG, params ?? {});
|
|
34525
|
+
this.initialize();
|
|
34526
|
+
}
|
|
34527
|
+
initialize() {
|
|
34177
34528
|
this.pointers = new Map();
|
|
34178
34529
|
this.initialized = false;
|
|
34179
34530
|
this.tempPointerFeedbackNode = null;
|
|
@@ -34220,7 +34571,7 @@ var WeaveImagesToolAction = class extends WeaveAction {
|
|
|
34220
34571
|
const stage = this.instance.getStage();
|
|
34221
34572
|
stage.container().addEventListener("keydown", (e) => {
|
|
34222
34573
|
if (e.key === "Escape" && this.instance.getActiveAction() === WEAVE_IMAGES_TOOL_ACTION_NAME) this.cancelAction();
|
|
34223
|
-
});
|
|
34574
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
34224
34575
|
stage.on("pointerdown", (e) => {
|
|
34225
34576
|
this.setTapStart(e);
|
|
34226
34577
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -34602,6 +34953,9 @@ var WeaveStarToolAction = class extends WeaveAction {
|
|
|
34602
34953
|
onInit = void 0;
|
|
34603
34954
|
constructor() {
|
|
34604
34955
|
super();
|
|
34956
|
+
this.initialize();
|
|
34957
|
+
}
|
|
34958
|
+
initialize() {
|
|
34605
34959
|
this.pointers = new Map();
|
|
34606
34960
|
this.initialized = false;
|
|
34607
34961
|
this.state = STAR_TOOL_STATE.IDLE;
|
|
@@ -34638,7 +34992,7 @@ var WeaveStarToolAction = class extends WeaveAction {
|
|
|
34638
34992
|
this.cancelAction();
|
|
34639
34993
|
return;
|
|
34640
34994
|
}
|
|
34641
|
-
});
|
|
34995
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
34642
34996
|
stage.on("pointerdown", (e) => {
|
|
34643
34997
|
this.setTapStart(e);
|
|
34644
34998
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -34803,8 +35157,8 @@ var WeaveStarToolAction = class extends WeaveAction {
|
|
|
34803
35157
|
|
|
34804
35158
|
//#endregion
|
|
34805
35159
|
//#region src/actions/arrow-tool/constants.ts
|
|
34806
|
-
const
|
|
34807
|
-
const
|
|
35160
|
+
const WEAVE_ARROW_TOOL_ACTION_NAME = "arrowTool";
|
|
35161
|
+
const WEAVE_ARROW_TOOL_STATE = {
|
|
34808
35162
|
["IDLE"]: "idle",
|
|
34809
35163
|
["ADDING"]: "adding",
|
|
34810
35164
|
["DEFINING_SIZE"]: "definingSize",
|
|
@@ -34820,9 +35174,12 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34820
35174
|
onInit = void 0;
|
|
34821
35175
|
constructor() {
|
|
34822
35176
|
super();
|
|
35177
|
+
this.initialize();
|
|
35178
|
+
}
|
|
35179
|
+
initialize() {
|
|
34823
35180
|
this.pointers = new Map();
|
|
34824
35181
|
this.initialized = false;
|
|
34825
|
-
this.state =
|
|
35182
|
+
this.state = WEAVE_ARROW_TOOL_STATE.IDLE;
|
|
34826
35183
|
this.arrowId = null;
|
|
34827
35184
|
this.tempArrowId = null;
|
|
34828
35185
|
this.tempMainArrowNode = null;
|
|
@@ -34835,7 +35192,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34835
35192
|
this.props = this.initProps();
|
|
34836
35193
|
}
|
|
34837
35194
|
getName() {
|
|
34838
|
-
return
|
|
35195
|
+
return WEAVE_ARROW_TOOL_ACTION_NAME;
|
|
34839
35196
|
}
|
|
34840
35197
|
initProps() {
|
|
34841
35198
|
return {
|
|
@@ -34852,40 +35209,37 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34852
35209
|
setupEvents() {
|
|
34853
35210
|
const stage = this.instance.getStage();
|
|
34854
35211
|
window.addEventListener("keydown", (e) => {
|
|
34855
|
-
if (e.code === "Enter" && this.instance.getActiveAction() ===
|
|
35212
|
+
if (e.code === "Enter" && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
|
|
34856
35213
|
this.cancelAction();
|
|
34857
35214
|
return;
|
|
34858
35215
|
}
|
|
34859
|
-
if (e.code === "Escape" && this.instance.getActiveAction() ===
|
|
34860
|
-
|
|
34861
|
-
return;
|
|
34862
|
-
}
|
|
34863
|
-
});
|
|
35216
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) this.cancelAction();
|
|
35217
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
34864
35218
|
stage.on("pointerdown", (e) => {
|
|
34865
35219
|
this.setTapStart(e);
|
|
34866
35220
|
this.pointers.set(e.evt.pointerId, {
|
|
34867
35221
|
x: e.evt.clientX,
|
|
34868
35222
|
y: e.evt.clientY
|
|
34869
35223
|
});
|
|
34870
|
-
if (this.pointers.size === 2 && this.instance.getActiveAction() ===
|
|
34871
|
-
this.state =
|
|
35224
|
+
if (this.pointers.size === 2 && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
|
|
35225
|
+
this.state = WEAVE_ARROW_TOOL_STATE.ADDING;
|
|
34872
35226
|
return;
|
|
34873
35227
|
}
|
|
34874
|
-
if (!this.tempMainArrowNode && this.state ===
|
|
34875
|
-
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;
|
|
34876
35230
|
});
|
|
34877
35231
|
stage.on("pointermove", () => {
|
|
34878
|
-
if (this.state ===
|
|
35232
|
+
if (this.state === WEAVE_ARROW_TOOL_STATE.IDLE) return;
|
|
34879
35233
|
this.setCursor();
|
|
34880
|
-
if (this.pointers.size === 2 && this.instance.getActiveAction() ===
|
|
34881
|
-
this.state =
|
|
35234
|
+
if (this.pointers.size === 2 && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
|
|
35235
|
+
this.state = WEAVE_ARROW_TOOL_STATE.ADDING;
|
|
34882
35236
|
return;
|
|
34883
35237
|
}
|
|
34884
|
-
if (this.state ===
|
|
35238
|
+
if (this.state === WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) this.handleMovement();
|
|
34885
35239
|
});
|
|
34886
35240
|
stage.on("pointerup", (e) => {
|
|
34887
35241
|
this.pointers.delete(e.evt.pointerId);
|
|
34888
|
-
if (this.state ===
|
|
35242
|
+
if (this.state === WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) this.handleSettingSize();
|
|
34889
35243
|
});
|
|
34890
35244
|
this.initialized = true;
|
|
34891
35245
|
}
|
|
@@ -34899,7 +35253,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34899
35253
|
this.tempPoint = void 0;
|
|
34900
35254
|
this.tempNextPoint = void 0;
|
|
34901
35255
|
this.clickPoint = null;
|
|
34902
|
-
this.setState(
|
|
35256
|
+
this.setState(WEAVE_ARROW_TOOL_STATE.ADDING);
|
|
34903
35257
|
}
|
|
34904
35258
|
handleAdding() {
|
|
34905
35259
|
const stage = this.instance.getStage();
|
|
@@ -34950,7 +35304,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34950
35304
|
this.measureContainer?.add(this.tempNextPoint);
|
|
34951
35305
|
this.tempPoint.moveToTop();
|
|
34952
35306
|
this.tempNextPoint.moveToTop();
|
|
34953
|
-
this.setState(
|
|
35307
|
+
this.setState(WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE);
|
|
34954
35308
|
}
|
|
34955
35309
|
}
|
|
34956
35310
|
handleSettingSize() {
|
|
@@ -34977,11 +35331,11 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34977
35331
|
y: mousePoint.y,
|
|
34978
35332
|
points: [0, 0]
|
|
34979
35333
|
});
|
|
34980
|
-
this.setState(
|
|
35334
|
+
this.setState(WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE);
|
|
34981
35335
|
}
|
|
34982
35336
|
}
|
|
34983
35337
|
handleMovement() {
|
|
34984
|
-
if (this.state !==
|
|
35338
|
+
if (this.state !== WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) return;
|
|
34985
35339
|
if (this.arrowId && this.tempArrowNode && this.measureContainer && this.tempNextPoint) {
|
|
34986
35340
|
const { mousePoint } = this.instance.getMousePointerRelativeToContainer(this.measureContainer);
|
|
34987
35341
|
this.tempArrowNode.setAttrs({
|
|
@@ -35048,7 +35402,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
35048
35402
|
this.container = void 0;
|
|
35049
35403
|
this.measureContainer = void 0;
|
|
35050
35404
|
this.clickPoint = null;
|
|
35051
|
-
this.setState(
|
|
35405
|
+
this.setState(WEAVE_ARROW_TOOL_STATE.IDLE);
|
|
35052
35406
|
}
|
|
35053
35407
|
setCursor() {
|
|
35054
35408
|
const stage = this.instance.getStage();
|
|
@@ -35092,13 +35446,15 @@ const WEAVE_STROKE_TOOL_DEFAULT_CONFIG = { snapAngles: {
|
|
|
35092
35446
|
var WeaveStrokeToolAction = class extends WeaveAction {
|
|
35093
35447
|
initialized = false;
|
|
35094
35448
|
initialCursor = null;
|
|
35095
|
-
snappedAngle = null;
|
|
35096
35449
|
shiftPressed = false;
|
|
35097
35450
|
onPropsChange = void 0;
|
|
35098
35451
|
onInit = void 0;
|
|
35099
35452
|
constructor(params) {
|
|
35100
35453
|
super();
|
|
35101
35454
|
this.config = mergeExceptArrays(WEAVE_STROKE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
|
|
35455
|
+
this.initialize();
|
|
35456
|
+
}
|
|
35457
|
+
initialize() {
|
|
35102
35458
|
this.pointers = new Map();
|
|
35103
35459
|
this.initialized = false;
|
|
35104
35460
|
this.state = WEAVE_STROKE_TOOL_STATE.IDLE;
|
|
@@ -35107,7 +35463,6 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35107
35463
|
this.tempLineId = null;
|
|
35108
35464
|
this.tempLineNode = null;
|
|
35109
35465
|
this.container = void 0;
|
|
35110
|
-
this.snappedAngle = null;
|
|
35111
35466
|
this.measureContainer = void 0;
|
|
35112
35467
|
this.clickPoint = null;
|
|
35113
35468
|
this.snapper = new GreedySnapper({
|
|
@@ -35120,6 +35475,9 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35120
35475
|
getName() {
|
|
35121
35476
|
return WEAVE_STROKE_TOOL_ACTION_NAME;
|
|
35122
35477
|
}
|
|
35478
|
+
getNames() {
|
|
35479
|
+
return [WEAVE_STROKE_TOOL_ACTION_NAME, ...WEAVE_STROKE_TOOL_ACTION_NAME_ALIASES];
|
|
35480
|
+
}
|
|
35123
35481
|
hasAliases() {
|
|
35124
35482
|
return true;
|
|
35125
35483
|
}
|
|
@@ -35138,32 +35496,26 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35138
35496
|
setupEvents() {
|
|
35139
35497
|
const stage = this.instance.getStage();
|
|
35140
35498
|
window.addEventListener("keydown", (e) => {
|
|
35141
|
-
if (e.code === "Enter" && this.instance.getActiveAction()
|
|
35499
|
+
if (e.code === "Enter" && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
|
|
35142
35500
|
this.cancelAction();
|
|
35143
35501
|
return;
|
|
35144
35502
|
}
|
|
35145
|
-
if (e.code === "Escape" && this.instance.getActiveAction()
|
|
35503
|
+
if (e.code === "Escape" && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
|
|
35146
35504
|
this.cancelAction();
|
|
35147
35505
|
return;
|
|
35148
35506
|
}
|
|
35149
|
-
if (e.key === "Shift" && this.instance.getActiveAction()
|
|
35150
|
-
|
|
35151
|
-
this.shiftPressed = true;
|
|
35152
|
-
}
|
|
35153
|
-
});
|
|
35507
|
+
if (e.key === "Shift" && this.getNames().includes(this.instance.getActiveAction() ?? "")) this.shiftPressed = true;
|
|
35508
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35154
35509
|
window.addEventListener("keyup", (e) => {
|
|
35155
|
-
if (e.key === "Shift" && this.instance.getActiveAction()
|
|
35156
|
-
|
|
35157
|
-
this.shiftPressed = false;
|
|
35158
|
-
}
|
|
35159
|
-
});
|
|
35510
|
+
if (e.key === "Shift" && this.getNames().includes(this.instance.getActiveAction() ?? "")) this.shiftPressed = false;
|
|
35511
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35160
35512
|
stage.on("pointerdown", (e) => {
|
|
35161
35513
|
this.setTapStart(e);
|
|
35162
35514
|
this.pointers.set(e.evt.pointerId, {
|
|
35163
35515
|
x: e.evt.clientX,
|
|
35164
35516
|
y: e.evt.clientY
|
|
35165
35517
|
});
|
|
35166
|
-
if (this.pointers.size === 2 && this.instance.getActiveAction()
|
|
35518
|
+
if (this.pointers.size === 2 && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
|
|
35167
35519
|
this.state = WEAVE_STROKE_TOOL_STATE.ADDING;
|
|
35168
35520
|
return;
|
|
35169
35521
|
}
|
|
@@ -35173,7 +35525,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35173
35525
|
stage.on("pointermove", () => {
|
|
35174
35526
|
if (this.state === WEAVE_STROKE_TOOL_STATE.IDLE) return;
|
|
35175
35527
|
this.setCursor();
|
|
35176
|
-
if (this.pointers.size === 2 && this.instance.getActiveAction()
|
|
35528
|
+
if (this.pointers.size === 2 && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
|
|
35177
35529
|
this.state = WEAVE_STROKE_TOOL_STATE.ADDING;
|
|
35178
35530
|
return;
|
|
35179
35531
|
}
|
|
@@ -35191,7 +35543,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35191
35543
|
addLine() {
|
|
35192
35544
|
this.setCursor();
|
|
35193
35545
|
this.setFocusStage();
|
|
35194
|
-
this.instance.emitEvent("onAddingStroke", { actionName: this.instance.getActiveAction() ??
|
|
35546
|
+
this.instance.emitEvent("onAddingStroke", { actionName: this.instance.getActiveAction() ?? "not-defined" });
|
|
35195
35547
|
this.shiftPressed = false;
|
|
35196
35548
|
this.clickPoint = null;
|
|
35197
35549
|
this.setState(WEAVE_STROKE_TOOL_STATE.ADDING);
|
|
@@ -35299,7 +35651,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35299
35651
|
});
|
|
35300
35652
|
delete finalLine.props.dragBoundFunc;
|
|
35301
35653
|
this.instance.addNode(finalLine, this.container?.getAttrs().id);
|
|
35302
|
-
this.instance.emitEvent("onAddedStroke", { actionName: this.instance.getActiveAction() ??
|
|
35654
|
+
this.instance.emitEvent("onAddedStroke", { actionName: this.instance.getActiveAction() ?? "not-defined" });
|
|
35303
35655
|
nodeCreated = true;
|
|
35304
35656
|
}
|
|
35305
35657
|
}
|
|
@@ -35349,6 +35701,9 @@ var WeaveRegularPolygonToolAction = class extends WeaveAction {
|
|
|
35349
35701
|
onInit = void 0;
|
|
35350
35702
|
constructor() {
|
|
35351
35703
|
super();
|
|
35704
|
+
this.initialize();
|
|
35705
|
+
}
|
|
35706
|
+
initialize() {
|
|
35352
35707
|
this.pointers = new Map();
|
|
35353
35708
|
this.initialized = false;
|
|
35354
35709
|
this.state = REGULAR_POLYGON_TOOL_STATE.IDLE;
|
|
@@ -35383,7 +35738,7 @@ var WeaveRegularPolygonToolAction = class extends WeaveAction {
|
|
|
35383
35738
|
this.cancelAction();
|
|
35384
35739
|
return;
|
|
35385
35740
|
}
|
|
35386
|
-
});
|
|
35741
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35387
35742
|
stage.on("pointerdown", (e) => {
|
|
35388
35743
|
this.setTapStart(e);
|
|
35389
35744
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -35557,6 +35912,9 @@ var WeaveFrameToolAction = class extends WeaveAction {
|
|
|
35557
35912
|
onInit = void 0;
|
|
35558
35913
|
constructor() {
|
|
35559
35914
|
super();
|
|
35915
|
+
this.initialize();
|
|
35916
|
+
}
|
|
35917
|
+
initialize() {
|
|
35560
35918
|
this.initialized = false;
|
|
35561
35919
|
this.state = FRAME_TOOL_STATE.IDLE;
|
|
35562
35920
|
this.frameId = null;
|
|
@@ -35584,7 +35942,7 @@ var WeaveFrameToolAction = class extends WeaveAction {
|
|
|
35584
35942
|
this.cancelAction();
|
|
35585
35943
|
return;
|
|
35586
35944
|
}
|
|
35587
|
-
});
|
|
35945
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35588
35946
|
stage.on("pointermove", () => {
|
|
35589
35947
|
if (this.state === FRAME_TOOL_STATE.IDLE) return;
|
|
35590
35948
|
this.setCursor();
|
|
@@ -35686,6 +36044,10 @@ var WeaveExportStageToolAction = class extends WeaveAction {
|
|
|
35686
36044
|
};
|
|
35687
36045
|
onPropsChange = void 0;
|
|
35688
36046
|
onInit = void 0;
|
|
36047
|
+
initialize = void 0;
|
|
36048
|
+
constructor() {
|
|
36049
|
+
super();
|
|
36050
|
+
}
|
|
35689
36051
|
getName() {
|
|
35690
36052
|
return EXPORT_STAGE_TOOL_ACTION_NAME;
|
|
35691
36053
|
}
|
|
@@ -35733,6 +36095,10 @@ var WeaveExportNodesToolAction = class extends WeaveAction {
|
|
|
35733
36095
|
};
|
|
35734
36096
|
onPropsChange = void 0;
|
|
35735
36097
|
onInit = void 0;
|
|
36098
|
+
initialize = void 0;
|
|
36099
|
+
constructor() {
|
|
36100
|
+
super();
|
|
36101
|
+
}
|
|
35736
36102
|
getName() {
|
|
35737
36103
|
return EXPORT_NODES_TOOL_ACTION_NAME;
|
|
35738
36104
|
}
|
|
@@ -35785,6 +36151,9 @@ var WeaveAlignNodesToolAction = class extends WeaveAction {
|
|
|
35785
36151
|
onInit = void 0;
|
|
35786
36152
|
constructor() {
|
|
35787
36153
|
super();
|
|
36154
|
+
this.initialize();
|
|
36155
|
+
}
|
|
36156
|
+
initialize() {
|
|
35788
36157
|
this.initialized = false;
|
|
35789
36158
|
this.state = ALIGN_NODES_TOOL_STATE.IDLE;
|
|
35790
36159
|
}
|
|
@@ -36034,6 +36403,9 @@ var WeaveCommentToolAction = class extends WeaveAction {
|
|
|
36034
36403
|
super();
|
|
36035
36404
|
const { config } = params ?? {};
|
|
36036
36405
|
this.config = mergeExceptArrays(WEAVE_COMMENT_TOOL_DEFAULT_CONFIG, config);
|
|
36406
|
+
this.initialize();
|
|
36407
|
+
}
|
|
36408
|
+
initialize() {
|
|
36037
36409
|
this.pointers = new Map();
|
|
36038
36410
|
this.initialized = false;
|
|
36039
36411
|
this.state = WEAVE_COMMENT_TOOL_STATE.IDLE;
|
|
@@ -36111,7 +36483,7 @@ var WeaveCommentToolAction = class extends WeaveAction {
|
|
|
36111
36483
|
return;
|
|
36112
36484
|
}
|
|
36113
36485
|
if (e.code === "Escape" && this.state === WEAVE_COMMENT_TOOL_STATE.CREATING_COMMENT) this.setState(WEAVE_COMMENT_TOOL_STATE.ADDING);
|
|
36114
|
-
});
|
|
36486
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
36115
36487
|
stage.on("pointermove", (e) => {
|
|
36116
36488
|
if (this.state === WEAVE_COMMENT_TOOL_STATE.IDLE) return;
|
|
36117
36489
|
if (commentNodeHandler?.isCommentViewing()) {
|
|
@@ -36262,6 +36634,9 @@ var WeaveVideoToolAction = class extends WeaveAction {
|
|
|
36262
36634
|
update = void 0;
|
|
36263
36635
|
constructor() {
|
|
36264
36636
|
super();
|
|
36637
|
+
this.initialize();
|
|
36638
|
+
}
|
|
36639
|
+
initialize() {
|
|
36265
36640
|
this.pointers = new Map();
|
|
36266
36641
|
this.initialized = false;
|
|
36267
36642
|
this.state = VIDEO_TOOL_STATE.IDLE;
|
|
@@ -36308,7 +36683,7 @@ var WeaveVideoToolAction = class extends WeaveAction {
|
|
|
36308
36683
|
this.cancelAction();
|
|
36309
36684
|
return;
|
|
36310
36685
|
}
|
|
36311
|
-
});
|
|
36686
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
36312
36687
|
stage.on("pointerdown", (e) => {
|
|
36313
36688
|
this.setTapStart(e);
|
|
36314
36689
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -36441,6 +36816,9 @@ var WeaveMeasureToolAction = class extends WeaveAction {
|
|
|
36441
36816
|
constructor(params) {
|
|
36442
36817
|
super();
|
|
36443
36818
|
this.config = mergeExceptArrays(WEAVE_MEASURE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
|
|
36819
|
+
this.initialize();
|
|
36820
|
+
}
|
|
36821
|
+
initialize() {
|
|
36444
36822
|
this.initialized = false;
|
|
36445
36823
|
this.state = MEASURE_TOOL_STATE.IDLE;
|
|
36446
36824
|
this.measureId = null;
|
|
@@ -36467,7 +36845,7 @@ var WeaveMeasureToolAction = class extends WeaveAction {
|
|
|
36467
36845
|
const stage = this.instance.getStage();
|
|
36468
36846
|
window.addEventListener("keydown", (e) => {
|
|
36469
36847
|
if (e.code === "Escape" && this.instance.getActiveAction() === MEASURE_TOOL_ACTION_NAME) this.cancelAction();
|
|
36470
|
-
});
|
|
36848
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
36471
36849
|
stage.on("pointermove", () => {
|
|
36472
36850
|
if (this.state === MEASURE_TOOL_STATE.IDLE) return;
|
|
36473
36851
|
if (this.state === MEASURE_TOOL_STATE.SET_TO) {
|
|
@@ -36737,6 +37115,9 @@ var WeaveConnectorToolAction = class extends WeaveAction {
|
|
|
36737
37115
|
constructor(params) {
|
|
36738
37116
|
super();
|
|
36739
37117
|
this.config = mergeExceptArrays(CONNECTOR_TOOL_DEFAULT_CONFIG, params?.config);
|
|
37118
|
+
this.initialize();
|
|
37119
|
+
}
|
|
37120
|
+
initialize() {
|
|
36740
37121
|
this.pointers = new Map();
|
|
36741
37122
|
this.initialized = false;
|
|
36742
37123
|
this.tempLineNode = null;
|
|
@@ -36775,7 +37156,7 @@ var WeaveConnectorToolAction = class extends WeaveAction {
|
|
|
36775
37156
|
return;
|
|
36776
37157
|
}
|
|
36777
37158
|
if (e.code === "Escape" && this.instance.getActiveAction() === CONNECTOR_TOOL_ACTION_NAME) this.cancelAction();
|
|
36778
|
-
});
|
|
37159
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
36779
37160
|
let nodeHovered = void 0;
|
|
36780
37161
|
stage.on("pointermove", () => {
|
|
36781
37162
|
if (!(this.state === CONNECTOR_TOOL_STATE.SELECTING_INITIAL || this.state === CONNECTOR_TOOL_STATE.SELECTING_FINAL)) return;
|
|
@@ -37090,25 +37471,25 @@ var WeaveConnectorToolAction = class extends WeaveAction {
|
|
|
37090
37471
|
//#endregion
|
|
37091
37472
|
//#region src/plugins/stage-grid/stage-grid.ts
|
|
37092
37473
|
var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
37093
|
-
actStageZoomX = 1;
|
|
37094
|
-
actStageZoomY = 1;
|
|
37095
|
-
actStagePosX = 0;
|
|
37096
|
-
actStagePosY = 0;
|
|
37097
37474
|
constructor(params) {
|
|
37098
37475
|
super();
|
|
37099
37476
|
const { config } = params ?? {};
|
|
37100
37477
|
this.moveToolActive = false;
|
|
37101
37478
|
this.isMouseMiddleButtonPressed = false;
|
|
37102
37479
|
this.isSpaceKeyPressed = false;
|
|
37103
|
-
this.config = {
|
|
37104
|
-
type: WEAVE_GRID_DEFAULT_TYPE,
|
|
37105
|
-
gridColor: WEAVE_GRID_DEFAULT_COLOR,
|
|
37106
|
-
gridOriginColor: WEAVE_GRID_DEFAULT_ORIGIN_COLOR,
|
|
37107
|
-
gridSize: WEAVE_GRID_DEFAULT_SIZE,
|
|
37108
|
-
gridDotMaxDotsPerAxis: WEAVE_GRID_DEFAULT_DOT_MAX_DOTS_PER_AXIS,
|
|
37109
|
-
...config
|
|
37110
|
-
};
|
|
37111
37480
|
this.forceStageChange = false;
|
|
37481
|
+
this.config = mergeExceptArrays(WEAVE_GRID_DEFAULT_CONFIG, config);
|
|
37482
|
+
this.initialize();
|
|
37483
|
+
}
|
|
37484
|
+
initialize() {
|
|
37485
|
+
this.moveToolActive = false;
|
|
37486
|
+
this.isMouseMiddleButtonPressed = false;
|
|
37487
|
+
this.isSpaceKeyPressed = false;
|
|
37488
|
+
this.forceStageChange = false;
|
|
37489
|
+
this.actStagePosX = 0;
|
|
37490
|
+
this.actStagePosY = 0;
|
|
37491
|
+
this.actStageZoomX = 1;
|
|
37492
|
+
this.actStageZoomY = 1;
|
|
37112
37493
|
}
|
|
37113
37494
|
getName() {
|
|
37114
37495
|
return WEAVE_STAGE_GRID_PLUGIN_KEY;
|
|
@@ -37133,10 +37514,10 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37133
37514
|
const stage = this.instance.getStage();
|
|
37134
37515
|
window.addEventListener("keydown", (e) => {
|
|
37135
37516
|
if (e.code === "Space") this.isSpaceKeyPressed = true;
|
|
37136
|
-
});
|
|
37517
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37137
37518
|
window.addEventListener("keyup", (e) => {
|
|
37138
37519
|
if (e.code === "Space") this.isSpaceKeyPressed = false;
|
|
37139
|
-
});
|
|
37520
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37140
37521
|
this.instance.addEventListener("onStageMove", () => {
|
|
37141
37522
|
this.onRender();
|
|
37142
37523
|
});
|
|
@@ -37164,10 +37545,14 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37164
37545
|
const layer = stage.findOne(`#${WEAVE_GRID_LAYER_ID}`);
|
|
37165
37546
|
return layer;
|
|
37166
37547
|
}
|
|
37548
|
+
getShapeAdaptiveSpacing(baseSpacing, scale) {
|
|
37549
|
+
const factor = Math.pow(2, Math.floor(Math.log2(1 / scale)));
|
|
37550
|
+
return baseSpacing * factor;
|
|
37551
|
+
}
|
|
37167
37552
|
getAdaptiveSpacing(scale) {
|
|
37168
37553
|
const baseGridSpacing = this.config.gridSize;
|
|
37169
|
-
const minPixelSpacing =
|
|
37170
|
-
const maxPixelSpacing =
|
|
37554
|
+
const minPixelSpacing = this.config.gridSize;
|
|
37555
|
+
const maxPixelSpacing = this.config.gridSize * 2;
|
|
37171
37556
|
let spacing = baseGridSpacing;
|
|
37172
37557
|
let pixelSpacing = spacing * scale;
|
|
37173
37558
|
while (pixelSpacing < minPixelSpacing) {
|
|
@@ -37182,17 +37567,6 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37182
37567
|
const snappedSpacing = baseGridSpacing * Math.pow(2, logFactor);
|
|
37183
37568
|
return snappedSpacing;
|
|
37184
37569
|
}
|
|
37185
|
-
getAdjustedSpacing(startX, endX, startY, endY, baseSpacing = 50) {
|
|
37186
|
-
let spacing = baseSpacing;
|
|
37187
|
-
let dotCountX = Math.ceil((endX - startX) / spacing);
|
|
37188
|
-
let dotCountY = Math.ceil((endY - startY) / spacing);
|
|
37189
|
-
while ((dotCountX > this.config.gridDotMaxDotsPerAxis || dotCountY > this.config.gridDotMaxDotsPerAxis) && spacing < 1e6) {
|
|
37190
|
-
spacing *= 2;
|
|
37191
|
-
dotCountX = Math.ceil((endX - startX) / spacing);
|
|
37192
|
-
dotCountY = Math.ceil((endY - startY) / spacing);
|
|
37193
|
-
}
|
|
37194
|
-
return spacing;
|
|
37195
|
-
}
|
|
37196
37570
|
renderGridLines() {
|
|
37197
37571
|
const stage = this.instance.getStage();
|
|
37198
37572
|
const gridLayer = this.getLayer();
|
|
@@ -37201,7 +37575,7 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37201
37575
|
if (!this.enabled) return;
|
|
37202
37576
|
const scale = stage.scaleX();
|
|
37203
37577
|
const spacing = this.getAdaptiveSpacing(scale);
|
|
37204
|
-
const invScale =
|
|
37578
|
+
const invScale = this.config.gridStroke / scale;
|
|
37205
37579
|
const offsetX = -stage.x() / stage.scaleX();
|
|
37206
37580
|
const offsetY = -stage.y() / stage.scaleY();
|
|
37207
37581
|
const margin = 2;
|
|
@@ -37211,11 +37585,19 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37211
37585
|
const startY = Math.floor((offsetY - margin * worldHeight) / spacing) * spacing;
|
|
37212
37586
|
const endX = offsetX + (1 + margin) * worldWidth;
|
|
37213
37587
|
const endY = offsetY + (1 + margin) * worldHeight;
|
|
37214
|
-
const highlightEvery = this.config.gridMajorEvery
|
|
37588
|
+
const highlightEvery = this.config.gridMajorEvery;
|
|
37215
37589
|
for (let x = startX; x <= endX; x += spacing) {
|
|
37216
37590
|
const index = Math.round(x / spacing);
|
|
37217
37591
|
const isHighlight = index % highlightEvery === 0;
|
|
37218
37592
|
const isOrigin = Math.abs(x) < spacing / 2;
|
|
37593
|
+
let stroke = this.config.gridColor;
|
|
37594
|
+
if (isOrigin) stroke = this.config.gridOriginColor;
|
|
37595
|
+
else if (isHighlight) stroke = this.config.gridMajorColor;
|
|
37596
|
+
let strokeWidth = invScale;
|
|
37597
|
+
if (isHighlight || isOrigin) strokeWidth = invScale * this.config.gridMajorRatio;
|
|
37598
|
+
let zIndex = 1;
|
|
37599
|
+
if (isOrigin) zIndex = 3;
|
|
37600
|
+
else if (isHighlight) zIndex = 2;
|
|
37219
37601
|
const line = new Konva.Line({
|
|
37220
37602
|
points: [
|
|
37221
37603
|
x,
|
|
@@ -37223,9 +37605,10 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37223
37605
|
x,
|
|
37224
37606
|
endY
|
|
37225
37607
|
],
|
|
37226
|
-
stroke
|
|
37227
|
-
strokeWidth
|
|
37228
|
-
listening: false
|
|
37608
|
+
stroke,
|
|
37609
|
+
strokeWidth,
|
|
37610
|
+
listening: false,
|
|
37611
|
+
zIndex
|
|
37229
37612
|
});
|
|
37230
37613
|
gridLayer.add(line);
|
|
37231
37614
|
}
|
|
@@ -37233,6 +37616,14 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37233
37616
|
const index = Math.round(y / spacing);
|
|
37234
37617
|
const isHighlight = index % highlightEvery === 0;
|
|
37235
37618
|
const isOrigin = Math.abs(y) < spacing / 2;
|
|
37619
|
+
let stroke = this.config.gridColor;
|
|
37620
|
+
if (isOrigin) stroke = this.config.gridOriginColor;
|
|
37621
|
+
else if (isHighlight) stroke = this.config.gridMajorColor;
|
|
37622
|
+
let strokeWidth = invScale;
|
|
37623
|
+
if (isHighlight || isOrigin) strokeWidth = invScale * this.config.gridMajorRatio;
|
|
37624
|
+
let zIndex = 1;
|
|
37625
|
+
if (isOrigin) zIndex = 3;
|
|
37626
|
+
else if (isHighlight) zIndex = 2;
|
|
37236
37627
|
const line = new Konva.Line({
|
|
37237
37628
|
points: [
|
|
37238
37629
|
startX,
|
|
@@ -37240,9 +37631,10 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37240
37631
|
endX,
|
|
37241
37632
|
y
|
|
37242
37633
|
],
|
|
37243
|
-
stroke
|
|
37244
|
-
strokeWidth
|
|
37245
|
-
listening: false
|
|
37634
|
+
stroke,
|
|
37635
|
+
strokeWidth,
|
|
37636
|
+
listening: false,
|
|
37637
|
+
zIndex
|
|
37246
37638
|
});
|
|
37247
37639
|
gridLayer.add(line);
|
|
37248
37640
|
}
|
|
@@ -37253,67 +37645,78 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37253
37645
|
if (!gridLayer) return;
|
|
37254
37646
|
gridLayer.destroyChildren();
|
|
37255
37647
|
if (!this.enabled) return;
|
|
37256
|
-
const
|
|
37257
|
-
|
|
37258
|
-
|
|
37259
|
-
|
|
37260
|
-
|
|
37261
|
-
|
|
37262
|
-
|
|
37263
|
-
|
|
37264
|
-
|
|
37265
|
-
|
|
37266
|
-
|
|
37267
|
-
|
|
37268
|
-
|
|
37269
|
-
|
|
37270
|
-
|
|
37271
|
-
|
|
37272
|
-
|
|
37273
|
-
|
|
37274
|
-
|
|
37275
|
-
|
|
37276
|
-
|
|
37277
|
-
|
|
37278
|
-
|
|
37279
|
-
|
|
37280
|
-
|
|
37281
|
-
|
|
37282
|
-
|
|
37283
|
-
|
|
37284
|
-
|
|
37285
|
-
|
|
37286
|
-
|
|
37287
|
-
|
|
37288
|
-
|
|
37289
|
-
|
|
37290
|
-
|
|
37291
|
-
|
|
37292
|
-
|
|
37293
|
-
|
|
37294
|
-
|
|
37295
|
-
|
|
37296
|
-
|
|
37297
|
-
|
|
37298
|
-
|
|
37299
|
-
|
|
37300
|
-
|
|
37301
|
-
|
|
37302
|
-
|
|
37303
|
-
|
|
37304
|
-
|
|
37305
|
-
|
|
37306
|
-
|
|
37307
|
-
|
|
37308
|
-
|
|
37309
|
-
|
|
37310
|
-
|
|
37311
|
-
|
|
37312
|
-
|
|
37313
|
-
|
|
37314
|
-
|
|
37315
|
-
|
|
37316
|
-
|
|
37648
|
+
const grid = new Konva.Shape({
|
|
37649
|
+
listening: false,
|
|
37650
|
+
sceneFunc: (ctx) => {
|
|
37651
|
+
const dotType = this.config.gridDotType;
|
|
37652
|
+
const scale = stage.scaleX();
|
|
37653
|
+
const pos = stage.position();
|
|
37654
|
+
const baseSpacing = this.config.gridSize;
|
|
37655
|
+
const spacing = this.getShapeAdaptiveSpacing(baseSpacing, scale);
|
|
37656
|
+
const highlightEvery = this.config.gridMajorEvery;
|
|
37657
|
+
const defaultColor = this.config.gridColor;
|
|
37658
|
+
const majorColor = this.config.gridMajorColor;
|
|
37659
|
+
const centerColor = this.config.gridOriginColor;
|
|
37660
|
+
if (dotType === WEAVE_GRID_DOT_TYPES.CIRCLE) {
|
|
37661
|
+
const scale$1 = stage.scaleX();
|
|
37662
|
+
const pos$1 = stage.position();
|
|
37663
|
+
const topLeftX = -pos$1.x / scale$1;
|
|
37664
|
+
const topLeftY = -pos$1.y / scale$1;
|
|
37665
|
+
const viewWidth = stage.width() / scale$1;
|
|
37666
|
+
const viewHeight = stage.height() / scale$1;
|
|
37667
|
+
const startX = Math.floor(topLeftX / spacing) * spacing;
|
|
37668
|
+
const startY = Math.floor(topLeftY / spacing) * spacing;
|
|
37669
|
+
const dotRadius = this.config.gridDotRadius;
|
|
37670
|
+
const dotMajorRadius = dotRadius * this.config.gridMajorRatio;
|
|
37671
|
+
for (let x = startX; x < topLeftX + viewWidth; x += spacing) for (let y = startY; y < topLeftY + viewHeight; y += spacing) {
|
|
37672
|
+
const indexX = Math.round(x / spacing);
|
|
37673
|
+
const indexY = Math.round(y / spacing);
|
|
37674
|
+
const isHighlightX = indexX % highlightEvery === 0;
|
|
37675
|
+
const isHighlightY = indexY % highlightEvery === 0;
|
|
37676
|
+
const isHighlight = isHighlightX || isHighlightY;
|
|
37677
|
+
const isOriginX = Math.abs(x) < spacing / 2;
|
|
37678
|
+
const isOriginY = Math.abs(y) < spacing / 2;
|
|
37679
|
+
const isOrigin = isOriginX || isOriginY;
|
|
37680
|
+
let fillStyle = defaultColor;
|
|
37681
|
+
if (isOrigin) fillStyle = centerColor;
|
|
37682
|
+
else if (isHighlight) fillStyle = majorColor;
|
|
37683
|
+
ctx.fillStyle = fillStyle;
|
|
37684
|
+
ctx.beginPath();
|
|
37685
|
+
ctx.arc(x, y, (isHighlight ? dotMajorRadius : dotRadius) / scale$1, 0, Math.PI * 2);
|
|
37686
|
+
ctx.fill();
|
|
37687
|
+
}
|
|
37688
|
+
}
|
|
37689
|
+
if (dotType === WEAVE_GRID_DOT_TYPES.SQUARE) {
|
|
37690
|
+
const topLeftX = -pos.x / scale;
|
|
37691
|
+
const topLeftY = -pos.y / scale;
|
|
37692
|
+
const viewWidth = stage.width() / scale;
|
|
37693
|
+
const viewHeight = stage.height() / scale;
|
|
37694
|
+
const startX = Math.floor(topLeftX / spacing) * spacing;
|
|
37695
|
+
const startY = Math.floor(topLeftY / spacing) * spacing;
|
|
37696
|
+
const defaultSize = this.config.gridDotRectSize;
|
|
37697
|
+
const majorSize = defaultSize * this.config.gridMajorRatio;
|
|
37698
|
+
for (let x = startX; x < topLeftX + viewWidth; x += spacing) for (let y = startY; y < topLeftY + viewHeight; y += spacing) {
|
|
37699
|
+
const sx = Math.round(x * scale) / scale;
|
|
37700
|
+
const sy = Math.round(y * scale) / scale;
|
|
37701
|
+
const indexX = Math.round(sx / spacing);
|
|
37702
|
+
const indexY = Math.round(sy / spacing);
|
|
37703
|
+
const isHighlightX = indexX % highlightEvery === 0;
|
|
37704
|
+
const isHighlightY = indexY % highlightEvery === 0;
|
|
37705
|
+
const isHighlight = isHighlightX || isHighlightY;
|
|
37706
|
+
const isOriginX = Math.abs(sx) < spacing / 2;
|
|
37707
|
+
const isOriginY = Math.abs(sy) < spacing / 2;
|
|
37708
|
+
const isOrigin = isOriginX || isOriginY;
|
|
37709
|
+
let fillStyle = defaultColor;
|
|
37710
|
+
if (isOrigin) fillStyle = centerColor;
|
|
37711
|
+
else if (isHighlight) fillStyle = majorColor;
|
|
37712
|
+
ctx.fillStyle = fillStyle;
|
|
37713
|
+
const size = (isHighlight ? majorSize : defaultSize) / scale;
|
|
37714
|
+
ctx.fillRect(sx - size / 2, sy - size / 2, size, size);
|
|
37715
|
+
}
|
|
37716
|
+
}
|
|
37717
|
+
}
|
|
37718
|
+
});
|
|
37719
|
+
gridLayer.add(grid);
|
|
37317
37720
|
}
|
|
37318
37721
|
hasStageChanged() {
|
|
37319
37722
|
if (this.forceStageChange) {
|
|
@@ -37350,11 +37753,13 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37350
37753
|
enable() {
|
|
37351
37754
|
this.enabled = true;
|
|
37352
37755
|
this.getLayer()?.show();
|
|
37756
|
+
this.forceStageChange = true;
|
|
37353
37757
|
this.onRender();
|
|
37354
37758
|
}
|
|
37355
37759
|
disable() {
|
|
37356
37760
|
this.enabled = false;
|
|
37357
37761
|
this.getLayer()?.hide();
|
|
37762
|
+
this.forceStageChange = true;
|
|
37358
37763
|
this.onRender();
|
|
37359
37764
|
}
|
|
37360
37765
|
getType() {
|
|
@@ -37365,20 +37770,27 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37365
37770
|
this.forceStageChange = true;
|
|
37366
37771
|
this.onRender();
|
|
37367
37772
|
}
|
|
37773
|
+
getDotsType() {
|
|
37774
|
+
return this.config.gridDotType;
|
|
37775
|
+
}
|
|
37776
|
+
setDotsType(type) {
|
|
37777
|
+
this.config.gridDotType = type;
|
|
37778
|
+
this.forceStageChange = true;
|
|
37779
|
+
this.onRender();
|
|
37780
|
+
}
|
|
37368
37781
|
};
|
|
37369
37782
|
|
|
37370
37783
|
//#endregion
|
|
37371
37784
|
//#region src/plugins/stage-panning/stage-panning.ts
|
|
37372
37785
|
var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
37373
|
-
panning = false;
|
|
37374
|
-
currentPointer = null;
|
|
37375
|
-
stageScrollInterval = void 0;
|
|
37376
|
-
panEdgeTargets = {};
|
|
37377
37786
|
getLayerName = void 0;
|
|
37378
37787
|
initLayer = void 0;
|
|
37379
37788
|
constructor(params) {
|
|
37380
37789
|
super();
|
|
37381
37790
|
this.config = mergeExceptArrays(WEAVE_STAGE_PANNING_DEFAULT_CONFIG, params?.config ?? {});
|
|
37791
|
+
this.initialize();
|
|
37792
|
+
}
|
|
37793
|
+
initialize() {
|
|
37382
37794
|
this.pointers = new Map();
|
|
37383
37795
|
this.panning = false;
|
|
37384
37796
|
this.isDragging = false;
|
|
@@ -37390,6 +37802,9 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37390
37802
|
this.isCtrlOrMetaPressed = false;
|
|
37391
37803
|
this.isSpaceKeyPressed = false;
|
|
37392
37804
|
this.previousPointer = null;
|
|
37805
|
+
this.currentPointer = null;
|
|
37806
|
+
this.stageScrollInterval = void 0;
|
|
37807
|
+
this.panEdgeTargets = {};
|
|
37393
37808
|
}
|
|
37394
37809
|
getName() {
|
|
37395
37810
|
return WEAVE_STAGE_PANNING_KEY;
|
|
@@ -37423,7 +37838,7 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37423
37838
|
this.isSpaceKeyPressed = true;
|
|
37424
37839
|
this.setCursor();
|
|
37425
37840
|
}
|
|
37426
|
-
});
|
|
37841
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37427
37842
|
window.addEventListener("keyup", (e) => {
|
|
37428
37843
|
if (e.key === "Meta" || e.key === "Control") this.isCtrlOrMetaPressed = false;
|
|
37429
37844
|
if (e.code === "Space") {
|
|
@@ -37434,7 +37849,7 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37434
37849
|
this.isSpaceKeyPressed = false;
|
|
37435
37850
|
this.disableMove();
|
|
37436
37851
|
}
|
|
37437
|
-
});
|
|
37852
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37438
37853
|
let lastPos = null;
|
|
37439
37854
|
stage.on("pointerdown", (e) => {
|
|
37440
37855
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -37507,7 +37922,10 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37507
37922
|
this.instance.emitEvent("onStageMove");
|
|
37508
37923
|
};
|
|
37509
37924
|
const handleWheelThrottled = (0, import_lodash.throttle)(handleWheel, WEAVE_STAGE_PANNING_THROTTLE_MS);
|
|
37510
|
-
window.addEventListener("wheel", handleWheelThrottled, {
|
|
37925
|
+
window.addEventListener("wheel", handleWheelThrottled, {
|
|
37926
|
+
passive: true,
|
|
37927
|
+
signal: this.instance.getEventsController()?.signal
|
|
37928
|
+
});
|
|
37511
37929
|
stage.on("dragstart", (e) => {
|
|
37512
37930
|
const duration = 1e3 / 60;
|
|
37513
37931
|
if (this.panEdgeTargets[e.target.getAttrs().id ?? ""] !== void 0) return;
|
|
@@ -37565,7 +37983,10 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37565
37983
|
stage.container().style.setProperty("-webkit-user-drag", "none");
|
|
37566
37984
|
stage.getContent().addEventListener("touchmove", function(e) {
|
|
37567
37985
|
e.preventDefault();
|
|
37568
|
-
}, {
|
|
37986
|
+
}, {
|
|
37987
|
+
passive: false,
|
|
37988
|
+
signal: this.instance.getEventsController()?.signal
|
|
37989
|
+
});
|
|
37569
37990
|
}
|
|
37570
37991
|
isPanning() {
|
|
37571
37992
|
return this.panning;
|
|
@@ -37643,6 +38064,9 @@ var WeaveStageMinimapPlugin = class extends WeavePlugin {
|
|
|
37643
38064
|
constructor(params) {
|
|
37644
38065
|
super();
|
|
37645
38066
|
this.config = mergeExceptArrays(STAGE_MINIMAP_DEFAULT_CONFIG, params.config);
|
|
38067
|
+
this.initialize();
|
|
38068
|
+
}
|
|
38069
|
+
initialize() {
|
|
37646
38070
|
this.initialized = false;
|
|
37647
38071
|
}
|
|
37648
38072
|
getName() {
|
|
@@ -37820,6 +38244,7 @@ const WEAVE_STAGE_RESIZE_KEY = "stageResize";
|
|
|
37820
38244
|
var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
37821
38245
|
getLayerName = void 0;
|
|
37822
38246
|
initLayer = void 0;
|
|
38247
|
+
initialize = void 0;
|
|
37823
38248
|
getName() {
|
|
37824
38249
|
return WEAVE_STAGE_RESIZE_KEY;
|
|
37825
38250
|
}
|
|
@@ -37839,6 +38264,10 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
|
37839
38264
|
const pluginInstance = plugins[pluginId];
|
|
37840
38265
|
pluginInstance.onRender?.();
|
|
37841
38266
|
}
|
|
38267
|
+
this.instance.emitEvent("onStageResize", {
|
|
38268
|
+
width: stage.width(),
|
|
38269
|
+
height: stage.height()
|
|
38270
|
+
});
|
|
37842
38271
|
}
|
|
37843
38272
|
}
|
|
37844
38273
|
onInit() {
|
|
@@ -37847,7 +38276,7 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
|
37847
38276
|
}, DEFAULT_THROTTLE_MS);
|
|
37848
38277
|
window.addEventListener("resize", () => {
|
|
37849
38278
|
throttledResize();
|
|
37850
|
-
});
|
|
38279
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37851
38280
|
const resizeObserver = new ResizeObserver(() => {
|
|
37852
38281
|
throttledResize();
|
|
37853
38282
|
});
|
|
@@ -37865,10 +38294,12 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
|
37865
38294
|
//#endregion
|
|
37866
38295
|
//#region src/plugins/nodes-multi-selection-feedback/nodes-multi-selection-feedback.ts
|
|
37867
38296
|
var WeaveNodesMultiSelectionFeedbackPlugin = class extends WeavePlugin {
|
|
37868
|
-
selectedHalos = {};
|
|
37869
38297
|
constructor(params) {
|
|
37870
38298
|
super();
|
|
37871
38299
|
this.config = mergeExceptArrays(WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_DEFAULT_CONFIG, params?.config ?? {});
|
|
38300
|
+
this.initialize();
|
|
38301
|
+
}
|
|
38302
|
+
initialize() {
|
|
37872
38303
|
this.selectedHalos = {};
|
|
37873
38304
|
}
|
|
37874
38305
|
getName() {
|
|
@@ -38034,12 +38465,14 @@ var WeaveNodesMultiSelectionFeedbackPlugin = class extends WeavePlugin {
|
|
|
38034
38465
|
//#endregion
|
|
38035
38466
|
//#region src/plugins/connected-users/connected-users.ts
|
|
38036
38467
|
var WeaveConnectedUsersPlugin = class extends WeavePlugin {
|
|
38037
|
-
connectedUsers = {};
|
|
38038
38468
|
getLayerName = void 0;
|
|
38039
38469
|
constructor(params) {
|
|
38040
38470
|
super();
|
|
38041
38471
|
const { config } = params ?? {};
|
|
38042
38472
|
this.config = config;
|
|
38473
|
+
this.initialize();
|
|
38474
|
+
}
|
|
38475
|
+
initialize() {
|
|
38043
38476
|
this.connectedUsers = {};
|
|
38044
38477
|
}
|
|
38045
38478
|
getName() {
|
|
@@ -38086,6 +38519,9 @@ var WeaveUsersSelectionPlugin = class extends WeavePlugin {
|
|
|
38086
38519
|
this.config = config;
|
|
38087
38520
|
this.config.getUser = memoize(this.config.getUser);
|
|
38088
38521
|
this.config.getUserColor = memoize(this.config.getUserColor);
|
|
38522
|
+
this.initialize();
|
|
38523
|
+
}
|
|
38524
|
+
initialize() {
|
|
38089
38525
|
this.usersSelection = {};
|
|
38090
38526
|
}
|
|
38091
38527
|
getName() {
|
|
@@ -38278,6 +38714,9 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
38278
38714
|
this.config.getUser = memoize(this.config.getUser);
|
|
38279
38715
|
this.config.getUserBackgroundColor = memoize(this.config.getUserBackgroundColor);
|
|
38280
38716
|
this.config.getUserForegroundColor = memoize(this.config.getUserForegroundColor);
|
|
38717
|
+
this.initialize();
|
|
38718
|
+
}
|
|
38719
|
+
initialize() {
|
|
38281
38720
|
this.usersPointers = {};
|
|
38282
38721
|
this.usersOperations = {};
|
|
38283
38722
|
}
|
|
@@ -38488,6 +38927,9 @@ var WeaveUsersPresencePlugin = class extends WeavePlugin {
|
|
|
38488
38927
|
super();
|
|
38489
38928
|
const { config } = params;
|
|
38490
38929
|
this.config = mergeExceptArrays(WEAVE_USERS_PRESENCE_CONFIG_DEFAULT_PROPS, config);
|
|
38930
|
+
this.initialize();
|
|
38931
|
+
}
|
|
38932
|
+
initialize() {
|
|
38491
38933
|
this.userPresence = {};
|
|
38492
38934
|
}
|
|
38493
38935
|
getName() {
|
|
@@ -38563,6 +39005,9 @@ var WeaveStageDropAreaPlugin = class extends WeavePlugin {
|
|
|
38563
39005
|
initLayer = void 0;
|
|
38564
39006
|
constructor() {
|
|
38565
39007
|
super();
|
|
39008
|
+
this.initialize();
|
|
39009
|
+
}
|
|
39010
|
+
initialize() {
|
|
38566
39011
|
this.enabled = true;
|
|
38567
39012
|
}
|
|
38568
39013
|
getName() {
|
|
@@ -38576,14 +39021,20 @@ var WeaveStageDropAreaPlugin = class extends WeavePlugin {
|
|
|
38576
39021
|
stage.container().addEventListener("dragover", (e) => {
|
|
38577
39022
|
e.preventDefault();
|
|
38578
39023
|
e.stopPropagation();
|
|
38579
|
-
});
|
|
39024
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
38580
39025
|
stage.container().addEventListener("drop", (e) => {
|
|
38581
39026
|
e.preventDefault();
|
|
38582
39027
|
e.stopPropagation();
|
|
38583
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
|
|
38584
39037
|
});
|
|
38585
|
-
window.addEventListener("dragover", (e) => e.preventDefault(), { passive: false });
|
|
38586
|
-
window.addEventListener("drop", (e) => e.preventDefault(), { passive: false });
|
|
38587
39038
|
}
|
|
38588
39039
|
enable() {
|
|
38589
39040
|
this.enabled = true;
|
|
@@ -38602,6 +39053,9 @@ var WeaveNodesEdgeSnappingPlugin = class extends WeavePlugin {
|
|
|
38602
39053
|
this.guideLineConfig = config?.guideLine ?? GUIDE_LINE_DEFAULT_CONFIG;
|
|
38603
39054
|
this.dragSnappingThreshold = config?.dragSnappingThreshold ?? GUIDE_LINE_DRAG_SNAPPING_THRESHOLD;
|
|
38604
39055
|
this.transformSnappingThreshold = config?.transformSnappingThreshold ?? GUIDE_LINE_TRANSFORM_SNAPPING_THRESHOLD;
|
|
39056
|
+
this.initialize();
|
|
39057
|
+
}
|
|
39058
|
+
initialize() {
|
|
38605
39059
|
this.enabled = true;
|
|
38606
39060
|
}
|
|
38607
39061
|
getName() {
|
|
@@ -38978,6 +39432,9 @@ var WeaveNodesDistanceSnappingPlugin = class extends WeavePlugin {
|
|
|
38978
39432
|
this.enterSnappingTolerance = config?.enterSnappingTolerance ?? GUIDE_ENTER_SNAPPING_TOLERANCE;
|
|
38979
39433
|
this.exitSnappingTolerance = config?.exitSnappingTolerance ?? GUIDE_EXIT_SNAPPING_TOLERANCE;
|
|
38980
39434
|
this.uiConfig = mergeExceptArrays(GUIDE_DISTANCE_LINE_DEFAULT_CONFIG, config?.ui);
|
|
39435
|
+
this.initialize();
|
|
39436
|
+
}
|
|
39437
|
+
initialize() {
|
|
38981
39438
|
this.enabled = true;
|
|
38982
39439
|
}
|
|
38983
39440
|
getName() {
|
|
@@ -39624,12 +40081,14 @@ var WeaveNodesDistanceSnappingPlugin = class extends WeavePlugin {
|
|
|
39624
40081
|
//#endregion
|
|
39625
40082
|
//#region src/plugins/comments-renderer/comments-renderer.ts
|
|
39626
40083
|
var WeaveCommentsRendererPlugin = class extends WeavePlugin {
|
|
39627
|
-
comments = [];
|
|
39628
40084
|
getLayerName = void 0;
|
|
39629
40085
|
constructor(params) {
|
|
39630
40086
|
super();
|
|
39631
40087
|
const { config } = params ?? {};
|
|
39632
40088
|
this.config = config;
|
|
40089
|
+
this.initialize();
|
|
40090
|
+
}
|
|
40091
|
+
initialize() {
|
|
39633
40092
|
this.comments = [];
|
|
39634
40093
|
}
|
|
39635
40094
|
getName() {
|
|
@@ -39720,6 +40179,7 @@ const WEAVE_STAGE_KEYBOARD_MOVE_DEFAULT_CONFIG = { movementDelta: 5 };
|
|
|
39720
40179
|
var WeaveStageKeyboardMovePlugin = class extends WeavePlugin {
|
|
39721
40180
|
getLayerName = void 0;
|
|
39722
40181
|
initLayer = void 0;
|
|
40182
|
+
initialize = void 0;
|
|
39723
40183
|
constructor(params) {
|
|
39724
40184
|
super();
|
|
39725
40185
|
this.config = mergeExceptArrays(WEAVE_STAGE_KEYBOARD_MOVE_DEFAULT_CONFIG, params?.config ?? {});
|
|
@@ -39758,7 +40218,7 @@ var WeaveStageKeyboardMovePlugin = class extends WeavePlugin {
|
|
|
39758
40218
|
if (e.code === "ArrowLeft" && e.shiftKey) this.handleNodesMovement("left");
|
|
39759
40219
|
if (e.code === "ArrowRight" && e.shiftKey) this.handleNodesMovement("right");
|
|
39760
40220
|
if (e.code === "ArrowDown" && e.shiftKey) this.handleNodesMovement("down");
|
|
39761
|
-
});
|
|
40221
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
39762
40222
|
}
|
|
39763
40223
|
enable() {
|
|
39764
40224
|
this.enabled = true;
|
|
@@ -39815,4 +40275,4 @@ function getJSONFromYjsBinary(actualState) {
|
|
|
39815
40275
|
}
|
|
39816
40276
|
|
|
39817
40277
|
//#endregion
|
|
39818
|
-
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 };
|