@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/types.js
CHANGED
|
@@ -15084,6 +15084,11 @@ var WeaveStore = class {
|
|
|
15084
15084
|
getDocument() {
|
|
15085
15085
|
return this.document;
|
|
15086
15086
|
}
|
|
15087
|
+
restartDocument() {
|
|
15088
|
+
this.latestState = { weave: {} };
|
|
15089
|
+
this.state = syncedStore({ weave: {} });
|
|
15090
|
+
this.document = getYjsDoc(this.state);
|
|
15091
|
+
}
|
|
15087
15092
|
loadDocument(roomData) {
|
|
15088
15093
|
yjs_default.applyUpdate(this.document, roomData);
|
|
15089
15094
|
}
|
|
@@ -17959,6 +17964,15 @@ var WeaveContextMenuPlugin = class extends WeavePlugin {
|
|
|
17959
17964
|
initLayer = void 0;
|
|
17960
17965
|
constructor(params) {
|
|
17961
17966
|
super();
|
|
17967
|
+
const { config } = params ?? {};
|
|
17968
|
+
this.config = {
|
|
17969
|
+
xOffset: WEAVE_CONTEXT_MENU_X_OFFSET_DEFAULT,
|
|
17970
|
+
yOffset: WEAVE_CONTEXT_MENU_Y_OFFSET_DEFAULT,
|
|
17971
|
+
...config
|
|
17972
|
+
};
|
|
17973
|
+
this.initialize();
|
|
17974
|
+
}
|
|
17975
|
+
initialize() {
|
|
17962
17976
|
this.timer = null;
|
|
17963
17977
|
this.tapHold = false;
|
|
17964
17978
|
this.contextMenuVisible = false;
|
|
@@ -17968,12 +17982,6 @@ var WeaveContextMenuPlugin = class extends WeavePlugin {
|
|
|
17968
17982
|
time: 0
|
|
17969
17983
|
};
|
|
17970
17984
|
this.tapHoldTimeout = WEAVE_CONTEXT_MENU_TAP_HOLD_TIMEOUT;
|
|
17971
|
-
const { config } = params ?? {};
|
|
17972
|
-
this.config = {
|
|
17973
|
-
xOffset: WEAVE_CONTEXT_MENU_X_OFFSET_DEFAULT,
|
|
17974
|
-
yOffset: WEAVE_CONTEXT_MENU_Y_OFFSET_DEFAULT,
|
|
17975
|
-
...config
|
|
17976
|
-
};
|
|
17977
17985
|
this.pointers = {};
|
|
17978
17986
|
}
|
|
17979
17987
|
getName() {
|
|
@@ -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();
|
|
@@ -21978,11 +22002,34 @@ var WeaveRegisterManager = class {
|
|
|
21978
22002
|
}
|
|
21979
22003
|
}
|
|
21980
22004
|
}
|
|
22005
|
+
resetNodesHandlers() {
|
|
22006
|
+
for (const nodeHandlerId of Object.keys(this.nodesHandlers)) {
|
|
22007
|
+
const nodeHandler = this.nodesHandlers[nodeHandlerId];
|
|
22008
|
+
nodeHandler.initialize?.();
|
|
22009
|
+
}
|
|
22010
|
+
}
|
|
22011
|
+
resetActionsHandlers() {
|
|
22012
|
+
for (const actionHandlerId of Object.keys(this.actionsHandlers)) {
|
|
22013
|
+
const actionHandler = this.actionsHandlers[actionHandlerId];
|
|
22014
|
+
actionHandler.initialize?.();
|
|
22015
|
+
}
|
|
22016
|
+
}
|
|
22017
|
+
resetPlugins() {
|
|
22018
|
+
for (const pluginId of Object.keys(this.plugins)) {
|
|
22019
|
+
const plugin = this.plugins[pluginId];
|
|
22020
|
+
plugin.initialize?.();
|
|
22021
|
+
}
|
|
22022
|
+
}
|
|
22023
|
+
reset() {
|
|
22024
|
+
this.resetNodesHandlers();
|
|
22025
|
+
this.resetActionsHandlers();
|
|
22026
|
+
this.resetPlugins();
|
|
22027
|
+
}
|
|
21981
22028
|
};
|
|
21982
22029
|
|
|
21983
22030
|
//#endregion
|
|
21984
22031
|
//#region package.json
|
|
21985
|
-
var version = "3.
|
|
22032
|
+
var version = "3.6.0-SNAPSHOT.112.1";
|
|
21986
22033
|
|
|
21987
22034
|
//#endregion
|
|
21988
22035
|
//#region src/managers/setup.ts
|
|
@@ -22099,6 +22146,11 @@ var WeaveStageManager = class {
|
|
|
22099
22146
|
initialZIndex: void 0
|
|
22100
22147
|
};
|
|
22101
22148
|
const stage = new Konva.Stage({ ...props });
|
|
22149
|
+
if (!this.instance.isServerSide()) {
|
|
22150
|
+
const containerParent = stage.container().parentNode;
|
|
22151
|
+
stage.width(containerParent.clientWidth);
|
|
22152
|
+
stage.height(containerParent.clientHeight);
|
|
22153
|
+
}
|
|
22102
22154
|
const realContainer = stage.container();
|
|
22103
22155
|
if (realContainer !== void 0 && realContainer.style?.position !== "relative") realContainer.style.position = "relative";
|
|
22104
22156
|
this.setStage(stage);
|
|
@@ -22231,6 +22283,10 @@ var WeaveExportManager = class {
|
|
|
22231
22283
|
exportNodesAsImage(nodes, boundingNodes, options) {
|
|
22232
22284
|
return new Promise((resolve) => {
|
|
22233
22285
|
const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
|
|
22286
|
+
const nodesSelectionPluginPrev = this.getNodesSelectionPlugin()?.isEnabled();
|
|
22287
|
+
const nodesDistanceSnappingPluginPrev = this.getNodesDistanceSnappingPlugin()?.isEnabled();
|
|
22288
|
+
const nodesEdgeSnappingPluginPrev = this.getNodesDistanceSnappingPlugin()?.isEnabled();
|
|
22289
|
+
const nodesStageGridPluginPrev = this.getStageGridPlugin()?.isEnabled();
|
|
22234
22290
|
this.getNodesSelectionPlugin()?.disable();
|
|
22235
22291
|
this.getNodesDistanceSnappingPlugin()?.disable();
|
|
22236
22292
|
this.getNodesEdgeSnappingPlugin()?.disable();
|
|
@@ -22295,16 +22351,80 @@ var WeaveExportManager = class {
|
|
|
22295
22351
|
stage.position(originalPosition);
|
|
22296
22352
|
stage.scale(originalScale);
|
|
22297
22353
|
stage.batchDraw();
|
|
22298
|
-
this.getNodesSelectionPlugin()?.enable();
|
|
22299
|
-
this.getNodesDistanceSnappingPlugin()?.enable();
|
|
22300
|
-
this.getNodesEdgeSnappingPlugin()?.enable();
|
|
22301
|
-
this.getStageGridPlugin()?.enable();
|
|
22354
|
+
if (nodesSelectionPluginPrev) this.getNodesSelectionPlugin()?.enable();
|
|
22355
|
+
if (nodesDistanceSnappingPluginPrev) this.getNodesDistanceSnappingPlugin()?.enable();
|
|
22356
|
+
if (nodesEdgeSnappingPluginPrev) this.getNodesEdgeSnappingPlugin()?.enable();
|
|
22357
|
+
if (nodesStageGridPluginPrev) this.getStageGridPlugin()?.enable();
|
|
22302
22358
|
resolve(img);
|
|
22303
22359
|
}
|
|
22304
22360
|
});
|
|
22305
22361
|
}
|
|
22306
22362
|
});
|
|
22307
22363
|
}
|
|
22364
|
+
exportAreaAsImage(area, options) {
|
|
22365
|
+
return new Promise((resolve) => {
|
|
22366
|
+
const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
|
|
22367
|
+
const nodesSelectionPluginPrev = this.getNodesSelectionPlugin()?.isEnabled();
|
|
22368
|
+
const nodesDistanceSnappingPluginPrev = this.getNodesDistanceSnappingPlugin()?.isEnabled();
|
|
22369
|
+
const nodesEdgeSnappingPluginPrev = this.getNodesDistanceSnappingPlugin()?.isEnabled();
|
|
22370
|
+
const nodesStageGridPluginPrev = this.getStageGridPlugin()?.isEnabled();
|
|
22371
|
+
this.getNodesSelectionPlugin()?.disable();
|
|
22372
|
+
this.getNodesDistanceSnappingPlugin()?.disable();
|
|
22373
|
+
this.getNodesEdgeSnappingPlugin()?.disable();
|
|
22374
|
+
this.getStageGridPlugin()?.disable();
|
|
22375
|
+
const stage = this.instance.getStage();
|
|
22376
|
+
const mainLayer = this.instance.getMainLayer();
|
|
22377
|
+
if (!mainLayer) throw new Error("Main layer not found");
|
|
22378
|
+
const originalPosition = {
|
|
22379
|
+
x: stage.x(),
|
|
22380
|
+
y: stage.y()
|
|
22381
|
+
};
|
|
22382
|
+
const originalScale = {
|
|
22383
|
+
x: stage.scaleX(),
|
|
22384
|
+
y: stage.scaleY()
|
|
22385
|
+
};
|
|
22386
|
+
stage.scale({
|
|
22387
|
+
x: 1,
|
|
22388
|
+
y: 1
|
|
22389
|
+
});
|
|
22390
|
+
stage.position({
|
|
22391
|
+
x: 0,
|
|
22392
|
+
y: 0
|
|
22393
|
+
});
|
|
22394
|
+
const bounds = area;
|
|
22395
|
+
const background = new Konva.Rect({
|
|
22396
|
+
x: bounds.x - padding,
|
|
22397
|
+
y: bounds.y - padding,
|
|
22398
|
+
width: bounds.width + 2 * padding,
|
|
22399
|
+
height: bounds.height + 2 * padding,
|
|
22400
|
+
strokeWidth: 0,
|
|
22401
|
+
fill: backgroundColor
|
|
22402
|
+
});
|
|
22403
|
+
mainLayer.add(background);
|
|
22404
|
+
background.moveToBottom();
|
|
22405
|
+
stage.batchDraw();
|
|
22406
|
+
stage.toImage({
|
|
22407
|
+
x: area.x,
|
|
22408
|
+
y: area.y,
|
|
22409
|
+
width: area.width,
|
|
22410
|
+
height: area.height,
|
|
22411
|
+
mimeType: format,
|
|
22412
|
+
pixelRatio,
|
|
22413
|
+
quality: options.quality ?? 1,
|
|
22414
|
+
callback: (img) => {
|
|
22415
|
+
background.destroy();
|
|
22416
|
+
stage.position(originalPosition);
|
|
22417
|
+
stage.scale(originalScale);
|
|
22418
|
+
stage.batchDraw();
|
|
22419
|
+
if (nodesSelectionPluginPrev) this.getNodesSelectionPlugin()?.enable();
|
|
22420
|
+
if (nodesDistanceSnappingPluginPrev) this.getNodesDistanceSnappingPlugin()?.enable();
|
|
22421
|
+
if (nodesEdgeSnappingPluginPrev) this.getNodesEdgeSnappingPlugin()?.enable();
|
|
22422
|
+
if (nodesStageGridPluginPrev) this.getStageGridPlugin()?.enable();
|
|
22423
|
+
resolve(img);
|
|
22424
|
+
}
|
|
22425
|
+
});
|
|
22426
|
+
});
|
|
22427
|
+
}
|
|
22308
22428
|
async exportNodesServerSide(nodes, boundingNodes, options) {
|
|
22309
22429
|
const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
|
|
22310
22430
|
this.getNodesSelectionPlugin()?.disable();
|
|
@@ -22407,6 +22527,91 @@ var WeaveExportManager = class {
|
|
|
22407
22527
|
height: imageHeight * pixelRatio
|
|
22408
22528
|
};
|
|
22409
22529
|
}
|
|
22530
|
+
async exportAreaServerSide(area, options) {
|
|
22531
|
+
const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
|
|
22532
|
+
this.getNodesSelectionPlugin()?.disable();
|
|
22533
|
+
this.getNodesDistanceSnappingPlugin()?.disable();
|
|
22534
|
+
this.getNodesEdgeSnappingPlugin()?.disable();
|
|
22535
|
+
this.getStageGridPlugin()?.disable();
|
|
22536
|
+
const stage = this.instance.getStage();
|
|
22537
|
+
const mainLayer = this.instance.getMainLayer();
|
|
22538
|
+
if (!mainLayer) throw new Error("Main layer not found");
|
|
22539
|
+
const originalPosition = {
|
|
22540
|
+
x: stage.x(),
|
|
22541
|
+
y: stage.y()
|
|
22542
|
+
};
|
|
22543
|
+
const originalScale = {
|
|
22544
|
+
x: stage.scaleX(),
|
|
22545
|
+
y: stage.scaleY()
|
|
22546
|
+
};
|
|
22547
|
+
stage.scale({
|
|
22548
|
+
x: 1,
|
|
22549
|
+
y: 1
|
|
22550
|
+
});
|
|
22551
|
+
const bounds = area;
|
|
22552
|
+
const scaleX = stage.scaleX();
|
|
22553
|
+
const scaleY = stage.scaleY();
|
|
22554
|
+
const unscaledBounds = {
|
|
22555
|
+
x: bounds.x / scaleX,
|
|
22556
|
+
y: bounds.y / scaleY,
|
|
22557
|
+
width: bounds.width / scaleX,
|
|
22558
|
+
height: bounds.height / scaleY
|
|
22559
|
+
};
|
|
22560
|
+
const background = new Konva.Rect({
|
|
22561
|
+
x: unscaledBounds.x - padding,
|
|
22562
|
+
y: unscaledBounds.y - padding,
|
|
22563
|
+
width: unscaledBounds.width + 2 * padding,
|
|
22564
|
+
height: unscaledBounds.height + 2 * padding,
|
|
22565
|
+
strokeWidth: 0,
|
|
22566
|
+
fill: backgroundColor
|
|
22567
|
+
});
|
|
22568
|
+
mainLayer.add(background);
|
|
22569
|
+
background.moveToBottom();
|
|
22570
|
+
const backgroundRect = background.getClientRect({ relativeTo: stage });
|
|
22571
|
+
const composites = [];
|
|
22572
|
+
const imageWidth = Math.round(backgroundRect.width);
|
|
22573
|
+
const imageHeight = Math.round(backgroundRect.height);
|
|
22574
|
+
const maxRenderSize = 1920;
|
|
22575
|
+
const cols = Math.ceil(imageWidth / maxRenderSize);
|
|
22576
|
+
const rows = Math.ceil(imageHeight / maxRenderSize);
|
|
22577
|
+
const tileWidth = Math.floor(imageWidth / cols);
|
|
22578
|
+
const tileHeight = Math.floor(imageHeight / rows);
|
|
22579
|
+
for (let y = 0; y < imageHeight; y += tileHeight) for (let x = 0; x < imageWidth; x += tileWidth) {
|
|
22580
|
+
const width = Math.min(tileWidth, imageWidth - x);
|
|
22581
|
+
const height = Math.min(tileHeight, imageHeight - y);
|
|
22582
|
+
const canvas = await mainLayer.toCanvas({
|
|
22583
|
+
x: Math.round(backgroundRect.x) + x,
|
|
22584
|
+
y: Math.round(backgroundRect.y) + y,
|
|
22585
|
+
width,
|
|
22586
|
+
height,
|
|
22587
|
+
mimeType: format,
|
|
22588
|
+
pixelRatio,
|
|
22589
|
+
quality: options.quality ?? 1
|
|
22590
|
+
});
|
|
22591
|
+
let buffer = null;
|
|
22592
|
+
if (globalThis._weave_serverSideBackend === WEAVE_KONVA_BACKEND.CANVAS) buffer = canvas.toBuffer();
|
|
22593
|
+
if (globalThis._weave_serverSideBackend === WEAVE_KONVA_BACKEND.SKIA) buffer = await canvas.toBuffer();
|
|
22594
|
+
if (!buffer) throw new Error("Failed to generate image buffer");
|
|
22595
|
+
composites.push({
|
|
22596
|
+
top: y * pixelRatio,
|
|
22597
|
+
left: x * pixelRatio,
|
|
22598
|
+
input: buffer
|
|
22599
|
+
});
|
|
22600
|
+
}
|
|
22601
|
+
background.destroy();
|
|
22602
|
+
stage.position(originalPosition);
|
|
22603
|
+
stage.scale(originalScale);
|
|
22604
|
+
stage.batchDraw();
|
|
22605
|
+
this.getNodesSelectionPlugin()?.enable();
|
|
22606
|
+
this.getNodesDistanceSnappingPlugin()?.enable();
|
|
22607
|
+
this.getNodesEdgeSnappingPlugin()?.enable();
|
|
22608
|
+
this.getStageGridPlugin()?.enable();
|
|
22609
|
+
return {
|
|
22610
|
+
composites,
|
|
22611
|
+
width: imageWidth * pixelRatio,
|
|
22612
|
+
height: imageHeight * pixelRatio
|
|
22613
|
+
};
|
|
22614
|
+
}
|
|
22410
22615
|
imageToBase64(img, mimeType) {
|
|
22411
22616
|
if (img.naturalWidth === 0 && img.naturalHeight === 0) throw new Error("Image has no content");
|
|
22412
22617
|
const canvas = document.createElement("canvas");
|
|
@@ -22686,7 +22891,12 @@ var WeaveAsyncManager = class {
|
|
|
22686
22891
|
this.instance.emitEvent("onAsyncElementChange");
|
|
22687
22892
|
}, new Map());
|
|
22688
22893
|
}
|
|
22894
|
+
reset() {
|
|
22895
|
+
this.asyncElements.clear();
|
|
22896
|
+
this.asyncElementsLoadedEventEmitted = false;
|
|
22897
|
+
}
|
|
22689
22898
|
checkForAsyncElements(elements) {
|
|
22899
|
+
this.instance.emitEvent("onAsyncElementsIdle");
|
|
22690
22900
|
const amountAsyncResourcesExtracted = this.extractAsyncResources(elements);
|
|
22691
22901
|
if (amountAsyncResourcesExtracted === 0 && !this.asyncElementsLoadedEventEmitted) {
|
|
22692
22902
|
this.instance.emitEvent("onAsyncElementsLoaded");
|
|
@@ -22739,7 +22949,7 @@ var WeaveAsyncManager = class {
|
|
|
22739
22949
|
status: WEAVE_ASYNC_STATUS.LOADING
|
|
22740
22950
|
};
|
|
22741
22951
|
this.asyncElements.set(nodeId, element);
|
|
22742
|
-
this.instance.emitEvent("onAsyncElementsLoading", {
|
|
22952
|
+
if (!this.asyncElementsLoadedEventEmitted) this.instance.emitEvent("onAsyncElementsLoading", {
|
|
22743
22953
|
loaded: this.getAmountAsyncElementsLoaded(),
|
|
22744
22954
|
total: this.getAmountAsyncElements()
|
|
22745
22955
|
});
|
|
@@ -22752,11 +22962,11 @@ var WeaveAsyncManager = class {
|
|
|
22752
22962
|
status: WEAVE_ASYNC_STATUS.LOADED
|
|
22753
22963
|
};
|
|
22754
22964
|
this.asyncElements.set(nodeId, element);
|
|
22755
|
-
this.instance.emitEvent("onAsyncElementsLoading", {
|
|
22756
|
-
loaded: this.getAmountAsyncElementsLoaded(),
|
|
22757
|
-
total: this.getAmountAsyncElements()
|
|
22758
|
-
});
|
|
22759
22965
|
if (!this.asyncElementsLoadedEventEmitted) {
|
|
22966
|
+
this.instance.emitEvent("onAsyncElementsLoading", {
|
|
22967
|
+
loaded: this.getAmountAsyncElementsLoaded(),
|
|
22968
|
+
total: this.getAmountAsyncElements()
|
|
22969
|
+
});
|
|
22760
22970
|
const allLoaded = this.asyncElementsLoaded();
|
|
22761
22971
|
if (allLoaded) {
|
|
22762
22972
|
this.instance.emitEvent("onAsyncElementsLoaded");
|
|
@@ -22881,6 +23091,7 @@ var Weave = class {
|
|
|
22881
23091
|
constructor(weaveConfig, stageConfig) {
|
|
22882
23092
|
globalThis._weave_isServerSide = false;
|
|
22883
23093
|
if (typeof window === "undefined") globalThis._weave_isServerSide = true;
|
|
23094
|
+
this.eventsController = void 0;
|
|
22884
23095
|
this.emitter = new Emittery();
|
|
22885
23096
|
Konva.showWarnings = false;
|
|
22886
23097
|
this.id = v4_default();
|
|
@@ -22926,6 +23137,7 @@ var Weave = class {
|
|
|
22926
23137
|
this.initialized = true;
|
|
22927
23138
|
this.status = WEAVE_INSTANCE_STATUS.RUNNING;
|
|
22928
23139
|
this.emitEvent("onInstanceStatus", this.status);
|
|
23140
|
+
this.emitEvent("onRender");
|
|
22929
23141
|
});
|
|
22930
23142
|
}
|
|
22931
23143
|
setStatus(status) {
|
|
@@ -22950,6 +23162,7 @@ var Weave = class {
|
|
|
22950
23162
|
async start() {
|
|
22951
23163
|
this.moduleLogger.info("Start instance");
|
|
22952
23164
|
if (!this.isServerSide()) {
|
|
23165
|
+
this.eventsController = new AbortController();
|
|
22953
23166
|
if (!window.weave) window.weave = this;
|
|
22954
23167
|
}
|
|
22955
23168
|
this.emitEvent("onRoomLoaded", false);
|
|
@@ -22973,8 +23186,39 @@ var Weave = class {
|
|
|
22973
23186
|
store.setup();
|
|
22974
23187
|
store.connect();
|
|
22975
23188
|
}
|
|
23189
|
+
async switchRoom() {
|
|
23190
|
+
this.moduleLogger.info(`Switching room`);
|
|
23191
|
+
const nodeHandlers = this.registerManager.getNodesHandlers();
|
|
23192
|
+
for (const nodeHandlerKey of Object.keys(nodeHandlers)) {
|
|
23193
|
+
const nodeHandler = nodeHandlers[nodeHandlerKey];
|
|
23194
|
+
nodeHandler?.onDestroyInstance();
|
|
23195
|
+
}
|
|
23196
|
+
const stage = this.getStage();
|
|
23197
|
+
if (stage) stage.destroy();
|
|
23198
|
+
if (this.eventsController) this.eventsController.abort();
|
|
23199
|
+
if (!this.isServerSide()) this.eventsController = new AbortController();
|
|
23200
|
+
this.registerManager.reset();
|
|
23201
|
+
this.asyncManager.reset();
|
|
23202
|
+
this.moduleLogger.info("Switching room instance");
|
|
23203
|
+
if (!this.isServerSide()) {
|
|
23204
|
+
if (!window.weave) window.weave = this;
|
|
23205
|
+
}
|
|
23206
|
+
this.emitEvent("onRoomLoaded", false);
|
|
23207
|
+
this.status = WEAVE_INSTANCE_STATUS.STARTING;
|
|
23208
|
+
this.emitEvent("onInstanceStatus", this.status);
|
|
23209
|
+
this.registerManager.reset();
|
|
23210
|
+
this.status = WEAVE_INSTANCE_STATUS.LOADING_FONTS;
|
|
23211
|
+
this.emitEvent("onInstanceStatus", this.status);
|
|
23212
|
+
await this.fontsManager.loadFonts();
|
|
23213
|
+
this.setupManager.setupLog();
|
|
23214
|
+
this.stageManager.initStage();
|
|
23215
|
+
this.status = WEAVE_INSTANCE_STATUS.CONNECTING_TO_ROOM;
|
|
23216
|
+
this.emitEvent("onInstanceStatus", this.status);
|
|
23217
|
+
this.addEventListener("onStoreConnectionStatusChange", this.handleStoreConnectionStatusChange.bind(this));
|
|
23218
|
+
}
|
|
22976
23219
|
destroy() {
|
|
22977
23220
|
this.moduleLogger.info(`Destroying the instance`);
|
|
23221
|
+
if (this.eventsController) this.eventsController.abort();
|
|
22978
23222
|
this.emitter.clearListeners();
|
|
22979
23223
|
this.status = WEAVE_INSTANCE_STATUS.IDLE;
|
|
22980
23224
|
this.emitEvent("onInstanceStatus", this.status);
|
|
@@ -23444,9 +23688,15 @@ var Weave = class {
|
|
|
23444
23688
|
async exportNodesServerSide(nodes, boundingNodes, options) {
|
|
23445
23689
|
return await this.exportManager.exportNodesServerSide(nodes, boundingNodes, options);
|
|
23446
23690
|
}
|
|
23691
|
+
async exportAreaServerSide(area, options) {
|
|
23692
|
+
return await this.exportManager.exportAreaServerSide(area, options);
|
|
23693
|
+
}
|
|
23447
23694
|
async exportNodes(nodes, boundingNodes, options) {
|
|
23448
23695
|
return await this.exportManager.exportNodesAsImage(nodes, boundingNodes, options);
|
|
23449
23696
|
}
|
|
23697
|
+
async exportArea(area, options) {
|
|
23698
|
+
return await this.exportManager.exportAreaAsImage(area, options);
|
|
23699
|
+
}
|
|
23450
23700
|
getExportBoundingBox(nodesIds) {
|
|
23451
23701
|
const nodes = [];
|
|
23452
23702
|
for (const nodeId of nodesIds) {
|
|
@@ -23609,6 +23859,9 @@ var Weave = class {
|
|
|
23609
23859
|
getDragProperties() {
|
|
23610
23860
|
return this.dragAndDropManager.getDragProperties();
|
|
23611
23861
|
}
|
|
23862
|
+
getEventsController() {
|
|
23863
|
+
return this.eventsController;
|
|
23864
|
+
}
|
|
23612
23865
|
};
|
|
23613
23866
|
|
|
23614
23867
|
//#endregion
|
|
@@ -23700,6 +23953,7 @@ const downscaleImageFromURL = (url, options) => {
|
|
|
23700
23953
|
//#endregion
|
|
23701
23954
|
//#region src/internal-utils/upscale.ts
|
|
23702
23955
|
const setupUpscaleStage = (instance, stage) => {
|
|
23956
|
+
if (instance.isServerSide()) return;
|
|
23703
23957
|
const config = instance.getConfiguration();
|
|
23704
23958
|
const doUpscale = config.performance?.upscale?.enabled ?? false;
|
|
23705
23959
|
if (doUpscale) {
|
|
@@ -23731,7 +23985,14 @@ const setupUpscaleStage = (instance, stage) => {
|
|
|
23731
23985
|
innerElement.style.transformOrigin = "0 0";
|
|
23732
23986
|
innerElement.style.transform = `scale(${scaleToCover})`;
|
|
23733
23987
|
}
|
|
23734
|
-
} else
|
|
23988
|
+
} else {
|
|
23989
|
+
const realContainer = stage.container();
|
|
23990
|
+
const containerWidth = realContainer.offsetWidth;
|
|
23991
|
+
const containerHeight = realContainer.offsetHeight;
|
|
23992
|
+
stage.width(containerWidth);
|
|
23993
|
+
stage.height(containerHeight);
|
|
23994
|
+
stage.setAttrs({ upscaleScale: 1 });
|
|
23995
|
+
}
|
|
23735
23996
|
};
|
|
23736
23997
|
|
|
23737
23998
|
//#endregion
|
|
@@ -23742,6 +24003,7 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23742
24003
|
wheelMousePressed = false;
|
|
23743
24004
|
isCmdCtrlPressed = false;
|
|
23744
24005
|
globalEventsInitialized = false;
|
|
24006
|
+
initialize = void 0;
|
|
23745
24007
|
onRender(props) {
|
|
23746
24008
|
const stage = new Konva.Stage({
|
|
23747
24009
|
...props,
|
|
@@ -23760,10 +24022,10 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23760
24022
|
container.setAttribute("tabindex", "0");
|
|
23761
24023
|
stage.container().addEventListener("focus", () => {
|
|
23762
24024
|
this.stageFocused = true;
|
|
23763
|
-
});
|
|
24025
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
23764
24026
|
stage.container().addEventListener("blur", () => {
|
|
23765
24027
|
this.stageFocused = false;
|
|
23766
|
-
});
|
|
24028
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
23767
24029
|
}
|
|
23768
24030
|
Konva.Stage.prototype.mode = function(mode) {
|
|
23769
24031
|
if (typeof mode !== "undefined") this._mode = mode;
|
|
@@ -23833,7 +24095,7 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23833
24095
|
const selectedNode = transformer.nodes()[0];
|
|
23834
24096
|
selectedNode.fire("onCmdCtrlPressed");
|
|
23835
24097
|
}
|
|
23836
|
-
});
|
|
24098
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
23837
24099
|
window.addEventListener("keyup", (e) => {
|
|
23838
24100
|
if (!(e.ctrlKey || e.metaKey)) {
|
|
23839
24101
|
this.isCmdCtrlPressed = false;
|
|
@@ -23844,7 +24106,7 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23844
24106
|
const selectedNode = transformer.nodes()[0];
|
|
23845
24107
|
selectedNode.fire("onCmdCtrlReleased");
|
|
23846
24108
|
}
|
|
23847
|
-
});
|
|
24109
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
23848
24110
|
this.globalEventsInitialized = true;
|
|
23849
24111
|
}
|
|
23850
24112
|
isOnlyCtrlOrMeta(event) {
|
|
@@ -23864,6 +24126,7 @@ const WEAVE_LAYER_NODE_TYPE = "layer";
|
|
|
23864
24126
|
//#region src/nodes/layer/layer.ts
|
|
23865
24127
|
var WeaveLayerNode = class extends WeaveNode {
|
|
23866
24128
|
nodeType = WEAVE_LAYER_NODE_TYPE;
|
|
24129
|
+
initialize = void 0;
|
|
23867
24130
|
onRender(props) {
|
|
23868
24131
|
const layer = new Konva.Layer({ ...props });
|
|
23869
24132
|
layer.canMoveToContainer = function() {
|
|
@@ -23911,6 +24174,7 @@ const WEAVE_GROUP_NODE_TYPE = "group";
|
|
|
23911
24174
|
//#region src/nodes/group/group.ts
|
|
23912
24175
|
var WeaveGroupNode = class extends WeaveNode {
|
|
23913
24176
|
nodeType = WEAVE_GROUP_NODE_TYPE;
|
|
24177
|
+
initialize = void 0;
|
|
23914
24178
|
constructor(params) {
|
|
23915
24179
|
super();
|
|
23916
24180
|
const { config } = params ?? {};
|
|
@@ -24003,6 +24267,7 @@ const WEAVE_RECTANGLE_NODE_TYPE = "rectangle";
|
|
|
24003
24267
|
//#region src/nodes/rectangle/rectangle.ts
|
|
24004
24268
|
var WeaveRectangleNode = class extends WeaveNode {
|
|
24005
24269
|
nodeType = WEAVE_RECTANGLE_NODE_TYPE;
|
|
24270
|
+
initialize = void 0;
|
|
24006
24271
|
constructor(params) {
|
|
24007
24272
|
super();
|
|
24008
24273
|
const { config } = params ?? {};
|
|
@@ -24046,6 +24311,7 @@ const WEAVE_ELLIPSE_NODE_TYPE = "ellipse";
|
|
|
24046
24311
|
//#region src/nodes/ellipse/ellipse.ts
|
|
24047
24312
|
var WeaveEllipseNode = class extends WeaveNode {
|
|
24048
24313
|
nodeType = WEAVE_ELLIPSE_NODE_TYPE;
|
|
24314
|
+
initialize = void 0;
|
|
24049
24315
|
constructor(params) {
|
|
24050
24316
|
super();
|
|
24051
24317
|
const { config } = params ?? {};
|
|
@@ -24191,13 +24457,16 @@ var WeaveLineNode = class extends WeaveNode {
|
|
|
24191
24457
|
constructor(params) {
|
|
24192
24458
|
super();
|
|
24193
24459
|
this.config = mergeExceptArrays(WEAVE_LINE_NODE_DEFAULT_CONFIG, params?.config ?? {});
|
|
24194
|
-
this.handleNodeChanges = null;
|
|
24195
|
-
this.handleZoomChanges = null;
|
|
24196
24460
|
this.snapper = new GreedySnapper({
|
|
24197
24461
|
snapAngles: this.config.snapAngles.angles,
|
|
24198
24462
|
activateThreshold: this.config.snapAngles.activateThreshold,
|
|
24199
24463
|
releaseThreshold: this.config.snapAngles.releaseThreshold
|
|
24200
24464
|
});
|
|
24465
|
+
this.initialize();
|
|
24466
|
+
}
|
|
24467
|
+
initialize() {
|
|
24468
|
+
this.handleNodeChanges = null;
|
|
24469
|
+
this.handleZoomChanges = null;
|
|
24201
24470
|
}
|
|
24202
24471
|
onRender(props) {
|
|
24203
24472
|
const line = new Konva.Line({
|
|
@@ -24502,17 +24771,19 @@ const TEXT_LAYOUT = {
|
|
|
24502
24771
|
//#region src/nodes/text/text.ts
|
|
24503
24772
|
var WeaveTextNode = class extends WeaveNode {
|
|
24504
24773
|
nodeType = WEAVE_TEXT_NODE_TYPE;
|
|
24505
|
-
editing = false;
|
|
24506
|
-
textAreaSuperContainer = null;
|
|
24507
|
-
textAreaContainer = null;
|
|
24508
|
-
textArea = null;
|
|
24509
|
-
eventsInitialized = false;
|
|
24510
|
-
isCtrlMetaPressed = false;
|
|
24511
24774
|
constructor(params) {
|
|
24512
24775
|
super();
|
|
24513
24776
|
const { config } = params ?? {};
|
|
24514
24777
|
this.config = (0, import_lodash.merge)({}, WEAVE_TEXT_NODE_DEFAULT_CONFIG, config);
|
|
24778
|
+
this.initialize();
|
|
24779
|
+
}
|
|
24780
|
+
initialize() {
|
|
24515
24781
|
this.keyPressHandler = void 0;
|
|
24782
|
+
this.eventsInitialized = false;
|
|
24783
|
+
this.isCtrlMetaPressed = false;
|
|
24784
|
+
this.textAreaSuperContainer = null;
|
|
24785
|
+
this.textAreaContainer = null;
|
|
24786
|
+
this.textArea = null;
|
|
24516
24787
|
this.editing = false;
|
|
24517
24788
|
this.textArea = null;
|
|
24518
24789
|
}
|
|
@@ -24520,10 +24791,10 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24520
24791
|
if (!this.eventsInitialized && !globalThis._weave_isServerSide) {
|
|
24521
24792
|
window.addEventListener("keydown", (e) => {
|
|
24522
24793
|
if (e.ctrlKey || e.metaKey) this.isCtrlMetaPressed = true;
|
|
24523
|
-
});
|
|
24794
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24524
24795
|
window.addEventListener("keyup", (e) => {
|
|
24525
24796
|
if (!(e.ctrlKey || e.metaKey)) this.isCtrlMetaPressed = false;
|
|
24526
|
-
});
|
|
24797
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24527
24798
|
this.eventsInitialized = true;
|
|
24528
24799
|
}
|
|
24529
24800
|
}
|
|
@@ -24551,7 +24822,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24551
24822
|
onAdd() {
|
|
24552
24823
|
if (!this.instance.isServerSide() && !this.keyPressHandler) {
|
|
24553
24824
|
this.keyPressHandler = this.handleKeyPress.bind(this);
|
|
24554
|
-
window.addEventListener("keypress", this.keyPressHandler);
|
|
24825
|
+
window.addEventListener("keypress", this.keyPressHandler, { signal: this.instance.getEventsController()?.signal });
|
|
24555
24826
|
}
|
|
24556
24827
|
}
|
|
24557
24828
|
onRender(props) {
|
|
@@ -24705,7 +24976,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24705
24976
|
});
|
|
24706
24977
|
if (!this.instance.isServerSide() && !this.keyPressHandler) {
|
|
24707
24978
|
this.keyPressHandler = this.handleKeyPress.bind(this);
|
|
24708
|
-
window.addEventListener("keypress", this.keyPressHandler);
|
|
24979
|
+
window.addEventListener("keypress", this.keyPressHandler, { signal: this.instance.getEventsController()?.signal });
|
|
24709
24980
|
}
|
|
24710
24981
|
return text;
|
|
24711
24982
|
}
|
|
@@ -24964,17 +25235,17 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24964
25235
|
this.textAreaSuperContainer.scrollTop = 0;
|
|
24965
25236
|
this.textAreaSuperContainer.scrollLeft = 0;
|
|
24966
25237
|
}
|
|
24967
|
-
});
|
|
25238
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24968
25239
|
this.textAreaContainer.addEventListener("scroll", () => {
|
|
24969
25240
|
if (!this.textAreaContainer) return;
|
|
24970
25241
|
this.textAreaContainer.scrollTop = 0;
|
|
24971
25242
|
this.textAreaContainer.scrollLeft = 0;
|
|
24972
|
-
});
|
|
25243
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24973
25244
|
this.textArea.addEventListener("scroll", () => {
|
|
24974
25245
|
if (!this.textArea) return;
|
|
24975
25246
|
this.textArea.scrollTop = 0;
|
|
24976
25247
|
this.textArea.scrollLeft = 0;
|
|
24977
|
-
});
|
|
25248
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24978
25249
|
const rotation = textNode.getAbsoluteRotation();
|
|
24979
25250
|
if (rotation) {
|
|
24980
25251
|
const transform = "rotate(" + rotation + "deg)";
|
|
@@ -25023,8 +25294,8 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
25023
25294
|
this.textAreaDomResize(textNode);
|
|
25024
25295
|
}
|
|
25025
25296
|
};
|
|
25026
|
-
this.textArea.addEventListener("keydown", handleKeyDown);
|
|
25027
|
-
this.textArea.addEventListener("keyup", handleKeyUp);
|
|
25297
|
+
this.textArea.addEventListener("keydown", handleKeyDown, { signal: this.instance.getEventsController()?.signal });
|
|
25298
|
+
this.textArea.addEventListener("keyup", handleKeyUp, { signal: this.instance.getEventsController()?.signal });
|
|
25028
25299
|
this.textArea.tabIndex = 1;
|
|
25029
25300
|
this.textArea.focus();
|
|
25030
25301
|
const handleOutsideClick = (e) => {
|
|
@@ -25050,7 +25321,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
25050
25321
|
}
|
|
25051
25322
|
};
|
|
25052
25323
|
setTimeout(() => {
|
|
25053
|
-
window.addEventListener("pointerup", handleOutsideClick);
|
|
25324
|
+
window.addEventListener("pointerup", handleOutsideClick, { signal: this.instance.getEventsController()?.signal });
|
|
25054
25325
|
}, 0);
|
|
25055
25326
|
this.instance.getStage().mode(WEAVE_STAGE_TEXT_EDITION_MODE);
|
|
25056
25327
|
this.editing = true;
|
|
@@ -25386,7 +25657,7 @@ var WeaveImageCrop = class WeaveImageCrop {
|
|
|
25386
25657
|
utilityLayer?.add(this.transformer);
|
|
25387
25658
|
this.transformer?.forceUpdate();
|
|
25388
25659
|
this.cropGroup.show();
|
|
25389
|
-
window.addEventListener("keydown", this.handleHide);
|
|
25660
|
+
window.addEventListener("keydown", this.handleHide, { signal: this.instance.getEventsController()?.signal });
|
|
25390
25661
|
if (options.cmdCtrl.triggered) {
|
|
25391
25662
|
utilityLayer?.hide();
|
|
25392
25663
|
const stage = this.instance.getStage();
|
|
@@ -25836,24 +26107,21 @@ const isAllowedUrl = (value) => {
|
|
|
25836
26107
|
//#endregion
|
|
25837
26108
|
//#region src/nodes/image/image.ts
|
|
25838
26109
|
var WeaveImageNode = class extends WeaveNode {
|
|
25839
|
-
imageBitmapCache = {};
|
|
25840
|
-
imageSource = {};
|
|
25841
|
-
imageFallback = {};
|
|
25842
|
-
imageState = {};
|
|
25843
|
-
imageTryoutAttempts = {};
|
|
25844
|
-
imageTryoutIds = {};
|
|
25845
26110
|
nodeType = WEAVE_IMAGE_NODE_TYPE;
|
|
25846
26111
|
cursorsFallback = { loading: "wait" };
|
|
25847
26112
|
cursors = {};
|
|
25848
26113
|
constructor(params) {
|
|
25849
26114
|
super();
|
|
25850
26115
|
const { config } = params ?? {};
|
|
26116
|
+
this.config = mergeExceptArrays(WEAVE_IMAGE_DEFAULT_CONFIG, config);
|
|
26117
|
+
this.initialize();
|
|
26118
|
+
}
|
|
26119
|
+
initialize() {
|
|
25851
26120
|
this.tapStart = {
|
|
25852
26121
|
x: 0,
|
|
25853
26122
|
y: 0,
|
|
25854
26123
|
time: 0
|
|
25855
26124
|
};
|
|
25856
|
-
this.config = mergeExceptArrays(WEAVE_IMAGE_DEFAULT_CONFIG, config);
|
|
25857
26125
|
this.imageCrop = null;
|
|
25858
26126
|
this.imageBitmapCache = {};
|
|
25859
26127
|
this.imageSource = {};
|
|
@@ -26077,7 +26345,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26077
26345
|
};
|
|
26078
26346
|
this.updateImageCrop(image);
|
|
26079
26347
|
} else {
|
|
26080
|
-
this.updatePlaceholderSize(image
|
|
26348
|
+
this.updatePlaceholderSize(image);
|
|
26081
26349
|
this.loadImage(imageProps, image, true);
|
|
26082
26350
|
}
|
|
26083
26351
|
if (this.config.performance.cache.enabled) image.on("transformend", () => {
|
|
@@ -26460,7 +26728,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26460
26728
|
}
|
|
26461
26729
|
this.loadAsyncElement(id);
|
|
26462
26730
|
preloadFunction(id, realImageURL ?? "", {
|
|
26463
|
-
onLoad: () => {
|
|
26731
|
+
onLoad: async () => {
|
|
26464
26732
|
if (useFallback) this.imageTryoutIds[id] = setTimeout(() => {
|
|
26465
26733
|
const node = this.instance.getStage().findOne(`#${id}`);
|
|
26466
26734
|
if (node) {
|
|
@@ -26511,7 +26779,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26511
26779
|
error: false
|
|
26512
26780
|
};
|
|
26513
26781
|
this.updateImageCrop(image);
|
|
26514
|
-
this.resolveAsyncElement(id);
|
|
26782
|
+
if (!useFallback) this.resolveAsyncElement(id);
|
|
26515
26783
|
this.cacheNode(image);
|
|
26516
26784
|
}
|
|
26517
26785
|
},
|
|
@@ -26552,13 +26820,9 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26552
26820
|
}
|
|
26553
26821
|
}, loadTryout);
|
|
26554
26822
|
}
|
|
26555
|
-
updatePlaceholderSize(image
|
|
26823
|
+
updatePlaceholderSize(image) {
|
|
26556
26824
|
const imageAttrs = image.getAttrs();
|
|
26557
26825
|
if (!this.imageState[imageAttrs.id ?? ""]?.loaded) return;
|
|
26558
|
-
if (!imageAttrs.adding && !imageAttrs.cropInfo) {
|
|
26559
|
-
imagePlaceholder.width(imageAttrs.uncroppedImage.width);
|
|
26560
|
-
imagePlaceholder.height(imageAttrs.uncroppedImage.height);
|
|
26561
|
-
}
|
|
26562
26826
|
}
|
|
26563
26827
|
updateImageCrop(image) {
|
|
26564
26828
|
const imageAttrs = image.getAttrs();
|
|
@@ -26692,6 +26956,7 @@ const WEAVE_STAR_NODE_TYPE = "star";
|
|
|
26692
26956
|
//#region src/nodes/star/star.ts
|
|
26693
26957
|
var WeaveStarNode = class extends WeaveNode {
|
|
26694
26958
|
nodeType = WEAVE_STAR_NODE_TYPE;
|
|
26959
|
+
initialize = void 0;
|
|
26695
26960
|
constructor(params) {
|
|
26696
26961
|
super();
|
|
26697
26962
|
const { config } = params ?? {};
|
|
@@ -26777,6 +27042,7 @@ const WEAVE_ARROW_NODE_TYPE = "arrow";
|
|
|
26777
27042
|
//#region src/nodes/arrow/arrow.ts
|
|
26778
27043
|
var WeaveArrowNode = class extends WeaveNode {
|
|
26779
27044
|
nodeType = WEAVE_ARROW_NODE_TYPE;
|
|
27045
|
+
initialize = void 0;
|
|
26780
27046
|
constructor(params) {
|
|
26781
27047
|
super();
|
|
26782
27048
|
const { config } = params ?? {};
|
|
@@ -26833,6 +27099,7 @@ const WEAVE_REGULAR_POLYGON_NODE_TYPE = "regular-polygon";
|
|
|
26833
27099
|
//#region src/nodes/regular-polygon/regular-polygon.ts
|
|
26834
27100
|
var WeaveRegularPolygonNode = class extends WeaveNode {
|
|
26835
27101
|
nodeType = WEAVE_REGULAR_POLYGON_NODE_TYPE;
|
|
27102
|
+
initialize = void 0;
|
|
26836
27103
|
constructor(params) {
|
|
26837
27104
|
super();
|
|
26838
27105
|
const { config } = params ?? {};
|
|
@@ -26946,6 +27213,7 @@ var GroupFrame = class extends Konva.Group {
|
|
|
26946
27213
|
//#region src/nodes/frame/frame.ts
|
|
26947
27214
|
var WeaveFrameNode = class extends WeaveNode {
|
|
26948
27215
|
nodeType = WEAVE_FRAME_NODE_TYPE;
|
|
27216
|
+
initialize = void 0;
|
|
26949
27217
|
constructor(params) {
|
|
26950
27218
|
super();
|
|
26951
27219
|
const { config } = params ?? {};
|
|
@@ -27246,6 +27514,7 @@ const WEAVE_STROKE_NODE_DEFAULT_CONFIG = {
|
|
|
27246
27514
|
//#region src/nodes/stroke/stroke.ts
|
|
27247
27515
|
var WeaveStrokeNode = class extends WeaveNode {
|
|
27248
27516
|
nodeType = WEAVE_STROKE_NODE_TYPE;
|
|
27517
|
+
initialize = void 0;
|
|
27249
27518
|
constructor(params) {
|
|
27250
27519
|
super();
|
|
27251
27520
|
const { config } = params ?? {};
|
|
@@ -27822,8 +28091,6 @@ var WeaveSquareLineTipManager = class extends WeaveBaseLineTipManager {
|
|
|
27822
28091
|
//#endregion
|
|
27823
28092
|
//#region src/nodes/stroke-single/stroke-single.ts
|
|
27824
28093
|
var WeaveStrokeSingleNode = class extends WeaveNode {
|
|
27825
|
-
startHandle = null;
|
|
27826
|
-
endHandle = null;
|
|
27827
28094
|
nodeType = WEAVE_STROKE_SINGLE_NODE_TYPE;
|
|
27828
28095
|
tipManagers = {
|
|
27829
28096
|
[WEAVE_STROKE_SINGLE_NODE_TIP_TYPE.ARROW]: new WeaveArrowLineTipManager(),
|
|
@@ -27834,24 +28101,29 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
|
|
|
27834
28101
|
constructor(params) {
|
|
27835
28102
|
super();
|
|
27836
28103
|
this.config = mergeExceptArrays(WEAVE_STROKE_SINGLE_NODE_DEFAULT_CONFIG, params?.config ?? {});
|
|
27837
|
-
this.handleNodeChanges = null;
|
|
27838
|
-
this.handleZoomChanges = null;
|
|
27839
|
-
this.shiftPressed = false;
|
|
27840
28104
|
this.snapper = new GreedySnapper({
|
|
27841
28105
|
snapAngles: this.config.snapAngles.angles,
|
|
27842
28106
|
activateThreshold: this.config.snapAngles.activateThreshold,
|
|
27843
28107
|
releaseThreshold: this.config.snapAngles.releaseThreshold
|
|
27844
28108
|
});
|
|
28109
|
+
this.initialize();
|
|
28110
|
+
}
|
|
28111
|
+
initialize() {
|
|
27845
28112
|
this.eventsInitialized = false;
|
|
28113
|
+
this.startHandle = null;
|
|
28114
|
+
this.endHandle = null;
|
|
28115
|
+
this.handleNodeChanges = null;
|
|
28116
|
+
this.handleZoomChanges = null;
|
|
28117
|
+
this.shiftPressed = false;
|
|
27846
28118
|
}
|
|
27847
28119
|
initEvents() {
|
|
27848
28120
|
if (this.eventsInitialized) return;
|
|
27849
28121
|
window.addEventListener("keydown", (e) => {
|
|
27850
28122
|
if (e.key === "Shift") this.shiftPressed = true;
|
|
27851
|
-
});
|
|
28123
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
27852
28124
|
window.addEventListener("keyup", (e) => {
|
|
27853
28125
|
if (e.key === "Shift") this.shiftPressed = false;
|
|
27854
|
-
});
|
|
28126
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
27855
28127
|
this.eventsInitialized = true;
|
|
27856
28128
|
}
|
|
27857
28129
|
onRender(props) {
|
|
@@ -28338,6 +28610,9 @@ var WeaveCommentNode = class extends WeaveNode {
|
|
|
28338
28610
|
constructor(params) {
|
|
28339
28611
|
super();
|
|
28340
28612
|
this.config = mergeExceptArrays(WEAVE_COMMENT_NODE_DEFAULTS, params.config);
|
|
28613
|
+
this.initialize();
|
|
28614
|
+
}
|
|
28615
|
+
initialize() {
|
|
28341
28616
|
this.commentDomVisibleId = null;
|
|
28342
28617
|
this.commentDomVisible = false;
|
|
28343
28618
|
this.commentDomAction = null;
|
|
@@ -28966,10 +29241,6 @@ const WEAVE_VIDEO_DEFAULT_CONFIG = {
|
|
|
28966
29241
|
//#endregion
|
|
28967
29242
|
//#region src/nodes/video/video.ts
|
|
28968
29243
|
var WeaveVideoNode = class extends WeaveNode {
|
|
28969
|
-
videoState = {};
|
|
28970
|
-
videoSourceFrameId = {};
|
|
28971
|
-
videoSource = {};
|
|
28972
|
-
videoPlaceholder = {};
|
|
28973
29244
|
nodeType = WEAVE_VIDEO_NODE_TYPE;
|
|
28974
29245
|
constructor(params) {
|
|
28975
29246
|
super();
|
|
@@ -28982,6 +29253,13 @@ var WeaveVideoNode = class extends WeaveNode {
|
|
|
28982
29253
|
this.videoIconImage.src = this.config.style.icon.dataURL;
|
|
28983
29254
|
}
|
|
28984
29255
|
}
|
|
29256
|
+
initialize() {
|
|
29257
|
+
this.videoState = {};
|
|
29258
|
+
this.videoSource = {};
|
|
29259
|
+
this.videoSourceFrameId = {};
|
|
29260
|
+
this.videoPlaceholder = {};
|
|
29261
|
+
this.videoIconImage = void 0;
|
|
29262
|
+
}
|
|
28985
29263
|
async loadPlaceholder(params, video) {
|
|
28986
29264
|
const videoProps = params;
|
|
28987
29265
|
const { id } = videoProps;
|
|
@@ -29476,6 +29754,7 @@ const WEAVE_MEASURE_NODE_DEFAULT_CONFIG = { style: {
|
|
|
29476
29754
|
var WeaveMeasureNode = class extends WeaveNode {
|
|
29477
29755
|
nodeType = WEAVE_MEASURE_NODE_TYPE;
|
|
29478
29756
|
handlePointCircleRadius = 6;
|
|
29757
|
+
initialize = void 0;
|
|
29479
29758
|
constructor(params) {
|
|
29480
29759
|
super();
|
|
29481
29760
|
this.config = mergeExceptArrays(WEAVE_MEASURE_NODE_DEFAULT_CONFIG, params?.config ?? {});
|
|
@@ -30766,6 +31045,7 @@ var WeaveConnectorNode = class extends WeaveNode {
|
|
|
30766
31045
|
[WEAVE_CONNECTOR_NODE_DECORATOR_TYPE.DOT]: setupNodeDecoratorDot,
|
|
30767
31046
|
[WEAVE_CONNECTOR_NODE_DECORATOR_TYPE.ARROW]: setupNodeDecoratorArrow
|
|
30768
31047
|
};
|
|
31048
|
+
initialize = void 0;
|
|
30769
31049
|
constructor(params) {
|
|
30770
31050
|
super();
|
|
30771
31051
|
this.config = mergeExceptArrays(WEAVE_CONNECTOR_NODE_DEFAULT_CONFIG, params?.config);
|
|
@@ -31516,10 +31796,6 @@ const WEAVE_STAGE_ZOOM_DEFAULT_CONFIG = {
|
|
|
31516
31796
|
var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
31517
31797
|
getLayerName = void 0;
|
|
31518
31798
|
initLayer = void 0;
|
|
31519
|
-
pinching = false;
|
|
31520
|
-
zooming = false;
|
|
31521
|
-
isTrackpad = false;
|
|
31522
|
-
zoomVelocity = 0;
|
|
31523
31799
|
zoomInertiaType = WEAVE_STAGE_ZOOM_TYPE.MOUSE_WHEEL;
|
|
31524
31800
|
defaultStep = 3;
|
|
31525
31801
|
constructor(params) {
|
|
@@ -31527,8 +31803,13 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31527
31803
|
const { config } = params ?? {};
|
|
31528
31804
|
this.config = mergeExceptArrays(WEAVE_STAGE_ZOOM_DEFAULT_CONFIG, config);
|
|
31529
31805
|
if (!this.config.zoomSteps.includes(this.config.defaultZoom)) throw new Error(`Default zoom ${this.config.defaultZoom} is not in zoom steps`);
|
|
31806
|
+
this.initialize();
|
|
31807
|
+
}
|
|
31808
|
+
initialize() {
|
|
31530
31809
|
this.pinching = false;
|
|
31810
|
+
this.zooming = false;
|
|
31531
31811
|
this.isTrackpad = false;
|
|
31812
|
+
this.zoomVelocity = 0;
|
|
31532
31813
|
this.isCtrlOrMetaPressed = false;
|
|
31533
31814
|
this.updatedMinimumZoom = false;
|
|
31534
31815
|
this.actualStep = this.config.zoomSteps.findIndex((step) => step === this.config.defaultZoom);
|
|
@@ -31815,6 +32096,15 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31815
32096
|
if (box.width === 0 || box.height === 0) return;
|
|
31816
32097
|
this.fitToElements(box, finalOptions);
|
|
31817
32098
|
}
|
|
32099
|
+
fitToArea(area, options) {
|
|
32100
|
+
const finalOptions = mergeExceptArrays({
|
|
32101
|
+
smartZoom: false,
|
|
32102
|
+
overrideZoom: true
|
|
32103
|
+
}, options);
|
|
32104
|
+
if (!this.enabled) return;
|
|
32105
|
+
if (area.width === 0 || area.height === 0) return;
|
|
32106
|
+
this.fitToElements(area, finalOptions);
|
|
32107
|
+
}
|
|
31818
32108
|
enable() {
|
|
31819
32109
|
this.enabled = true;
|
|
31820
32110
|
}
|
|
@@ -31833,10 +32123,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31833
32123
|
initEvents() {
|
|
31834
32124
|
window.addEventListener("keydown", (e) => {
|
|
31835
32125
|
if (e.ctrlKey || e.metaKey) this.isCtrlOrMetaPressed = true;
|
|
31836
|
-
});
|
|
32126
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
31837
32127
|
window.addEventListener("keyup", (e) => {
|
|
31838
32128
|
if (!(e.ctrlKey || e.metaKey)) this.isCtrlOrMetaPressed = false;
|
|
31839
|
-
});
|
|
32129
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
31840
32130
|
const stage = this.instance.getStage();
|
|
31841
32131
|
let lastCenter = null;
|
|
31842
32132
|
let lastDist = 0;
|
|
@@ -31861,7 +32151,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31861
32151
|
return;
|
|
31862
32152
|
}
|
|
31863
32153
|
}
|
|
31864
|
-
}, {
|
|
32154
|
+
}, {
|
|
32155
|
+
passive: false,
|
|
32156
|
+
signal: this.instance.getEventsController()?.signal
|
|
32157
|
+
});
|
|
31865
32158
|
stage.getContent().addEventListener("touchmove", (e) => {
|
|
31866
32159
|
e.preventDefault();
|
|
31867
32160
|
if (e.touches.length === 2) {
|
|
@@ -31901,12 +32194,18 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31901
32194
|
lastDist = dist;
|
|
31902
32195
|
lastCenter = newCenter;
|
|
31903
32196
|
}
|
|
31904
|
-
}, {
|
|
32197
|
+
}, {
|
|
32198
|
+
passive: false,
|
|
32199
|
+
signal: this.instance.getEventsController()?.signal
|
|
32200
|
+
});
|
|
31905
32201
|
stage.getContent().addEventListener("touchend", () => {
|
|
31906
32202
|
this.pinching = false;
|
|
31907
32203
|
lastDist = 0;
|
|
31908
32204
|
lastCenter = null;
|
|
31909
|
-
}, {
|
|
32205
|
+
}, {
|
|
32206
|
+
passive: false,
|
|
32207
|
+
signal: this.instance.getEventsController()?.signal
|
|
32208
|
+
});
|
|
31910
32209
|
let doZoom = false;
|
|
31911
32210
|
const handleWheelImmediate = (e) => {
|
|
31912
32211
|
const performZoom = this.isCtrlOrMetaPressed || !this.isCtrlOrMetaPressed && e.ctrlKey && e.deltaMode === 0;
|
|
@@ -31924,7 +32223,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31924
32223
|
e.preventDefault();
|
|
31925
32224
|
doZoom = true;
|
|
31926
32225
|
};
|
|
31927
|
-
window.addEventListener("wheel", handleWheelImmediate, {
|
|
32226
|
+
window.addEventListener("wheel", handleWheelImmediate, {
|
|
32227
|
+
signal: this.instance.getEventsController()?.signal,
|
|
32228
|
+
passive: false
|
|
32229
|
+
});
|
|
31928
32230
|
const handleWheel = (e) => {
|
|
31929
32231
|
if (!doZoom) return;
|
|
31930
32232
|
const delta = e.deltaY > 0 ? 1 : -1;
|
|
@@ -31937,7 +32239,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31937
32239
|
}
|
|
31938
32240
|
};
|
|
31939
32241
|
const throttledHandleWheel = (0, import_lodash.throttle)(handleWheel, DEFAULT_THROTTLE_MS);
|
|
31940
|
-
window.addEventListener("wheel", throttledHandleWheel, {
|
|
32242
|
+
window.addEventListener("wheel", throttledHandleWheel, {
|
|
32243
|
+
signal: this.instance.getEventsController()?.signal,
|
|
32244
|
+
passive: true
|
|
32245
|
+
});
|
|
31941
32246
|
}
|
|
31942
32247
|
getInertiaScale() {
|
|
31943
32248
|
const stage = this.instance.getStage();
|
|
@@ -31995,6 +32300,7 @@ const ZOOM_OUT_TOOL_ACTION_NAME = "zoomOutTool";
|
|
|
31995
32300
|
//#region src/actions/zoom-out-tool/zoom-out-tool.ts
|
|
31996
32301
|
var WeaveZoomOutToolAction = class extends WeaveAction {
|
|
31997
32302
|
onPropsChange = void 0;
|
|
32303
|
+
initialize = void 0;
|
|
31998
32304
|
getName() {
|
|
31999
32305
|
return ZOOM_OUT_TOOL_ACTION_NAME;
|
|
32000
32306
|
}
|
|
@@ -32029,6 +32335,10 @@ const ZOOM_IN_TOOL_ACTION_NAME = "zoomInTool";
|
|
|
32029
32335
|
//#region src/actions/zoom-in-tool/zoom-in-tool.ts
|
|
32030
32336
|
var WeaveZoomInToolAction = class extends WeaveAction {
|
|
32031
32337
|
onPropsChange = void 0;
|
|
32338
|
+
initialize = void 0;
|
|
32339
|
+
constructor() {
|
|
32340
|
+
super();
|
|
32341
|
+
}
|
|
32032
32342
|
getName() {
|
|
32033
32343
|
return ZOOM_IN_TOOL_ACTION_NAME;
|
|
32034
32344
|
}
|
|
@@ -32063,6 +32373,10 @@ const FIT_TO_SCREEN_TOOL_ACTION_NAME = "fitToScreenTool";
|
|
|
32063
32373
|
//#region src/actions/fit-to-screen-tool/fit-to-screen-tool.ts
|
|
32064
32374
|
var WeaveFitToScreenToolAction = class extends WeaveAction {
|
|
32065
32375
|
onPropsChange = void 0;
|
|
32376
|
+
initialize = void 0;
|
|
32377
|
+
constructor() {
|
|
32378
|
+
super();
|
|
32379
|
+
}
|
|
32066
32380
|
getName() {
|
|
32067
32381
|
return FIT_TO_SCREEN_TOOL_ACTION_NAME;
|
|
32068
32382
|
}
|
|
@@ -32096,6 +32410,10 @@ const FIT_TO_SELECTION_TOOL_ACTION_NAME = "fitToSelectionTool";
|
|
|
32096
32410
|
//#region src/actions/fit-to-selection-tool/fit-to-selection-tool.ts
|
|
32097
32411
|
var WeaveFitToSelectionToolAction = class extends WeaveAction {
|
|
32098
32412
|
onPropsChange = void 0;
|
|
32413
|
+
initialize = void 0;
|
|
32414
|
+
constructor() {
|
|
32415
|
+
super();
|
|
32416
|
+
}
|
|
32099
32417
|
getName() {
|
|
32100
32418
|
return FIT_TO_SELECTION_TOOL_ACTION_NAME;
|
|
32101
32419
|
}
|
|
@@ -32138,6 +32456,9 @@ var WeaveMoveToolAction = class extends WeaveAction {
|
|
|
32138
32456
|
onInit = void 0;
|
|
32139
32457
|
constructor() {
|
|
32140
32458
|
super();
|
|
32459
|
+
this.initialize();
|
|
32460
|
+
}
|
|
32461
|
+
initialize() {
|
|
32141
32462
|
this.initialized = false;
|
|
32142
32463
|
this.state = MOVE_TOOL_STATE.IDLE;
|
|
32143
32464
|
}
|
|
@@ -32151,7 +32472,7 @@ var WeaveMoveToolAction = class extends WeaveAction {
|
|
|
32151
32472
|
this.cancelAction();
|
|
32152
32473
|
return;
|
|
32153
32474
|
}
|
|
32154
|
-
});
|
|
32475
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32155
32476
|
stage.on("pointerdown", () => {
|
|
32156
32477
|
if ([MOVE_TOOL_ACTION_NAME].includes(this.instance.getActiveAction() ?? "")) stage.container().style.cursor = "grabbing";
|
|
32157
32478
|
});
|
|
@@ -32210,6 +32531,9 @@ var WeaveSelectionToolAction = class extends WeaveAction {
|
|
|
32210
32531
|
onInit = void 0;
|
|
32211
32532
|
constructor() {
|
|
32212
32533
|
super();
|
|
32534
|
+
this.initialize();
|
|
32535
|
+
}
|
|
32536
|
+
initialize() {
|
|
32213
32537
|
this.initialized = false;
|
|
32214
32538
|
this.state = SELECTION_TOOL_STATE.IDLE;
|
|
32215
32539
|
}
|
|
@@ -32273,6 +32597,9 @@ var WeaveEraserToolAction = class extends WeaveAction {
|
|
|
32273
32597
|
onInit = void 0;
|
|
32274
32598
|
constructor() {
|
|
32275
32599
|
super();
|
|
32600
|
+
this.initialize();
|
|
32601
|
+
}
|
|
32602
|
+
initialize() {
|
|
32276
32603
|
this.initialized = false;
|
|
32277
32604
|
this.erasing = false;
|
|
32278
32605
|
this.state = ERASER_TOOL_STATE.IDLE;
|
|
@@ -32306,7 +32633,7 @@ var WeaveEraserToolAction = class extends WeaveAction {
|
|
|
32306
32633
|
this.cancelAction();
|
|
32307
32634
|
return;
|
|
32308
32635
|
}
|
|
32309
|
-
});
|
|
32636
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32310
32637
|
this.initialized = true;
|
|
32311
32638
|
}
|
|
32312
32639
|
setState(state) {
|
|
@@ -32373,6 +32700,9 @@ var WeaveRectangleToolAction = class extends WeaveAction {
|
|
|
32373
32700
|
onInit = void 0;
|
|
32374
32701
|
constructor() {
|
|
32375
32702
|
super();
|
|
32703
|
+
this.initialize();
|
|
32704
|
+
}
|
|
32705
|
+
initialize() {
|
|
32376
32706
|
this.pointers = new Map();
|
|
32377
32707
|
this.initialized = false;
|
|
32378
32708
|
this.state = RECTANGLE_TOOL_STATE.IDLE;
|
|
@@ -32408,7 +32738,7 @@ var WeaveRectangleToolAction = class extends WeaveAction {
|
|
|
32408
32738
|
this.cancelAction();
|
|
32409
32739
|
return;
|
|
32410
32740
|
}
|
|
32411
|
-
});
|
|
32741
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32412
32742
|
stage.on("pointermove", () => {
|
|
32413
32743
|
if (this.state === RECTANGLE_TOOL_STATE.IDLE) return;
|
|
32414
32744
|
this.setCursor();
|
|
@@ -32582,6 +32912,9 @@ var WeaveEllipseToolAction = class extends WeaveAction {
|
|
|
32582
32912
|
onInit = void 0;
|
|
32583
32913
|
constructor() {
|
|
32584
32914
|
super();
|
|
32915
|
+
this.initialize();
|
|
32916
|
+
}
|
|
32917
|
+
initialize() {
|
|
32585
32918
|
this.pointers = new Map();
|
|
32586
32919
|
this.initialized = false;
|
|
32587
32920
|
this.state = ELLIPSE_TOOL_STATE.IDLE;
|
|
@@ -32617,7 +32950,7 @@ var WeaveEllipseToolAction = class extends WeaveAction {
|
|
|
32617
32950
|
this.cancelAction();
|
|
32618
32951
|
return;
|
|
32619
32952
|
}
|
|
32620
|
-
});
|
|
32953
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32621
32954
|
stage.on("pointerdown", (e) => {
|
|
32622
32955
|
this.setTapStart(e);
|
|
32623
32956
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -32798,6 +33131,9 @@ var WeavePenToolAction = class extends WeaveAction {
|
|
|
32798
33131
|
onInit = void 0;
|
|
32799
33132
|
constructor() {
|
|
32800
33133
|
super();
|
|
33134
|
+
this.initialize();
|
|
33135
|
+
}
|
|
33136
|
+
initialize() {
|
|
32801
33137
|
this.pointers = new Map();
|
|
32802
33138
|
this.initialized = false;
|
|
32803
33139
|
this.state = PEN_TOOL_STATE.IDLE;
|
|
@@ -32833,7 +33169,7 @@ var WeavePenToolAction = class extends WeaveAction {
|
|
|
32833
33169
|
this.cancelAction();
|
|
32834
33170
|
return;
|
|
32835
33171
|
}
|
|
32836
|
-
});
|
|
33172
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32837
33173
|
stage.on("pointerdown", (e) => {
|
|
32838
33174
|
this.setTapStart(e);
|
|
32839
33175
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -33070,6 +33406,9 @@ var WeaveLineToolAction = class extends WeaveAction {
|
|
|
33070
33406
|
constructor(params) {
|
|
33071
33407
|
super();
|
|
33072
33408
|
this.config = mergeExceptArrays(LINE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
|
|
33409
|
+
this.initialize();
|
|
33410
|
+
}
|
|
33411
|
+
initialize() {
|
|
33073
33412
|
this.pointers = new Map();
|
|
33074
33413
|
this.initialized = false;
|
|
33075
33414
|
this.state = LINE_TOOL_STATE.IDLE;
|
|
@@ -33114,13 +33453,13 @@ var WeaveLineToolAction = class extends WeaveAction {
|
|
|
33114
33453
|
this.snappedAngle = null;
|
|
33115
33454
|
this.shiftPressed = true;
|
|
33116
33455
|
}
|
|
33117
|
-
});
|
|
33456
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33118
33457
|
window.addEventListener("keyup", (e) => {
|
|
33119
33458
|
if (e.key === "Shift" && this.instance.getActiveAction() === LINE_TOOL_ACTION_NAME) {
|
|
33120
33459
|
this.snappedAngle = null;
|
|
33121
33460
|
this.shiftPressed = false;
|
|
33122
33461
|
}
|
|
33123
|
-
});
|
|
33462
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33124
33463
|
stage.on("pointerdown", (e) => {
|
|
33125
33464
|
this.setTapStart(e);
|
|
33126
33465
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -33335,6 +33674,9 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
33335
33674
|
constructor(params) {
|
|
33336
33675
|
super();
|
|
33337
33676
|
this.config = mergeExceptArrays(BRUSH_TOOL_DEFAULT_CONFIG, params?.config ?? {});
|
|
33677
|
+
this.initialize();
|
|
33678
|
+
}
|
|
33679
|
+
initialize() {
|
|
33338
33680
|
this.initialized = false;
|
|
33339
33681
|
this.state = BRUSH_TOOL_STATE.INACTIVE;
|
|
33340
33682
|
this.strokeId = null;
|
|
@@ -33363,7 +33705,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
33363
33705
|
const stage = this.instance.getStage();
|
|
33364
33706
|
window.addEventListener("keyup", (e) => {
|
|
33365
33707
|
if (e.code === "Space" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) this.isSpacePressed = false;
|
|
33366
|
-
});
|
|
33708
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33367
33709
|
window.addEventListener("keydown", (e) => {
|
|
33368
33710
|
if (e.code === "Enter" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) {
|
|
33369
33711
|
e.stopPropagation();
|
|
@@ -33379,7 +33721,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
33379
33721
|
e.stopPropagation();
|
|
33380
33722
|
this.cancelAction();
|
|
33381
33723
|
}
|
|
33382
|
-
});
|
|
33724
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33383
33725
|
const handlePointerDown = (e) => {
|
|
33384
33726
|
if (this.state === BRUSH_TOOL_STATE.INACTIVE) return;
|
|
33385
33727
|
if (this.state !== BRUSH_TOOL_STATE.IDLE) return;
|
|
@@ -33588,6 +33930,9 @@ var WeaveTextToolAction = class extends WeaveAction {
|
|
|
33588
33930
|
onInit = void 0;
|
|
33589
33931
|
constructor() {
|
|
33590
33932
|
super();
|
|
33933
|
+
this.initialize();
|
|
33934
|
+
}
|
|
33935
|
+
initialize() {
|
|
33591
33936
|
this.initialized = false;
|
|
33592
33937
|
this.state = TEXT_TOOL_STATE.IDLE;
|
|
33593
33938
|
this.textId = null;
|
|
@@ -33617,7 +33962,7 @@ var WeaveTextToolAction = class extends WeaveAction {
|
|
|
33617
33962
|
this.cancelAction();
|
|
33618
33963
|
return;
|
|
33619
33964
|
}
|
|
33620
|
-
});
|
|
33965
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33621
33966
|
stage.on("pointermove", () => {
|
|
33622
33967
|
if (this.state === TEXT_TOOL_STATE.IDLE) return;
|
|
33623
33968
|
this.setCursor();
|
|
@@ -33745,6 +34090,9 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
33745
34090
|
constructor(params) {
|
|
33746
34091
|
super();
|
|
33747
34092
|
this.config = mergeExceptArrays(WEAVE_IMAGE_TOOL_CONFIG_DEFAULT, params?.config ?? {});
|
|
34093
|
+
this.initialize();
|
|
34094
|
+
}
|
|
34095
|
+
initialize() {
|
|
33748
34096
|
this.pointers = new Map();
|
|
33749
34097
|
this.initialized = false;
|
|
33750
34098
|
this.imageId = null;
|
|
@@ -33788,7 +34136,7 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
33788
34136
|
this.cancelAction();
|
|
33789
34137
|
return;
|
|
33790
34138
|
}
|
|
33791
|
-
});
|
|
34139
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33792
34140
|
stage.on("pointerdown", (e) => {
|
|
33793
34141
|
this.setTapStart(e);
|
|
33794
34142
|
if (this.ignorePointerEvents) return;
|
|
@@ -34185,6 +34533,9 @@ var WeaveImagesToolAction = class extends WeaveAction {
|
|
|
34185
34533
|
constructor(params) {
|
|
34186
34534
|
super();
|
|
34187
34535
|
this.config = mergeExceptArrays(WEAVE_IMAGES_TOOL_DEFAULT_CONFIG, params ?? {});
|
|
34536
|
+
this.initialize();
|
|
34537
|
+
}
|
|
34538
|
+
initialize() {
|
|
34188
34539
|
this.pointers = new Map();
|
|
34189
34540
|
this.initialized = false;
|
|
34190
34541
|
this.tempPointerFeedbackNode = null;
|
|
@@ -34231,7 +34582,7 @@ var WeaveImagesToolAction = class extends WeaveAction {
|
|
|
34231
34582
|
const stage = this.instance.getStage();
|
|
34232
34583
|
stage.container().addEventListener("keydown", (e) => {
|
|
34233
34584
|
if (e.key === "Escape" && this.instance.getActiveAction() === WEAVE_IMAGES_TOOL_ACTION_NAME) this.cancelAction();
|
|
34234
|
-
});
|
|
34585
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
34235
34586
|
stage.on("pointerdown", (e) => {
|
|
34236
34587
|
this.setTapStart(e);
|
|
34237
34588
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -34613,6 +34964,9 @@ var WeaveStarToolAction = class extends WeaveAction {
|
|
|
34613
34964
|
onInit = void 0;
|
|
34614
34965
|
constructor() {
|
|
34615
34966
|
super();
|
|
34967
|
+
this.initialize();
|
|
34968
|
+
}
|
|
34969
|
+
initialize() {
|
|
34616
34970
|
this.pointers = new Map();
|
|
34617
34971
|
this.initialized = false;
|
|
34618
34972
|
this.state = STAR_TOOL_STATE.IDLE;
|
|
@@ -34649,7 +35003,7 @@ var WeaveStarToolAction = class extends WeaveAction {
|
|
|
34649
35003
|
this.cancelAction();
|
|
34650
35004
|
return;
|
|
34651
35005
|
}
|
|
34652
|
-
});
|
|
35006
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
34653
35007
|
stage.on("pointerdown", (e) => {
|
|
34654
35008
|
this.setTapStart(e);
|
|
34655
35009
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -34814,8 +35168,8 @@ var WeaveStarToolAction = class extends WeaveAction {
|
|
|
34814
35168
|
|
|
34815
35169
|
//#endregion
|
|
34816
35170
|
//#region src/actions/arrow-tool/constants.ts
|
|
34817
|
-
const
|
|
34818
|
-
const
|
|
35171
|
+
const WEAVE_ARROW_TOOL_ACTION_NAME = "arrowTool";
|
|
35172
|
+
const WEAVE_ARROW_TOOL_STATE = {
|
|
34819
35173
|
["IDLE"]: "idle",
|
|
34820
35174
|
["ADDING"]: "adding",
|
|
34821
35175
|
["DEFINING_SIZE"]: "definingSize",
|
|
@@ -34831,9 +35185,12 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34831
35185
|
onInit = void 0;
|
|
34832
35186
|
constructor() {
|
|
34833
35187
|
super();
|
|
35188
|
+
this.initialize();
|
|
35189
|
+
}
|
|
35190
|
+
initialize() {
|
|
34834
35191
|
this.pointers = new Map();
|
|
34835
35192
|
this.initialized = false;
|
|
34836
|
-
this.state =
|
|
35193
|
+
this.state = WEAVE_ARROW_TOOL_STATE.IDLE;
|
|
34837
35194
|
this.arrowId = null;
|
|
34838
35195
|
this.tempArrowId = null;
|
|
34839
35196
|
this.tempMainArrowNode = null;
|
|
@@ -34846,7 +35203,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34846
35203
|
this.props = this.initProps();
|
|
34847
35204
|
}
|
|
34848
35205
|
getName() {
|
|
34849
|
-
return
|
|
35206
|
+
return WEAVE_ARROW_TOOL_ACTION_NAME;
|
|
34850
35207
|
}
|
|
34851
35208
|
initProps() {
|
|
34852
35209
|
return {
|
|
@@ -34863,40 +35220,37 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34863
35220
|
setupEvents() {
|
|
34864
35221
|
const stage = this.instance.getStage();
|
|
34865
35222
|
window.addEventListener("keydown", (e) => {
|
|
34866
|
-
if (e.code === "Enter" && this.instance.getActiveAction() ===
|
|
35223
|
+
if (e.code === "Enter" && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
|
|
34867
35224
|
this.cancelAction();
|
|
34868
35225
|
return;
|
|
34869
35226
|
}
|
|
34870
|
-
if (e.code === "Escape" && this.instance.getActiveAction() ===
|
|
34871
|
-
|
|
34872
|
-
return;
|
|
34873
|
-
}
|
|
34874
|
-
});
|
|
35227
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) this.cancelAction();
|
|
35228
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
34875
35229
|
stage.on("pointerdown", (e) => {
|
|
34876
35230
|
this.setTapStart(e);
|
|
34877
35231
|
this.pointers.set(e.evt.pointerId, {
|
|
34878
35232
|
x: e.evt.clientX,
|
|
34879
35233
|
y: e.evt.clientY
|
|
34880
35234
|
});
|
|
34881
|
-
if (this.pointers.size === 2 && this.instance.getActiveAction() ===
|
|
34882
|
-
this.state =
|
|
35235
|
+
if (this.pointers.size === 2 && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
|
|
35236
|
+
this.state = WEAVE_ARROW_TOOL_STATE.ADDING;
|
|
34883
35237
|
return;
|
|
34884
35238
|
}
|
|
34885
|
-
if (!this.tempMainArrowNode && this.state ===
|
|
34886
|
-
if (this.tempMainArrowNode && this.state ===
|
|
35239
|
+
if (!this.tempMainArrowNode && this.state === WEAVE_ARROW_TOOL_STATE.ADDING) this.handleAdding();
|
|
35240
|
+
if (this.tempMainArrowNode && this.state === WEAVE_ARROW_TOOL_STATE.ADDING) this.state = WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE;
|
|
34887
35241
|
});
|
|
34888
35242
|
stage.on("pointermove", () => {
|
|
34889
|
-
if (this.state ===
|
|
35243
|
+
if (this.state === WEAVE_ARROW_TOOL_STATE.IDLE) return;
|
|
34890
35244
|
this.setCursor();
|
|
34891
|
-
if (this.pointers.size === 2 && this.instance.getActiveAction() ===
|
|
34892
|
-
this.state =
|
|
35245
|
+
if (this.pointers.size === 2 && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
|
|
35246
|
+
this.state = WEAVE_ARROW_TOOL_STATE.ADDING;
|
|
34893
35247
|
return;
|
|
34894
35248
|
}
|
|
34895
|
-
if (this.state ===
|
|
35249
|
+
if (this.state === WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) this.handleMovement();
|
|
34896
35250
|
});
|
|
34897
35251
|
stage.on("pointerup", (e) => {
|
|
34898
35252
|
this.pointers.delete(e.evt.pointerId);
|
|
34899
|
-
if (this.state ===
|
|
35253
|
+
if (this.state === WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) this.handleSettingSize();
|
|
34900
35254
|
});
|
|
34901
35255
|
this.initialized = true;
|
|
34902
35256
|
}
|
|
@@ -34910,7 +35264,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34910
35264
|
this.tempPoint = void 0;
|
|
34911
35265
|
this.tempNextPoint = void 0;
|
|
34912
35266
|
this.clickPoint = null;
|
|
34913
|
-
this.setState(
|
|
35267
|
+
this.setState(WEAVE_ARROW_TOOL_STATE.ADDING);
|
|
34914
35268
|
}
|
|
34915
35269
|
handleAdding() {
|
|
34916
35270
|
const stage = this.instance.getStage();
|
|
@@ -34961,7 +35315,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34961
35315
|
this.measureContainer?.add(this.tempNextPoint);
|
|
34962
35316
|
this.tempPoint.moveToTop();
|
|
34963
35317
|
this.tempNextPoint.moveToTop();
|
|
34964
|
-
this.setState(
|
|
35318
|
+
this.setState(WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE);
|
|
34965
35319
|
}
|
|
34966
35320
|
}
|
|
34967
35321
|
handleSettingSize() {
|
|
@@ -34988,11 +35342,11 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34988
35342
|
y: mousePoint.y,
|
|
34989
35343
|
points: [0, 0]
|
|
34990
35344
|
});
|
|
34991
|
-
this.setState(
|
|
35345
|
+
this.setState(WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE);
|
|
34992
35346
|
}
|
|
34993
35347
|
}
|
|
34994
35348
|
handleMovement() {
|
|
34995
|
-
if (this.state !==
|
|
35349
|
+
if (this.state !== WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) return;
|
|
34996
35350
|
if (this.arrowId && this.tempArrowNode && this.measureContainer && this.tempNextPoint) {
|
|
34997
35351
|
const { mousePoint } = this.instance.getMousePointerRelativeToContainer(this.measureContainer);
|
|
34998
35352
|
this.tempArrowNode.setAttrs({
|
|
@@ -35059,7 +35413,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
35059
35413
|
this.container = void 0;
|
|
35060
35414
|
this.measureContainer = void 0;
|
|
35061
35415
|
this.clickPoint = null;
|
|
35062
|
-
this.setState(
|
|
35416
|
+
this.setState(WEAVE_ARROW_TOOL_STATE.IDLE);
|
|
35063
35417
|
}
|
|
35064
35418
|
setCursor() {
|
|
35065
35419
|
const stage = this.instance.getStage();
|
|
@@ -35103,13 +35457,15 @@ const WEAVE_STROKE_TOOL_DEFAULT_CONFIG = { snapAngles: {
|
|
|
35103
35457
|
var WeaveStrokeToolAction = class extends WeaveAction {
|
|
35104
35458
|
initialized = false;
|
|
35105
35459
|
initialCursor = null;
|
|
35106
|
-
snappedAngle = null;
|
|
35107
35460
|
shiftPressed = false;
|
|
35108
35461
|
onPropsChange = void 0;
|
|
35109
35462
|
onInit = void 0;
|
|
35110
35463
|
constructor(params) {
|
|
35111
35464
|
super();
|
|
35112
35465
|
this.config = mergeExceptArrays(WEAVE_STROKE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
|
|
35466
|
+
this.initialize();
|
|
35467
|
+
}
|
|
35468
|
+
initialize() {
|
|
35113
35469
|
this.pointers = new Map();
|
|
35114
35470
|
this.initialized = false;
|
|
35115
35471
|
this.state = WEAVE_STROKE_TOOL_STATE.IDLE;
|
|
@@ -35118,7 +35474,6 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35118
35474
|
this.tempLineId = null;
|
|
35119
35475
|
this.tempLineNode = null;
|
|
35120
35476
|
this.container = void 0;
|
|
35121
|
-
this.snappedAngle = null;
|
|
35122
35477
|
this.measureContainer = void 0;
|
|
35123
35478
|
this.clickPoint = null;
|
|
35124
35479
|
this.snapper = new GreedySnapper({
|
|
@@ -35131,6 +35486,9 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35131
35486
|
getName() {
|
|
35132
35487
|
return WEAVE_STROKE_TOOL_ACTION_NAME;
|
|
35133
35488
|
}
|
|
35489
|
+
getNames() {
|
|
35490
|
+
return [WEAVE_STROKE_TOOL_ACTION_NAME, ...WEAVE_STROKE_TOOL_ACTION_NAME_ALIASES];
|
|
35491
|
+
}
|
|
35134
35492
|
hasAliases() {
|
|
35135
35493
|
return true;
|
|
35136
35494
|
}
|
|
@@ -35149,32 +35507,26 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35149
35507
|
setupEvents() {
|
|
35150
35508
|
const stage = this.instance.getStage();
|
|
35151
35509
|
window.addEventListener("keydown", (e) => {
|
|
35152
|
-
if (e.code === "Enter" && this.instance.getActiveAction()
|
|
35510
|
+
if (e.code === "Enter" && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
|
|
35153
35511
|
this.cancelAction();
|
|
35154
35512
|
return;
|
|
35155
35513
|
}
|
|
35156
|
-
if (e.code === "Escape" && this.instance.getActiveAction()
|
|
35514
|
+
if (e.code === "Escape" && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
|
|
35157
35515
|
this.cancelAction();
|
|
35158
35516
|
return;
|
|
35159
35517
|
}
|
|
35160
|
-
if (e.key === "Shift" && this.instance.getActiveAction()
|
|
35161
|
-
|
|
35162
|
-
this.shiftPressed = true;
|
|
35163
|
-
}
|
|
35164
|
-
});
|
|
35518
|
+
if (e.key === "Shift" && this.getNames().includes(this.instance.getActiveAction() ?? "")) this.shiftPressed = true;
|
|
35519
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35165
35520
|
window.addEventListener("keyup", (e) => {
|
|
35166
|
-
if (e.key === "Shift" && this.instance.getActiveAction()
|
|
35167
|
-
|
|
35168
|
-
this.shiftPressed = false;
|
|
35169
|
-
}
|
|
35170
|
-
});
|
|
35521
|
+
if (e.key === "Shift" && this.getNames().includes(this.instance.getActiveAction() ?? "")) this.shiftPressed = false;
|
|
35522
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35171
35523
|
stage.on("pointerdown", (e) => {
|
|
35172
35524
|
this.setTapStart(e);
|
|
35173
35525
|
this.pointers.set(e.evt.pointerId, {
|
|
35174
35526
|
x: e.evt.clientX,
|
|
35175
35527
|
y: e.evt.clientY
|
|
35176
35528
|
});
|
|
35177
|
-
if (this.pointers.size === 2 && this.instance.getActiveAction()
|
|
35529
|
+
if (this.pointers.size === 2 && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
|
|
35178
35530
|
this.state = WEAVE_STROKE_TOOL_STATE.ADDING;
|
|
35179
35531
|
return;
|
|
35180
35532
|
}
|
|
@@ -35184,7 +35536,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35184
35536
|
stage.on("pointermove", () => {
|
|
35185
35537
|
if (this.state === WEAVE_STROKE_TOOL_STATE.IDLE) return;
|
|
35186
35538
|
this.setCursor();
|
|
35187
|
-
if (this.pointers.size === 2 && this.instance.getActiveAction()
|
|
35539
|
+
if (this.pointers.size === 2 && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
|
|
35188
35540
|
this.state = WEAVE_STROKE_TOOL_STATE.ADDING;
|
|
35189
35541
|
return;
|
|
35190
35542
|
}
|
|
@@ -35202,7 +35554,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35202
35554
|
addLine() {
|
|
35203
35555
|
this.setCursor();
|
|
35204
35556
|
this.setFocusStage();
|
|
35205
|
-
this.instance.emitEvent("onAddingStroke", { actionName: this.instance.getActiveAction() ??
|
|
35557
|
+
this.instance.emitEvent("onAddingStroke", { actionName: this.instance.getActiveAction() ?? "not-defined" });
|
|
35206
35558
|
this.shiftPressed = false;
|
|
35207
35559
|
this.clickPoint = null;
|
|
35208
35560
|
this.setState(WEAVE_STROKE_TOOL_STATE.ADDING);
|
|
@@ -35310,7 +35662,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35310
35662
|
});
|
|
35311
35663
|
delete finalLine.props.dragBoundFunc;
|
|
35312
35664
|
this.instance.addNode(finalLine, this.container?.getAttrs().id);
|
|
35313
|
-
this.instance.emitEvent("onAddedStroke", { actionName: this.instance.getActiveAction() ??
|
|
35665
|
+
this.instance.emitEvent("onAddedStroke", { actionName: this.instance.getActiveAction() ?? "not-defined" });
|
|
35314
35666
|
nodeCreated = true;
|
|
35315
35667
|
}
|
|
35316
35668
|
}
|
|
@@ -35360,6 +35712,9 @@ var WeaveRegularPolygonToolAction = class extends WeaveAction {
|
|
|
35360
35712
|
onInit = void 0;
|
|
35361
35713
|
constructor() {
|
|
35362
35714
|
super();
|
|
35715
|
+
this.initialize();
|
|
35716
|
+
}
|
|
35717
|
+
initialize() {
|
|
35363
35718
|
this.pointers = new Map();
|
|
35364
35719
|
this.initialized = false;
|
|
35365
35720
|
this.state = REGULAR_POLYGON_TOOL_STATE.IDLE;
|
|
@@ -35394,7 +35749,7 @@ var WeaveRegularPolygonToolAction = class extends WeaveAction {
|
|
|
35394
35749
|
this.cancelAction();
|
|
35395
35750
|
return;
|
|
35396
35751
|
}
|
|
35397
|
-
});
|
|
35752
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35398
35753
|
stage.on("pointerdown", (e) => {
|
|
35399
35754
|
this.setTapStart(e);
|
|
35400
35755
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -35568,6 +35923,9 @@ var WeaveFrameToolAction = class extends WeaveAction {
|
|
|
35568
35923
|
onInit = void 0;
|
|
35569
35924
|
constructor() {
|
|
35570
35925
|
super();
|
|
35926
|
+
this.initialize();
|
|
35927
|
+
}
|
|
35928
|
+
initialize() {
|
|
35571
35929
|
this.initialized = false;
|
|
35572
35930
|
this.state = FRAME_TOOL_STATE.IDLE;
|
|
35573
35931
|
this.frameId = null;
|
|
@@ -35595,7 +35953,7 @@ var WeaveFrameToolAction = class extends WeaveAction {
|
|
|
35595
35953
|
this.cancelAction();
|
|
35596
35954
|
return;
|
|
35597
35955
|
}
|
|
35598
|
-
});
|
|
35956
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35599
35957
|
stage.on("pointermove", () => {
|
|
35600
35958
|
if (this.state === FRAME_TOOL_STATE.IDLE) return;
|
|
35601
35959
|
this.setCursor();
|
|
@@ -35697,6 +36055,10 @@ var WeaveExportStageToolAction = class extends WeaveAction {
|
|
|
35697
36055
|
};
|
|
35698
36056
|
onPropsChange = void 0;
|
|
35699
36057
|
onInit = void 0;
|
|
36058
|
+
initialize = void 0;
|
|
36059
|
+
constructor() {
|
|
36060
|
+
super();
|
|
36061
|
+
}
|
|
35700
36062
|
getName() {
|
|
35701
36063
|
return EXPORT_STAGE_TOOL_ACTION_NAME;
|
|
35702
36064
|
}
|
|
@@ -35744,6 +36106,10 @@ var WeaveExportNodesToolAction = class extends WeaveAction {
|
|
|
35744
36106
|
};
|
|
35745
36107
|
onPropsChange = void 0;
|
|
35746
36108
|
onInit = void 0;
|
|
36109
|
+
initialize = void 0;
|
|
36110
|
+
constructor() {
|
|
36111
|
+
super();
|
|
36112
|
+
}
|
|
35747
36113
|
getName() {
|
|
35748
36114
|
return EXPORT_NODES_TOOL_ACTION_NAME;
|
|
35749
36115
|
}
|
|
@@ -35796,6 +36162,9 @@ var WeaveAlignNodesToolAction = class extends WeaveAction {
|
|
|
35796
36162
|
onInit = void 0;
|
|
35797
36163
|
constructor() {
|
|
35798
36164
|
super();
|
|
36165
|
+
this.initialize();
|
|
36166
|
+
}
|
|
36167
|
+
initialize() {
|
|
35799
36168
|
this.initialized = false;
|
|
35800
36169
|
this.state = ALIGN_NODES_TOOL_STATE.IDLE;
|
|
35801
36170
|
}
|
|
@@ -36045,6 +36414,9 @@ var WeaveCommentToolAction = class extends WeaveAction {
|
|
|
36045
36414
|
super();
|
|
36046
36415
|
const { config } = params ?? {};
|
|
36047
36416
|
this.config = mergeExceptArrays(WEAVE_COMMENT_TOOL_DEFAULT_CONFIG, config);
|
|
36417
|
+
this.initialize();
|
|
36418
|
+
}
|
|
36419
|
+
initialize() {
|
|
36048
36420
|
this.pointers = new Map();
|
|
36049
36421
|
this.initialized = false;
|
|
36050
36422
|
this.state = WEAVE_COMMENT_TOOL_STATE.IDLE;
|
|
@@ -36122,7 +36494,7 @@ var WeaveCommentToolAction = class extends WeaveAction {
|
|
|
36122
36494
|
return;
|
|
36123
36495
|
}
|
|
36124
36496
|
if (e.code === "Escape" && this.state === WEAVE_COMMENT_TOOL_STATE.CREATING_COMMENT) this.setState(WEAVE_COMMENT_TOOL_STATE.ADDING);
|
|
36125
|
-
});
|
|
36497
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
36126
36498
|
stage.on("pointermove", (e) => {
|
|
36127
36499
|
if (this.state === WEAVE_COMMENT_TOOL_STATE.IDLE) return;
|
|
36128
36500
|
if (commentNodeHandler?.isCommentViewing()) {
|
|
@@ -36273,6 +36645,9 @@ var WeaveVideoToolAction = class extends WeaveAction {
|
|
|
36273
36645
|
update = void 0;
|
|
36274
36646
|
constructor() {
|
|
36275
36647
|
super();
|
|
36648
|
+
this.initialize();
|
|
36649
|
+
}
|
|
36650
|
+
initialize() {
|
|
36276
36651
|
this.pointers = new Map();
|
|
36277
36652
|
this.initialized = false;
|
|
36278
36653
|
this.state = VIDEO_TOOL_STATE.IDLE;
|
|
@@ -36319,7 +36694,7 @@ var WeaveVideoToolAction = class extends WeaveAction {
|
|
|
36319
36694
|
this.cancelAction();
|
|
36320
36695
|
return;
|
|
36321
36696
|
}
|
|
36322
|
-
});
|
|
36697
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
36323
36698
|
stage.on("pointerdown", (e) => {
|
|
36324
36699
|
this.setTapStart(e);
|
|
36325
36700
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -36498,6 +36873,9 @@ var WeaveMeasureToolAction = class extends WeaveAction {
|
|
|
36498
36873
|
constructor(params) {
|
|
36499
36874
|
super();
|
|
36500
36875
|
this.config = mergeExceptArrays(WEAVE_MEASURE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
|
|
36876
|
+
this.initialize();
|
|
36877
|
+
}
|
|
36878
|
+
initialize() {
|
|
36501
36879
|
this.initialized = false;
|
|
36502
36880
|
this.state = MEASURE_TOOL_STATE.IDLE;
|
|
36503
36881
|
this.measureId = null;
|
|
@@ -36524,7 +36902,7 @@ var WeaveMeasureToolAction = class extends WeaveAction {
|
|
|
36524
36902
|
const stage = this.instance.getStage();
|
|
36525
36903
|
window.addEventListener("keydown", (e) => {
|
|
36526
36904
|
if (e.code === "Escape" && this.instance.getActiveAction() === MEASURE_TOOL_ACTION_NAME) this.cancelAction();
|
|
36527
|
-
});
|
|
36905
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
36528
36906
|
stage.on("pointermove", () => {
|
|
36529
36907
|
if (this.state === MEASURE_TOOL_STATE.IDLE) return;
|
|
36530
36908
|
if (this.state === MEASURE_TOOL_STATE.SET_TO) {
|
|
@@ -36794,6 +37172,9 @@ var WeaveConnectorToolAction = class extends WeaveAction {
|
|
|
36794
37172
|
constructor(params) {
|
|
36795
37173
|
super();
|
|
36796
37174
|
this.config = mergeExceptArrays(CONNECTOR_TOOL_DEFAULT_CONFIG, params?.config);
|
|
37175
|
+
this.initialize();
|
|
37176
|
+
}
|
|
37177
|
+
initialize() {
|
|
36797
37178
|
this.pointers = new Map();
|
|
36798
37179
|
this.initialized = false;
|
|
36799
37180
|
this.tempLineNode = null;
|
|
@@ -36832,7 +37213,7 @@ var WeaveConnectorToolAction = class extends WeaveAction {
|
|
|
36832
37213
|
return;
|
|
36833
37214
|
}
|
|
36834
37215
|
if (e.code === "Escape" && this.instance.getActiveAction() === CONNECTOR_TOOL_ACTION_NAME) this.cancelAction();
|
|
36835
|
-
});
|
|
37216
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
36836
37217
|
let nodeHovered = void 0;
|
|
36837
37218
|
stage.on("pointermove", () => {
|
|
36838
37219
|
if (!(this.state === CONNECTOR_TOOL_STATE.SELECTING_INITIAL || this.state === CONNECTOR_TOOL_STATE.SELECTING_FINAL)) return;
|
|
@@ -37147,25 +37528,25 @@ var WeaveConnectorToolAction = class extends WeaveAction {
|
|
|
37147
37528
|
//#endregion
|
|
37148
37529
|
//#region src/plugins/stage-grid/stage-grid.ts
|
|
37149
37530
|
var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
37150
|
-
actStageZoomX = 1;
|
|
37151
|
-
actStageZoomY = 1;
|
|
37152
|
-
actStagePosX = 0;
|
|
37153
|
-
actStagePosY = 0;
|
|
37154
37531
|
constructor(params) {
|
|
37155
37532
|
super();
|
|
37156
37533
|
const { config } = params ?? {};
|
|
37157
37534
|
this.moveToolActive = false;
|
|
37158
37535
|
this.isMouseMiddleButtonPressed = false;
|
|
37159
37536
|
this.isSpaceKeyPressed = false;
|
|
37160
|
-
this.config = {
|
|
37161
|
-
type: WEAVE_GRID_DEFAULT_TYPE,
|
|
37162
|
-
gridColor: WEAVE_GRID_DEFAULT_COLOR,
|
|
37163
|
-
gridOriginColor: WEAVE_GRID_DEFAULT_ORIGIN_COLOR,
|
|
37164
|
-
gridSize: WEAVE_GRID_DEFAULT_SIZE,
|
|
37165
|
-
gridDotMaxDotsPerAxis: WEAVE_GRID_DEFAULT_DOT_MAX_DOTS_PER_AXIS,
|
|
37166
|
-
...config
|
|
37167
|
-
};
|
|
37168
37537
|
this.forceStageChange = false;
|
|
37538
|
+
this.config = mergeExceptArrays(WEAVE_GRID_DEFAULT_CONFIG, config);
|
|
37539
|
+
this.initialize();
|
|
37540
|
+
}
|
|
37541
|
+
initialize() {
|
|
37542
|
+
this.moveToolActive = false;
|
|
37543
|
+
this.isMouseMiddleButtonPressed = false;
|
|
37544
|
+
this.isSpaceKeyPressed = false;
|
|
37545
|
+
this.forceStageChange = false;
|
|
37546
|
+
this.actStagePosX = 0;
|
|
37547
|
+
this.actStagePosY = 0;
|
|
37548
|
+
this.actStageZoomX = 1;
|
|
37549
|
+
this.actStageZoomY = 1;
|
|
37169
37550
|
}
|
|
37170
37551
|
getName() {
|
|
37171
37552
|
return WEAVE_STAGE_GRID_PLUGIN_KEY;
|
|
@@ -37190,10 +37571,10 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37190
37571
|
const stage = this.instance.getStage();
|
|
37191
37572
|
window.addEventListener("keydown", (e) => {
|
|
37192
37573
|
if (e.code === "Space") this.isSpaceKeyPressed = true;
|
|
37193
|
-
});
|
|
37574
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37194
37575
|
window.addEventListener("keyup", (e) => {
|
|
37195
37576
|
if (e.code === "Space") this.isSpaceKeyPressed = false;
|
|
37196
|
-
});
|
|
37577
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37197
37578
|
this.instance.addEventListener("onStageMove", () => {
|
|
37198
37579
|
this.onRender();
|
|
37199
37580
|
});
|
|
@@ -37221,10 +37602,14 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37221
37602
|
const layer = stage.findOne(`#${WEAVE_GRID_LAYER_ID}`);
|
|
37222
37603
|
return layer;
|
|
37223
37604
|
}
|
|
37605
|
+
getShapeAdaptiveSpacing(baseSpacing, scale) {
|
|
37606
|
+
const factor = Math.pow(2, Math.floor(Math.log2(1 / scale)));
|
|
37607
|
+
return baseSpacing * factor;
|
|
37608
|
+
}
|
|
37224
37609
|
getAdaptiveSpacing(scale) {
|
|
37225
37610
|
const baseGridSpacing = this.config.gridSize;
|
|
37226
|
-
const minPixelSpacing =
|
|
37227
|
-
const maxPixelSpacing =
|
|
37611
|
+
const minPixelSpacing = this.config.gridSize;
|
|
37612
|
+
const maxPixelSpacing = this.config.gridSize * 2;
|
|
37228
37613
|
let spacing = baseGridSpacing;
|
|
37229
37614
|
let pixelSpacing = spacing * scale;
|
|
37230
37615
|
while (pixelSpacing < minPixelSpacing) {
|
|
@@ -37239,17 +37624,6 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37239
37624
|
const snappedSpacing = baseGridSpacing * Math.pow(2, logFactor);
|
|
37240
37625
|
return snappedSpacing;
|
|
37241
37626
|
}
|
|
37242
|
-
getAdjustedSpacing(startX, endX, startY, endY, baseSpacing = 50) {
|
|
37243
|
-
let spacing = baseSpacing;
|
|
37244
|
-
let dotCountX = Math.ceil((endX - startX) / spacing);
|
|
37245
|
-
let dotCountY = Math.ceil((endY - startY) / spacing);
|
|
37246
|
-
while ((dotCountX > this.config.gridDotMaxDotsPerAxis || dotCountY > this.config.gridDotMaxDotsPerAxis) && spacing < 1e6) {
|
|
37247
|
-
spacing *= 2;
|
|
37248
|
-
dotCountX = Math.ceil((endX - startX) / spacing);
|
|
37249
|
-
dotCountY = Math.ceil((endY - startY) / spacing);
|
|
37250
|
-
}
|
|
37251
|
-
return spacing;
|
|
37252
|
-
}
|
|
37253
37627
|
renderGridLines() {
|
|
37254
37628
|
const stage = this.instance.getStage();
|
|
37255
37629
|
const gridLayer = this.getLayer();
|
|
@@ -37258,7 +37632,7 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37258
37632
|
if (!this.enabled) return;
|
|
37259
37633
|
const scale = stage.scaleX();
|
|
37260
37634
|
const spacing = this.getAdaptiveSpacing(scale);
|
|
37261
|
-
const invScale =
|
|
37635
|
+
const invScale = this.config.gridStroke / scale;
|
|
37262
37636
|
const offsetX = -stage.x() / stage.scaleX();
|
|
37263
37637
|
const offsetY = -stage.y() / stage.scaleY();
|
|
37264
37638
|
const margin = 2;
|
|
@@ -37268,11 +37642,19 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37268
37642
|
const startY = Math.floor((offsetY - margin * worldHeight) / spacing) * spacing;
|
|
37269
37643
|
const endX = offsetX + (1 + margin) * worldWidth;
|
|
37270
37644
|
const endY = offsetY + (1 + margin) * worldHeight;
|
|
37271
|
-
const highlightEvery = this.config.gridMajorEvery
|
|
37645
|
+
const highlightEvery = this.config.gridMajorEvery;
|
|
37272
37646
|
for (let x = startX; x <= endX; x += spacing) {
|
|
37273
37647
|
const index = Math.round(x / spacing);
|
|
37274
37648
|
const isHighlight = index % highlightEvery === 0;
|
|
37275
37649
|
const isOrigin = Math.abs(x) < spacing / 2;
|
|
37650
|
+
let stroke = this.config.gridColor;
|
|
37651
|
+
if (isOrigin) stroke = this.config.gridOriginColor;
|
|
37652
|
+
else if (isHighlight) stroke = this.config.gridMajorColor;
|
|
37653
|
+
let strokeWidth = invScale;
|
|
37654
|
+
if (isHighlight || isOrigin) strokeWidth = invScale * this.config.gridMajorRatio;
|
|
37655
|
+
let zIndex = 1;
|
|
37656
|
+
if (isOrigin) zIndex = 3;
|
|
37657
|
+
else if (isHighlight) zIndex = 2;
|
|
37276
37658
|
const line = new Konva.Line({
|
|
37277
37659
|
points: [
|
|
37278
37660
|
x,
|
|
@@ -37280,9 +37662,10 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37280
37662
|
x,
|
|
37281
37663
|
endY
|
|
37282
37664
|
],
|
|
37283
|
-
stroke
|
|
37284
|
-
strokeWidth
|
|
37285
|
-
listening: false
|
|
37665
|
+
stroke,
|
|
37666
|
+
strokeWidth,
|
|
37667
|
+
listening: false,
|
|
37668
|
+
zIndex
|
|
37286
37669
|
});
|
|
37287
37670
|
gridLayer.add(line);
|
|
37288
37671
|
}
|
|
@@ -37290,6 +37673,14 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37290
37673
|
const index = Math.round(y / spacing);
|
|
37291
37674
|
const isHighlight = index % highlightEvery === 0;
|
|
37292
37675
|
const isOrigin = Math.abs(y) < spacing / 2;
|
|
37676
|
+
let stroke = this.config.gridColor;
|
|
37677
|
+
if (isOrigin) stroke = this.config.gridOriginColor;
|
|
37678
|
+
else if (isHighlight) stroke = this.config.gridMajorColor;
|
|
37679
|
+
let strokeWidth = invScale;
|
|
37680
|
+
if (isHighlight || isOrigin) strokeWidth = invScale * this.config.gridMajorRatio;
|
|
37681
|
+
let zIndex = 1;
|
|
37682
|
+
if (isOrigin) zIndex = 3;
|
|
37683
|
+
else if (isHighlight) zIndex = 2;
|
|
37293
37684
|
const line = new Konva.Line({
|
|
37294
37685
|
points: [
|
|
37295
37686
|
startX,
|
|
@@ -37297,9 +37688,10 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37297
37688
|
endX,
|
|
37298
37689
|
y
|
|
37299
37690
|
],
|
|
37300
|
-
stroke
|
|
37301
|
-
strokeWidth
|
|
37302
|
-
listening: false
|
|
37691
|
+
stroke,
|
|
37692
|
+
strokeWidth,
|
|
37693
|
+
listening: false,
|
|
37694
|
+
zIndex
|
|
37303
37695
|
});
|
|
37304
37696
|
gridLayer.add(line);
|
|
37305
37697
|
}
|
|
@@ -37310,67 +37702,78 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37310
37702
|
if (!gridLayer) return;
|
|
37311
37703
|
gridLayer.destroyChildren();
|
|
37312
37704
|
if (!this.enabled) return;
|
|
37313
|
-
const
|
|
37314
|
-
|
|
37315
|
-
|
|
37316
|
-
|
|
37317
|
-
|
|
37318
|
-
|
|
37319
|
-
|
|
37320
|
-
|
|
37321
|
-
|
|
37322
|
-
|
|
37323
|
-
|
|
37324
|
-
|
|
37325
|
-
|
|
37326
|
-
|
|
37327
|
-
|
|
37328
|
-
|
|
37329
|
-
|
|
37330
|
-
|
|
37331
|
-
|
|
37332
|
-
|
|
37333
|
-
|
|
37334
|
-
|
|
37335
|
-
|
|
37336
|
-
|
|
37337
|
-
|
|
37338
|
-
|
|
37339
|
-
|
|
37340
|
-
|
|
37341
|
-
|
|
37342
|
-
|
|
37343
|
-
|
|
37344
|
-
|
|
37345
|
-
|
|
37346
|
-
|
|
37347
|
-
|
|
37348
|
-
|
|
37349
|
-
|
|
37350
|
-
|
|
37351
|
-
|
|
37352
|
-
|
|
37353
|
-
|
|
37354
|
-
|
|
37355
|
-
|
|
37356
|
-
|
|
37357
|
-
|
|
37358
|
-
|
|
37359
|
-
|
|
37360
|
-
|
|
37361
|
-
|
|
37362
|
-
|
|
37363
|
-
|
|
37364
|
-
|
|
37365
|
-
|
|
37366
|
-
|
|
37367
|
-
|
|
37368
|
-
|
|
37369
|
-
|
|
37370
|
-
|
|
37371
|
-
|
|
37372
|
-
|
|
37373
|
-
|
|
37705
|
+
const grid = new Konva.Shape({
|
|
37706
|
+
listening: false,
|
|
37707
|
+
sceneFunc: (ctx) => {
|
|
37708
|
+
const dotType = this.config.gridDotType;
|
|
37709
|
+
const scale = stage.scaleX();
|
|
37710
|
+
const pos = stage.position();
|
|
37711
|
+
const baseSpacing = this.config.gridSize;
|
|
37712
|
+
const spacing = this.getShapeAdaptiveSpacing(baseSpacing, scale);
|
|
37713
|
+
const highlightEvery = this.config.gridMajorEvery;
|
|
37714
|
+
const defaultColor = this.config.gridColor;
|
|
37715
|
+
const majorColor = this.config.gridMajorColor;
|
|
37716
|
+
const centerColor = this.config.gridOriginColor;
|
|
37717
|
+
if (dotType === WEAVE_GRID_DOT_TYPES.CIRCLE) {
|
|
37718
|
+
const scale$1 = stage.scaleX();
|
|
37719
|
+
const pos$1 = stage.position();
|
|
37720
|
+
const topLeftX = -pos$1.x / scale$1;
|
|
37721
|
+
const topLeftY = -pos$1.y / scale$1;
|
|
37722
|
+
const viewWidth = stage.width() / scale$1;
|
|
37723
|
+
const viewHeight = stage.height() / scale$1;
|
|
37724
|
+
const startX = Math.floor(topLeftX / spacing) * spacing;
|
|
37725
|
+
const startY = Math.floor(topLeftY / spacing) * spacing;
|
|
37726
|
+
const dotRadius = this.config.gridDotRadius;
|
|
37727
|
+
const dotMajorRadius = dotRadius * this.config.gridMajorRatio;
|
|
37728
|
+
for (let x = startX; x < topLeftX + viewWidth; x += spacing) for (let y = startY; y < topLeftY + viewHeight; y += spacing) {
|
|
37729
|
+
const indexX = Math.round(x / spacing);
|
|
37730
|
+
const indexY = Math.round(y / spacing);
|
|
37731
|
+
const isHighlightX = indexX % highlightEvery === 0;
|
|
37732
|
+
const isHighlightY = indexY % highlightEvery === 0;
|
|
37733
|
+
const isHighlight = isHighlightX || isHighlightY;
|
|
37734
|
+
const isOriginX = Math.abs(x) < spacing / 2;
|
|
37735
|
+
const isOriginY = Math.abs(y) < spacing / 2;
|
|
37736
|
+
const isOrigin = isOriginX || isOriginY;
|
|
37737
|
+
let fillStyle = defaultColor;
|
|
37738
|
+
if (isOrigin) fillStyle = centerColor;
|
|
37739
|
+
else if (isHighlight) fillStyle = majorColor;
|
|
37740
|
+
ctx.fillStyle = fillStyle;
|
|
37741
|
+
ctx.beginPath();
|
|
37742
|
+
ctx.arc(x, y, (isHighlight ? dotMajorRadius : dotRadius) / scale$1, 0, Math.PI * 2);
|
|
37743
|
+
ctx.fill();
|
|
37744
|
+
}
|
|
37745
|
+
}
|
|
37746
|
+
if (dotType === WEAVE_GRID_DOT_TYPES.SQUARE) {
|
|
37747
|
+
const topLeftX = -pos.x / scale;
|
|
37748
|
+
const topLeftY = -pos.y / scale;
|
|
37749
|
+
const viewWidth = stage.width() / scale;
|
|
37750
|
+
const viewHeight = stage.height() / scale;
|
|
37751
|
+
const startX = Math.floor(topLeftX / spacing) * spacing;
|
|
37752
|
+
const startY = Math.floor(topLeftY / spacing) * spacing;
|
|
37753
|
+
const defaultSize = this.config.gridDotRectSize;
|
|
37754
|
+
const majorSize = defaultSize * this.config.gridMajorRatio;
|
|
37755
|
+
for (let x = startX; x < topLeftX + viewWidth; x += spacing) for (let y = startY; y < topLeftY + viewHeight; y += spacing) {
|
|
37756
|
+
const sx = Math.round(x * scale) / scale;
|
|
37757
|
+
const sy = Math.round(y * scale) / scale;
|
|
37758
|
+
const indexX = Math.round(sx / spacing);
|
|
37759
|
+
const indexY = Math.round(sy / spacing);
|
|
37760
|
+
const isHighlightX = indexX % highlightEvery === 0;
|
|
37761
|
+
const isHighlightY = indexY % highlightEvery === 0;
|
|
37762
|
+
const isHighlight = isHighlightX || isHighlightY;
|
|
37763
|
+
const isOriginX = Math.abs(sx) < spacing / 2;
|
|
37764
|
+
const isOriginY = Math.abs(sy) < spacing / 2;
|
|
37765
|
+
const isOrigin = isOriginX || isOriginY;
|
|
37766
|
+
let fillStyle = defaultColor;
|
|
37767
|
+
if (isOrigin) fillStyle = centerColor;
|
|
37768
|
+
else if (isHighlight) fillStyle = majorColor;
|
|
37769
|
+
ctx.fillStyle = fillStyle;
|
|
37770
|
+
const size = (isHighlight ? majorSize : defaultSize) / scale;
|
|
37771
|
+
ctx.fillRect(sx - size / 2, sy - size / 2, size, size);
|
|
37772
|
+
}
|
|
37773
|
+
}
|
|
37774
|
+
}
|
|
37775
|
+
});
|
|
37776
|
+
gridLayer.add(grid);
|
|
37374
37777
|
}
|
|
37375
37778
|
hasStageChanged() {
|
|
37376
37779
|
if (this.forceStageChange) {
|
|
@@ -37407,11 +37810,13 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37407
37810
|
enable() {
|
|
37408
37811
|
this.enabled = true;
|
|
37409
37812
|
this.getLayer()?.show();
|
|
37813
|
+
this.forceStageChange = true;
|
|
37410
37814
|
this.onRender();
|
|
37411
37815
|
}
|
|
37412
37816
|
disable() {
|
|
37413
37817
|
this.enabled = false;
|
|
37414
37818
|
this.getLayer()?.hide();
|
|
37819
|
+
this.forceStageChange = true;
|
|
37415
37820
|
this.onRender();
|
|
37416
37821
|
}
|
|
37417
37822
|
getType() {
|
|
@@ -37422,20 +37827,27 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37422
37827
|
this.forceStageChange = true;
|
|
37423
37828
|
this.onRender();
|
|
37424
37829
|
}
|
|
37830
|
+
getDotsType() {
|
|
37831
|
+
return this.config.gridDotType;
|
|
37832
|
+
}
|
|
37833
|
+
setDotsType(type) {
|
|
37834
|
+
this.config.gridDotType = type;
|
|
37835
|
+
this.forceStageChange = true;
|
|
37836
|
+
this.onRender();
|
|
37837
|
+
}
|
|
37425
37838
|
};
|
|
37426
37839
|
|
|
37427
37840
|
//#endregion
|
|
37428
37841
|
//#region src/plugins/stage-panning/stage-panning.ts
|
|
37429
37842
|
var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
37430
|
-
panning = false;
|
|
37431
|
-
currentPointer = null;
|
|
37432
|
-
stageScrollInterval = void 0;
|
|
37433
|
-
panEdgeTargets = {};
|
|
37434
37843
|
getLayerName = void 0;
|
|
37435
37844
|
initLayer = void 0;
|
|
37436
37845
|
constructor(params) {
|
|
37437
37846
|
super();
|
|
37438
37847
|
this.config = mergeExceptArrays(WEAVE_STAGE_PANNING_DEFAULT_CONFIG, params?.config ?? {});
|
|
37848
|
+
this.initialize();
|
|
37849
|
+
}
|
|
37850
|
+
initialize() {
|
|
37439
37851
|
this.pointers = new Map();
|
|
37440
37852
|
this.panning = false;
|
|
37441
37853
|
this.isDragging = false;
|
|
@@ -37447,6 +37859,9 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37447
37859
|
this.isCtrlOrMetaPressed = false;
|
|
37448
37860
|
this.isSpaceKeyPressed = false;
|
|
37449
37861
|
this.previousPointer = null;
|
|
37862
|
+
this.currentPointer = null;
|
|
37863
|
+
this.stageScrollInterval = void 0;
|
|
37864
|
+
this.panEdgeTargets = {};
|
|
37450
37865
|
}
|
|
37451
37866
|
getName() {
|
|
37452
37867
|
return WEAVE_STAGE_PANNING_KEY;
|
|
@@ -37480,7 +37895,7 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37480
37895
|
this.isSpaceKeyPressed = true;
|
|
37481
37896
|
this.setCursor();
|
|
37482
37897
|
}
|
|
37483
|
-
});
|
|
37898
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37484
37899
|
window.addEventListener("keyup", (e) => {
|
|
37485
37900
|
if (e.key === "Meta" || e.key === "Control") this.isCtrlOrMetaPressed = false;
|
|
37486
37901
|
if (e.code === "Space") {
|
|
@@ -37491,7 +37906,7 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37491
37906
|
this.isSpaceKeyPressed = false;
|
|
37492
37907
|
this.disableMove();
|
|
37493
37908
|
}
|
|
37494
|
-
});
|
|
37909
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37495
37910
|
let lastPos = null;
|
|
37496
37911
|
stage.on("pointerdown", (e) => {
|
|
37497
37912
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -37564,7 +37979,10 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37564
37979
|
this.instance.emitEvent("onStageMove");
|
|
37565
37980
|
};
|
|
37566
37981
|
const handleWheelThrottled = (0, import_lodash.throttle)(handleWheel, WEAVE_STAGE_PANNING_THROTTLE_MS);
|
|
37567
|
-
window.addEventListener("wheel", handleWheelThrottled, {
|
|
37982
|
+
window.addEventListener("wheel", handleWheelThrottled, {
|
|
37983
|
+
passive: true,
|
|
37984
|
+
signal: this.instance.getEventsController()?.signal
|
|
37985
|
+
});
|
|
37568
37986
|
stage.on("dragstart", (e) => {
|
|
37569
37987
|
const duration = 1e3 / 60;
|
|
37570
37988
|
if (this.panEdgeTargets[e.target.getAttrs().id ?? ""] !== void 0) return;
|
|
@@ -37622,7 +38040,10 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37622
38040
|
stage.container().style.setProperty("-webkit-user-drag", "none");
|
|
37623
38041
|
stage.getContent().addEventListener("touchmove", function(e) {
|
|
37624
38042
|
e.preventDefault();
|
|
37625
|
-
}, {
|
|
38043
|
+
}, {
|
|
38044
|
+
passive: false,
|
|
38045
|
+
signal: this.instance.getEventsController()?.signal
|
|
38046
|
+
});
|
|
37626
38047
|
}
|
|
37627
38048
|
isPanning() {
|
|
37628
38049
|
return this.panning;
|
|
@@ -37700,6 +38121,9 @@ var WeaveStageMinimapPlugin = class extends WeavePlugin {
|
|
|
37700
38121
|
constructor(params) {
|
|
37701
38122
|
super();
|
|
37702
38123
|
this.config = mergeExceptArrays(STAGE_MINIMAP_DEFAULT_CONFIG, params.config);
|
|
38124
|
+
this.initialize();
|
|
38125
|
+
}
|
|
38126
|
+
initialize() {
|
|
37703
38127
|
this.initialized = false;
|
|
37704
38128
|
}
|
|
37705
38129
|
getName() {
|
|
@@ -37877,6 +38301,7 @@ const WEAVE_STAGE_RESIZE_KEY = "stageResize";
|
|
|
37877
38301
|
var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
37878
38302
|
getLayerName = void 0;
|
|
37879
38303
|
initLayer = void 0;
|
|
38304
|
+
initialize = void 0;
|
|
37880
38305
|
getName() {
|
|
37881
38306
|
return WEAVE_STAGE_RESIZE_KEY;
|
|
37882
38307
|
}
|
|
@@ -37896,6 +38321,10 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
|
37896
38321
|
const pluginInstance = plugins[pluginId];
|
|
37897
38322
|
pluginInstance.onRender?.();
|
|
37898
38323
|
}
|
|
38324
|
+
this.instance.emitEvent("onStageResize", {
|
|
38325
|
+
width: stage.width(),
|
|
38326
|
+
height: stage.height()
|
|
38327
|
+
});
|
|
37899
38328
|
}
|
|
37900
38329
|
}
|
|
37901
38330
|
onInit() {
|
|
@@ -37904,7 +38333,7 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
|
37904
38333
|
}, DEFAULT_THROTTLE_MS);
|
|
37905
38334
|
window.addEventListener("resize", () => {
|
|
37906
38335
|
throttledResize();
|
|
37907
|
-
});
|
|
38336
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37908
38337
|
const resizeObserver = new ResizeObserver(() => {
|
|
37909
38338
|
throttledResize();
|
|
37910
38339
|
});
|
|
@@ -37922,10 +38351,12 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
|
37922
38351
|
//#endregion
|
|
37923
38352
|
//#region src/plugins/nodes-multi-selection-feedback/nodes-multi-selection-feedback.ts
|
|
37924
38353
|
var WeaveNodesMultiSelectionFeedbackPlugin = class extends WeavePlugin {
|
|
37925
|
-
selectedHalos = {};
|
|
37926
38354
|
constructor(params) {
|
|
37927
38355
|
super();
|
|
37928
38356
|
this.config = mergeExceptArrays(WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_DEFAULT_CONFIG, params?.config ?? {});
|
|
38357
|
+
this.initialize();
|
|
38358
|
+
}
|
|
38359
|
+
initialize() {
|
|
37929
38360
|
this.selectedHalos = {};
|
|
37930
38361
|
}
|
|
37931
38362
|
getName() {
|
|
@@ -38091,12 +38522,14 @@ var WeaveNodesMultiSelectionFeedbackPlugin = class extends WeavePlugin {
|
|
|
38091
38522
|
//#endregion
|
|
38092
38523
|
//#region src/plugins/connected-users/connected-users.ts
|
|
38093
38524
|
var WeaveConnectedUsersPlugin = class extends WeavePlugin {
|
|
38094
|
-
connectedUsers = {};
|
|
38095
38525
|
getLayerName = void 0;
|
|
38096
38526
|
constructor(params) {
|
|
38097
38527
|
super();
|
|
38098
38528
|
const { config } = params ?? {};
|
|
38099
38529
|
this.config = config;
|
|
38530
|
+
this.initialize();
|
|
38531
|
+
}
|
|
38532
|
+
initialize() {
|
|
38100
38533
|
this.connectedUsers = {};
|
|
38101
38534
|
}
|
|
38102
38535
|
getName() {
|
|
@@ -38143,6 +38576,9 @@ var WeaveUsersSelectionPlugin = class extends WeavePlugin {
|
|
|
38143
38576
|
this.config = config;
|
|
38144
38577
|
this.config.getUser = memoize(this.config.getUser);
|
|
38145
38578
|
this.config.getUserColor = memoize(this.config.getUserColor);
|
|
38579
|
+
this.initialize();
|
|
38580
|
+
}
|
|
38581
|
+
initialize() {
|
|
38146
38582
|
this.usersSelection = {};
|
|
38147
38583
|
}
|
|
38148
38584
|
getName() {
|
|
@@ -38335,6 +38771,9 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
38335
38771
|
this.config.getUser = memoize(this.config.getUser);
|
|
38336
38772
|
this.config.getUserBackgroundColor = memoize(this.config.getUserBackgroundColor);
|
|
38337
38773
|
this.config.getUserForegroundColor = memoize(this.config.getUserForegroundColor);
|
|
38774
|
+
this.initialize();
|
|
38775
|
+
}
|
|
38776
|
+
initialize() {
|
|
38338
38777
|
this.usersPointers = {};
|
|
38339
38778
|
this.usersOperations = {};
|
|
38340
38779
|
}
|
|
@@ -38545,6 +38984,9 @@ var WeaveUsersPresencePlugin = class extends WeavePlugin {
|
|
|
38545
38984
|
super();
|
|
38546
38985
|
const { config } = params;
|
|
38547
38986
|
this.config = mergeExceptArrays(WEAVE_USERS_PRESENCE_CONFIG_DEFAULT_PROPS, config);
|
|
38987
|
+
this.initialize();
|
|
38988
|
+
}
|
|
38989
|
+
initialize() {
|
|
38548
38990
|
this.userPresence = {};
|
|
38549
38991
|
}
|
|
38550
38992
|
getName() {
|
|
@@ -38620,6 +39062,9 @@ var WeaveStageDropAreaPlugin = class extends WeavePlugin {
|
|
|
38620
39062
|
initLayer = void 0;
|
|
38621
39063
|
constructor() {
|
|
38622
39064
|
super();
|
|
39065
|
+
this.initialize();
|
|
39066
|
+
}
|
|
39067
|
+
initialize() {
|
|
38623
39068
|
this.enabled = true;
|
|
38624
39069
|
}
|
|
38625
39070
|
getName() {
|
|
@@ -38633,14 +39078,20 @@ var WeaveStageDropAreaPlugin = class extends WeavePlugin {
|
|
|
38633
39078
|
stage.container().addEventListener("dragover", (e) => {
|
|
38634
39079
|
e.preventDefault();
|
|
38635
39080
|
e.stopPropagation();
|
|
38636
|
-
});
|
|
39081
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
38637
39082
|
stage.container().addEventListener("drop", (e) => {
|
|
38638
39083
|
e.preventDefault();
|
|
38639
39084
|
e.stopPropagation();
|
|
38640
39085
|
this.instance.emitEvent("onStageDrop", e);
|
|
39086
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
39087
|
+
window.addEventListener("dragover", (e) => e.preventDefault(), {
|
|
39088
|
+
signal: this.instance.getEventsController()?.signal,
|
|
39089
|
+
passive: false
|
|
39090
|
+
});
|
|
39091
|
+
window.addEventListener("drop", (e) => e.preventDefault(), {
|
|
39092
|
+
signal: this.instance.getEventsController()?.signal,
|
|
39093
|
+
passive: false
|
|
38641
39094
|
});
|
|
38642
|
-
window.addEventListener("dragover", (e) => e.preventDefault(), { passive: false });
|
|
38643
|
-
window.addEventListener("drop", (e) => e.preventDefault(), { passive: false });
|
|
38644
39095
|
}
|
|
38645
39096
|
enable() {
|
|
38646
39097
|
this.enabled = true;
|
|
@@ -38659,6 +39110,9 @@ var WeaveNodesEdgeSnappingPlugin = class extends WeavePlugin {
|
|
|
38659
39110
|
this.guideLineConfig = config?.guideLine ?? GUIDE_LINE_DEFAULT_CONFIG;
|
|
38660
39111
|
this.dragSnappingThreshold = config?.dragSnappingThreshold ?? GUIDE_LINE_DRAG_SNAPPING_THRESHOLD;
|
|
38661
39112
|
this.transformSnappingThreshold = config?.transformSnappingThreshold ?? GUIDE_LINE_TRANSFORM_SNAPPING_THRESHOLD;
|
|
39113
|
+
this.initialize();
|
|
39114
|
+
}
|
|
39115
|
+
initialize() {
|
|
38662
39116
|
this.enabled = true;
|
|
38663
39117
|
}
|
|
38664
39118
|
getName() {
|
|
@@ -39035,6 +39489,9 @@ var WeaveNodesDistanceSnappingPlugin = class extends WeavePlugin {
|
|
|
39035
39489
|
this.enterSnappingTolerance = config?.enterSnappingTolerance ?? GUIDE_ENTER_SNAPPING_TOLERANCE;
|
|
39036
39490
|
this.exitSnappingTolerance = config?.exitSnappingTolerance ?? GUIDE_EXIT_SNAPPING_TOLERANCE;
|
|
39037
39491
|
this.uiConfig = mergeExceptArrays(GUIDE_DISTANCE_LINE_DEFAULT_CONFIG, config?.ui);
|
|
39492
|
+
this.initialize();
|
|
39493
|
+
}
|
|
39494
|
+
initialize() {
|
|
39038
39495
|
this.enabled = true;
|
|
39039
39496
|
}
|
|
39040
39497
|
getName() {
|
|
@@ -39681,12 +40138,14 @@ var WeaveNodesDistanceSnappingPlugin = class extends WeavePlugin {
|
|
|
39681
40138
|
//#endregion
|
|
39682
40139
|
//#region src/plugins/comments-renderer/comments-renderer.ts
|
|
39683
40140
|
var WeaveCommentsRendererPlugin = class extends WeavePlugin {
|
|
39684
|
-
comments = [];
|
|
39685
40141
|
getLayerName = void 0;
|
|
39686
40142
|
constructor(params) {
|
|
39687
40143
|
super();
|
|
39688
40144
|
const { config } = params ?? {};
|
|
39689
40145
|
this.config = config;
|
|
40146
|
+
this.initialize();
|
|
40147
|
+
}
|
|
40148
|
+
initialize() {
|
|
39690
40149
|
this.comments = [];
|
|
39691
40150
|
}
|
|
39692
40151
|
getName() {
|
|
@@ -39777,6 +40236,7 @@ const WEAVE_STAGE_KEYBOARD_MOVE_DEFAULT_CONFIG = { movementDelta: 5 };
|
|
|
39777
40236
|
var WeaveStageKeyboardMovePlugin = class extends WeavePlugin {
|
|
39778
40237
|
getLayerName = void 0;
|
|
39779
40238
|
initLayer = void 0;
|
|
40239
|
+
initialize = void 0;
|
|
39780
40240
|
constructor(params) {
|
|
39781
40241
|
super();
|
|
39782
40242
|
this.config = mergeExceptArrays(WEAVE_STAGE_KEYBOARD_MOVE_DEFAULT_CONFIG, params?.config ?? {});
|
|
@@ -39815,7 +40275,7 @@ var WeaveStageKeyboardMovePlugin = class extends WeavePlugin {
|
|
|
39815
40275
|
if (e.code === "ArrowLeft" && e.shiftKey) this.handleNodesMovement("left");
|
|
39816
40276
|
if (e.code === "ArrowRight" && e.shiftKey) this.handleNodesMovement("right");
|
|
39817
40277
|
if (e.code === "ArrowDown" && e.shiftKey) this.handleNodesMovement("down");
|
|
39818
|
-
});
|
|
40278
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
39819
40279
|
}
|
|
39820
40280
|
enable() {
|
|
39821
40281
|
this.enabled = true;
|
|
@@ -39826,5 +40286,5 @@ var WeaveStageKeyboardMovePlugin = class extends WeavePlugin {
|
|
|
39826
40286
|
};
|
|
39827
40287
|
|
|
39828
40288
|
//#endregion
|
|
39829
|
-
export { ALIGN_NODES_ALIGN_TO, ALIGN_NODES_TOOL_ACTION_NAME, ALIGN_NODES_TOOL_STATE,
|
|
40289
|
+
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, setupCanvasBackend, setupSkiaBackend, weavejsToYjsBinary };
|
|
39830
40290
|
//# sourceMappingURL=types.js.map
|