@inditextech/weave-sdk 3.6.0 → 3.7.0-SNAPSHOT.134.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 +783 -176
- package/dist/sdk.node.js +783 -176
- package/dist/types.d.ts +132 -29
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +783 -176
- package/dist/types.js.map +1 -1
- package/package.json +2 -3
package/dist/sdk.node.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Konva from "konva";
|
|
2
2
|
import { randomFillSync, randomUUID } from "crypto";
|
|
3
3
|
import pino from "pino";
|
|
4
|
-
import { WEAVE_ASYNC_STATUS, WEAVE_AWARENESS_LAYER_ID, WEAVE_EXPORT_BACKGROUND_COLOR, WEAVE_EXPORT_FORMATS, WEAVE_INSTANCE_STATUS, WEAVE_KONVA_BACKEND, WEAVE_LOG_LEVEL, WEAVE_NODE_CHANGE_TYPE, WEAVE_NODE_CUSTOM_EVENTS, WEAVE_NODE_LAYER_ID, WEAVE_NODE_POSITION, WEAVE_STORE_CONNECTION_STATUS, WEAVE_UTILITY_LAYER_ID } from "@inditextech/weave-types";
|
|
4
|
+
import { WEAVE_ASYNC_STATUS, WEAVE_AWARENESS_LAYER_ID, WEAVE_EXPORT_BACKGROUND_COLOR, WEAVE_EXPORT_FORMATS, WEAVE_EXPORT_RETURN_FORMAT, WEAVE_INSTANCE_STATUS, WEAVE_KONVA_BACKEND, WEAVE_LOG_LEVEL, WEAVE_NODE_CHANGE_TYPE, WEAVE_NODE_CUSTOM_EVENTS, WEAVE_NODE_LAYER_ID, WEAVE_NODE_POSITION, WEAVE_STORE_CONNECTION_STATUS, WEAVE_UTILITY_LAYER_ID } from "@inditextech/weave-types";
|
|
5
5
|
import { getYjsDoc, getYjsValue, observeDeep, syncedStore } from "@syncedstore/core";
|
|
6
6
|
import * as Y from "yjs";
|
|
7
7
|
import "konva/lib/types";
|
|
@@ -15083,6 +15083,11 @@ var WeaveStore = class {
|
|
|
15083
15083
|
getDocument() {
|
|
15084
15084
|
return this.document;
|
|
15085
15085
|
}
|
|
15086
|
+
restartDocument() {
|
|
15087
|
+
this.latestState = { weave: {} };
|
|
15088
|
+
this.state = syncedStore({ weave: {} });
|
|
15089
|
+
this.document = getYjsDoc(this.state);
|
|
15090
|
+
}
|
|
15086
15091
|
loadDocument(roomData) {
|
|
15087
15092
|
yjs_default.applyUpdate(this.document, roomData);
|
|
15088
15093
|
}
|
|
@@ -17958,6 +17963,15 @@ var WeaveContextMenuPlugin = class extends WeavePlugin {
|
|
|
17958
17963
|
initLayer = void 0;
|
|
17959
17964
|
constructor(params) {
|
|
17960
17965
|
super();
|
|
17966
|
+
const { config } = params ?? {};
|
|
17967
|
+
this.config = {
|
|
17968
|
+
xOffset: WEAVE_CONTEXT_MENU_X_OFFSET_DEFAULT,
|
|
17969
|
+
yOffset: WEAVE_CONTEXT_MENU_Y_OFFSET_DEFAULT,
|
|
17970
|
+
...config
|
|
17971
|
+
};
|
|
17972
|
+
this.initialize();
|
|
17973
|
+
}
|
|
17974
|
+
initialize() {
|
|
17961
17975
|
this.timer = null;
|
|
17962
17976
|
this.tapHold = false;
|
|
17963
17977
|
this.contextMenuVisible = false;
|
|
@@ -17967,12 +17981,6 @@ var WeaveContextMenuPlugin = class extends WeavePlugin {
|
|
|
17967
17981
|
time: 0
|
|
17968
17982
|
};
|
|
17969
17983
|
this.tapHoldTimeout = WEAVE_CONTEXT_MENU_TAP_HOLD_TIMEOUT;
|
|
17970
|
-
const { config } = params ?? {};
|
|
17971
|
-
this.config = {
|
|
17972
|
-
xOffset: WEAVE_CONTEXT_MENU_X_OFFSET_DEFAULT,
|
|
17973
|
-
yOffset: WEAVE_CONTEXT_MENU_Y_OFFSET_DEFAULT,
|
|
17974
|
-
...config
|
|
17975
|
-
};
|
|
17976
17984
|
this.pointers = {};
|
|
17977
17985
|
}
|
|
17978
17986
|
getName() {
|
|
@@ -18623,7 +18631,10 @@ const DEFAULT_ADD_NODE_OPTIONS = { emitUserChangeEvent: false };
|
|
|
18623
18631
|
const DEFAULT_UPDATE_NODE_OPTIONS = { emitUserChangeEvent: false };
|
|
18624
18632
|
const DEFAULT_REMOVE_NODE_OPTIONS = { emitUserChangeEvent: false };
|
|
18625
18633
|
const DEFAULT_MOVE_NODE_OPTIONS = { emitUserChangeEvent: false };
|
|
18626
|
-
const WEAVE_DEFAULT_CONFIG = {
|
|
18634
|
+
const WEAVE_DEFAULT_CONFIG = {
|
|
18635
|
+
behaviors: { axisLockThreshold: 5 },
|
|
18636
|
+
performance: { upscale: { enabled: false } }
|
|
18637
|
+
};
|
|
18627
18638
|
|
|
18628
18639
|
//#endregion
|
|
18629
18640
|
//#region src/plugins/users-presence/constants.ts
|
|
@@ -18652,6 +18663,9 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
18652
18663
|
constructor(params) {
|
|
18653
18664
|
super();
|
|
18654
18665
|
this.config = mergeExceptArrays(WEAVE_NODES_SELECTION_DEFAULT_CONFIG, params?.config ?? {});
|
|
18666
|
+
this.initialize();
|
|
18667
|
+
}
|
|
18668
|
+
initialize() {
|
|
18655
18669
|
this.defaultEnabledAnchors = this.config.selection?.enabledAnchors ?? [
|
|
18656
18670
|
"top-left",
|
|
18657
18671
|
"top-center",
|
|
@@ -18815,7 +18829,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
18815
18829
|
nodeHovered = void 0;
|
|
18816
18830
|
}
|
|
18817
18831
|
this.instance.getStage().handleMouseover?.();
|
|
18818
|
-
});
|
|
18832
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
18819
18833
|
const handleTransform = (e) => {
|
|
18820
18834
|
const moved = this.checkMoved(e);
|
|
18821
18835
|
if (moved) this.getContextMenuPlugin()?.cancelLongPressTimer();
|
|
@@ -19221,6 +19235,10 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
19221
19235
|
initEvents() {
|
|
19222
19236
|
this.selecting = false;
|
|
19223
19237
|
const stage = this.instance.getStage();
|
|
19238
|
+
window.addEventListener("blur", () => {
|
|
19239
|
+
this.isCtrlMetaPressed = false;
|
|
19240
|
+
this.isSpaceKeyPressed = false;
|
|
19241
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
19224
19242
|
stage.container().addEventListener("keydown", (e) => {
|
|
19225
19243
|
if (e.ctrlKey || e.metaKey) this.isCtrlMetaPressed = true;
|
|
19226
19244
|
if (e.code === "Space") this.isSpaceKeyPressed = true;
|
|
@@ -19230,11 +19248,11 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
19230
19248
|
});
|
|
19231
19249
|
return;
|
|
19232
19250
|
}
|
|
19233
|
-
});
|
|
19251
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
19234
19252
|
stage.container().addEventListener("keyup", (e) => {
|
|
19235
19253
|
if (!(e.ctrlKey || e.metaKey)) this.isCtrlMetaPressed = false;
|
|
19236
19254
|
if (e.code === "Space") this.isSpaceKeyPressed = false;
|
|
19237
|
-
});
|
|
19255
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
19238
19256
|
stage.on("pointerdown", (e) => {
|
|
19239
19257
|
this.setTapStart(e);
|
|
19240
19258
|
this.handledClickOrTap = false;
|
|
@@ -19441,7 +19459,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
19441
19459
|
if (existNode) newSelectedNodes.push(existNode);
|
|
19442
19460
|
}
|
|
19443
19461
|
this.tr.nodes([...newSelectedNodes]);
|
|
19444
|
-
this.tr.forceUpdate();
|
|
19462
|
+
if (newSelectedNodes.length > 0) this.tr.forceUpdate();
|
|
19445
19463
|
this.triggerSelectedNodesEvent();
|
|
19446
19464
|
}
|
|
19447
19465
|
getSelectionPlugin() {
|
|
@@ -19694,6 +19712,9 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
|
|
|
19694
19712
|
super();
|
|
19695
19713
|
this.getImageBase64 = params.getImageBase64;
|
|
19696
19714
|
this.config = mergeExceptArrays(WEAVE_COPY_PASTE_CONFIG_DEFAULT, params?.config);
|
|
19715
|
+
this.initialize();
|
|
19716
|
+
}
|
|
19717
|
+
initialize() {
|
|
19697
19718
|
this.actualInternalPaddingX = 0;
|
|
19698
19719
|
this.actualInternalPaddingY = 0;
|
|
19699
19720
|
this.lastInternalPasteSnapshot = "";
|
|
@@ -19799,7 +19820,7 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
|
|
|
19799
19820
|
this.focusPasteCatcher();
|
|
19800
19821
|
if (!this.enabled) return;
|
|
19801
19822
|
}
|
|
19802
|
-
});
|
|
19823
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
19803
19824
|
if (catcher) catcher.addEventListener("paste", async (e) => {
|
|
19804
19825
|
e.preventDefault();
|
|
19805
19826
|
let items = void 0;
|
|
@@ -19818,7 +19839,7 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
|
|
|
19818
19839
|
return;
|
|
19819
19840
|
}
|
|
19820
19841
|
this.sendExternalPasteEvent(void 0, items);
|
|
19821
|
-
});
|
|
19842
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
19822
19843
|
}
|
|
19823
19844
|
sendExternalPasteEvent(dataList, items) {
|
|
19824
19845
|
const stage = this.instance.getStage();
|
|
@@ -21973,11 +21994,34 @@ var WeaveRegisterManager = class {
|
|
|
21973
21994
|
}
|
|
21974
21995
|
}
|
|
21975
21996
|
}
|
|
21997
|
+
resetNodesHandlers() {
|
|
21998
|
+
for (const nodeHandlerId of Object.keys(this.nodesHandlers)) {
|
|
21999
|
+
const nodeHandler = this.nodesHandlers[nodeHandlerId];
|
|
22000
|
+
nodeHandler.initialize?.();
|
|
22001
|
+
}
|
|
22002
|
+
}
|
|
22003
|
+
resetActionsHandlers() {
|
|
22004
|
+
for (const actionHandlerId of Object.keys(this.actionsHandlers)) {
|
|
22005
|
+
const actionHandler = this.actionsHandlers[actionHandlerId];
|
|
22006
|
+
actionHandler.initialize?.();
|
|
22007
|
+
}
|
|
22008
|
+
}
|
|
22009
|
+
resetPlugins() {
|
|
22010
|
+
for (const pluginId of Object.keys(this.plugins)) {
|
|
22011
|
+
const plugin = this.plugins[pluginId];
|
|
22012
|
+
plugin.initialize?.();
|
|
22013
|
+
}
|
|
22014
|
+
}
|
|
22015
|
+
reset() {
|
|
22016
|
+
this.resetNodesHandlers();
|
|
22017
|
+
this.resetActionsHandlers();
|
|
22018
|
+
this.resetPlugins();
|
|
22019
|
+
}
|
|
21976
22020
|
};
|
|
21977
22021
|
|
|
21978
22022
|
//#endregion
|
|
21979
22023
|
//#region package.json
|
|
21980
|
-
var version = "3.
|
|
22024
|
+
var version = "3.7.0-SNAPSHOT.134.1";
|
|
21981
22025
|
|
|
21982
22026
|
//#endregion
|
|
21983
22027
|
//#region src/managers/setup.ts
|
|
@@ -22094,6 +22138,11 @@ var WeaveStageManager = class {
|
|
|
22094
22138
|
initialZIndex: void 0
|
|
22095
22139
|
};
|
|
22096
22140
|
const stage = new Konva.Stage({ ...props });
|
|
22141
|
+
if (!this.instance.isServerSide()) {
|
|
22142
|
+
const containerParent = stage.container().parentNode;
|
|
22143
|
+
stage.width(containerParent.clientWidth);
|
|
22144
|
+
stage.height(containerParent.clientHeight);
|
|
22145
|
+
}
|
|
22097
22146
|
const realContainer = stage.container();
|
|
22098
22147
|
if (realContainer !== void 0 && realContainer.style?.position !== "relative") realContainer.style.position = "relative";
|
|
22099
22148
|
this.setStage(stage);
|
|
@@ -22304,6 +22353,172 @@ var WeaveExportManager = class {
|
|
|
22304
22353
|
}
|
|
22305
22354
|
});
|
|
22306
22355
|
}
|
|
22356
|
+
exportNodesAsBlob(nodes, boundingNodes, options) {
|
|
22357
|
+
return new Promise((resolve) => {
|
|
22358
|
+
const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
|
|
22359
|
+
const nodesSelectionPluginPrev = this.getNodesSelectionPlugin()?.isEnabled();
|
|
22360
|
+
const nodesDistanceSnappingPluginPrev = this.getNodesDistanceSnappingPlugin()?.isEnabled();
|
|
22361
|
+
const nodesEdgeSnappingPluginPrev = this.getNodesDistanceSnappingPlugin()?.isEnabled();
|
|
22362
|
+
const nodesStageGridPluginPrev = this.getStageGridPlugin()?.isEnabled();
|
|
22363
|
+
this.getNodesSelectionPlugin()?.disable();
|
|
22364
|
+
this.getNodesDistanceSnappingPlugin()?.disable();
|
|
22365
|
+
this.getNodesEdgeSnappingPlugin()?.disable();
|
|
22366
|
+
this.getStageGridPlugin()?.disable();
|
|
22367
|
+
const stage = this.instance.getStage();
|
|
22368
|
+
const mainLayer = this.instance.getMainLayer();
|
|
22369
|
+
const originalPosition = {
|
|
22370
|
+
x: stage.x(),
|
|
22371
|
+
y: stage.y()
|
|
22372
|
+
};
|
|
22373
|
+
const originalScale = {
|
|
22374
|
+
x: stage.scaleX(),
|
|
22375
|
+
y: stage.scaleY()
|
|
22376
|
+
};
|
|
22377
|
+
stage.scale({
|
|
22378
|
+
x: 1,
|
|
22379
|
+
y: 1
|
|
22380
|
+
});
|
|
22381
|
+
if (mainLayer) {
|
|
22382
|
+
const bounds = getExportBoundingBox(boundingNodes(nodes));
|
|
22383
|
+
const scaleX = stage.scaleX();
|
|
22384
|
+
const scaleY = stage.scaleY();
|
|
22385
|
+
const unscaledBounds = {
|
|
22386
|
+
x: bounds.x / scaleX,
|
|
22387
|
+
y: bounds.y / scaleY,
|
|
22388
|
+
width: bounds.width / scaleX,
|
|
22389
|
+
height: bounds.height / scaleY
|
|
22390
|
+
};
|
|
22391
|
+
const exportGroup = new Konva.Group();
|
|
22392
|
+
const background = new Konva.Rect({
|
|
22393
|
+
x: unscaledBounds.x - padding,
|
|
22394
|
+
y: unscaledBounds.y - padding,
|
|
22395
|
+
width: unscaledBounds.width + 2 * padding,
|
|
22396
|
+
height: unscaledBounds.height + 2 * padding,
|
|
22397
|
+
strokeWidth: 0,
|
|
22398
|
+
fill: backgroundColor
|
|
22399
|
+
});
|
|
22400
|
+
exportGroup.add(background);
|
|
22401
|
+
for (const node of nodes) {
|
|
22402
|
+
const clonedNode = node.clone({ id: v4_default() });
|
|
22403
|
+
const absPos = node.getAbsolutePosition();
|
|
22404
|
+
clonedNode.absolutePosition({
|
|
22405
|
+
x: absPos.x / scaleX,
|
|
22406
|
+
y: absPos.y / scaleY
|
|
22407
|
+
});
|
|
22408
|
+
exportGroup.add(clonedNode);
|
|
22409
|
+
}
|
|
22410
|
+
mainLayer.add(exportGroup);
|
|
22411
|
+
const backgroundRect = background.getClientRect();
|
|
22412
|
+
stage.batchDraw();
|
|
22413
|
+
const { pixelRatio: finalPixelRatio } = this.fitKonvaPixelRatio(Math.round(backgroundRect.width), Math.round(backgroundRect.height), pixelRatio);
|
|
22414
|
+
exportGroup.toBlob({
|
|
22415
|
+
x: Math.round(backgroundRect.x),
|
|
22416
|
+
y: Math.round(backgroundRect.y),
|
|
22417
|
+
width: Math.round(backgroundRect.width),
|
|
22418
|
+
height: Math.round(backgroundRect.height),
|
|
22419
|
+
mimeType: format,
|
|
22420
|
+
pixelRatio: finalPixelRatio,
|
|
22421
|
+
quality: options.quality ?? 1,
|
|
22422
|
+
callback: (blob) => {
|
|
22423
|
+
exportGroup.destroy();
|
|
22424
|
+
stage.position(originalPosition);
|
|
22425
|
+
stage.scale(originalScale);
|
|
22426
|
+
stage.batchDraw();
|
|
22427
|
+
if (nodesSelectionPluginPrev) this.getNodesSelectionPlugin()?.enable();
|
|
22428
|
+
if (nodesDistanceSnappingPluginPrev) this.getNodesDistanceSnappingPlugin()?.enable();
|
|
22429
|
+
if (nodesEdgeSnappingPluginPrev) this.getNodesEdgeSnappingPlugin()?.enable();
|
|
22430
|
+
if (nodesStageGridPluginPrev) this.getStageGridPlugin()?.enable();
|
|
22431
|
+
if (!blob) {
|
|
22432
|
+
(0, import_lodash.reject)(new Error("Failed to generate image blob"));
|
|
22433
|
+
return;
|
|
22434
|
+
}
|
|
22435
|
+
resolve(blob);
|
|
22436
|
+
}
|
|
22437
|
+
});
|
|
22438
|
+
}
|
|
22439
|
+
});
|
|
22440
|
+
}
|
|
22441
|
+
exportNodesAsCanvas(nodes, boundingNodes, options) {
|
|
22442
|
+
return new Promise((resolve) => {
|
|
22443
|
+
const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
|
|
22444
|
+
const nodesSelectionPluginPrev = this.getNodesSelectionPlugin()?.isEnabled();
|
|
22445
|
+
const nodesDistanceSnappingPluginPrev = this.getNodesDistanceSnappingPlugin()?.isEnabled();
|
|
22446
|
+
const nodesEdgeSnappingPluginPrev = this.getNodesDistanceSnappingPlugin()?.isEnabled();
|
|
22447
|
+
const nodesStageGridPluginPrev = this.getStageGridPlugin()?.isEnabled();
|
|
22448
|
+
this.getNodesSelectionPlugin()?.disable();
|
|
22449
|
+
this.getNodesDistanceSnappingPlugin()?.disable();
|
|
22450
|
+
this.getNodesEdgeSnappingPlugin()?.disable();
|
|
22451
|
+
this.getStageGridPlugin()?.disable();
|
|
22452
|
+
const stage = this.instance.getStage();
|
|
22453
|
+
const mainLayer = this.instance.getMainLayer();
|
|
22454
|
+
const originalPosition = {
|
|
22455
|
+
x: stage.x(),
|
|
22456
|
+
y: stage.y()
|
|
22457
|
+
};
|
|
22458
|
+
const originalScale = {
|
|
22459
|
+
x: stage.scaleX(),
|
|
22460
|
+
y: stage.scaleY()
|
|
22461
|
+
};
|
|
22462
|
+
stage.scale({
|
|
22463
|
+
x: 1,
|
|
22464
|
+
y: 1
|
|
22465
|
+
});
|
|
22466
|
+
if (mainLayer) {
|
|
22467
|
+
const bounds = getExportBoundingBox(boundingNodes(nodes));
|
|
22468
|
+
const scaleX = stage.scaleX();
|
|
22469
|
+
const scaleY = stage.scaleY();
|
|
22470
|
+
const unscaledBounds = {
|
|
22471
|
+
x: bounds.x / scaleX,
|
|
22472
|
+
y: bounds.y / scaleY,
|
|
22473
|
+
width: bounds.width / scaleX,
|
|
22474
|
+
height: bounds.height / scaleY
|
|
22475
|
+
};
|
|
22476
|
+
const exportGroup = new Konva.Group();
|
|
22477
|
+
const background = new Konva.Rect({
|
|
22478
|
+
x: unscaledBounds.x - padding,
|
|
22479
|
+
y: unscaledBounds.y - padding,
|
|
22480
|
+
width: unscaledBounds.width + 2 * padding,
|
|
22481
|
+
height: unscaledBounds.height + 2 * padding,
|
|
22482
|
+
strokeWidth: 0,
|
|
22483
|
+
fill: backgroundColor
|
|
22484
|
+
});
|
|
22485
|
+
exportGroup.add(background);
|
|
22486
|
+
for (const node of nodes) {
|
|
22487
|
+
const clonedNode = node.clone({ id: v4_default() });
|
|
22488
|
+
const absPos = node.getAbsolutePosition();
|
|
22489
|
+
clonedNode.absolutePosition({
|
|
22490
|
+
x: absPos.x / scaleX,
|
|
22491
|
+
y: absPos.y / scaleY
|
|
22492
|
+
});
|
|
22493
|
+
exportGroup.add(clonedNode);
|
|
22494
|
+
}
|
|
22495
|
+
mainLayer.add(exportGroup);
|
|
22496
|
+
const backgroundRect = background.getClientRect();
|
|
22497
|
+
stage.batchDraw();
|
|
22498
|
+
const { pixelRatio: finalPixelRatio } = this.fitKonvaPixelRatio(Math.round(backgroundRect.width), Math.round(backgroundRect.height), pixelRatio);
|
|
22499
|
+
exportGroup.toCanvas({
|
|
22500
|
+
x: Math.round(backgroundRect.x),
|
|
22501
|
+
y: Math.round(backgroundRect.y),
|
|
22502
|
+
width: Math.round(backgroundRect.width),
|
|
22503
|
+
height: Math.round(backgroundRect.height),
|
|
22504
|
+
mimeType: format,
|
|
22505
|
+
pixelRatio: finalPixelRatio,
|
|
22506
|
+
quality: options.quality ?? 1,
|
|
22507
|
+
callback: (canvas) => {
|
|
22508
|
+
exportGroup.destroy();
|
|
22509
|
+
stage.position(originalPosition);
|
|
22510
|
+
stage.scale(originalScale);
|
|
22511
|
+
stage.batchDraw();
|
|
22512
|
+
if (nodesSelectionPluginPrev) this.getNodesSelectionPlugin()?.enable();
|
|
22513
|
+
if (nodesDistanceSnappingPluginPrev) this.getNodesDistanceSnappingPlugin()?.enable();
|
|
22514
|
+
if (nodesEdgeSnappingPluginPrev) this.getNodesEdgeSnappingPlugin()?.enable();
|
|
22515
|
+
if (nodesStageGridPluginPrev) this.getStageGridPlugin()?.enable();
|
|
22516
|
+
resolve(canvas);
|
|
22517
|
+
}
|
|
22518
|
+
});
|
|
22519
|
+
}
|
|
22520
|
+
});
|
|
22521
|
+
}
|
|
22307
22522
|
exportAreaAsImage(area, options) {
|
|
22308
22523
|
return new Promise((resolve) => {
|
|
22309
22524
|
const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
|
|
@@ -22368,6 +22583,138 @@ var WeaveExportManager = class {
|
|
|
22368
22583
|
});
|
|
22369
22584
|
});
|
|
22370
22585
|
}
|
|
22586
|
+
exportAreaAsBlob(area, options) {
|
|
22587
|
+
return new Promise((resolve) => {
|
|
22588
|
+
const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
|
|
22589
|
+
const nodesSelectionPluginPrev = this.getNodesSelectionPlugin()?.isEnabled();
|
|
22590
|
+
const nodesDistanceSnappingPluginPrev = this.getNodesDistanceSnappingPlugin()?.isEnabled();
|
|
22591
|
+
const nodesEdgeSnappingPluginPrev = this.getNodesDistanceSnappingPlugin()?.isEnabled();
|
|
22592
|
+
const nodesStageGridPluginPrev = this.getStageGridPlugin()?.isEnabled();
|
|
22593
|
+
this.getNodesSelectionPlugin()?.disable();
|
|
22594
|
+
this.getNodesDistanceSnappingPlugin()?.disable();
|
|
22595
|
+
this.getNodesEdgeSnappingPlugin()?.disable();
|
|
22596
|
+
this.getStageGridPlugin()?.disable();
|
|
22597
|
+
const stage = this.instance.getStage();
|
|
22598
|
+
const mainLayer = this.instance.getMainLayer();
|
|
22599
|
+
if (!mainLayer) throw new Error("Main layer not found");
|
|
22600
|
+
const originalPosition = {
|
|
22601
|
+
x: stage.x(),
|
|
22602
|
+
y: stage.y()
|
|
22603
|
+
};
|
|
22604
|
+
const originalScale = {
|
|
22605
|
+
x: stage.scaleX(),
|
|
22606
|
+
y: stage.scaleY()
|
|
22607
|
+
};
|
|
22608
|
+
stage.scale({
|
|
22609
|
+
x: 1,
|
|
22610
|
+
y: 1
|
|
22611
|
+
});
|
|
22612
|
+
stage.position({
|
|
22613
|
+
x: 0,
|
|
22614
|
+
y: 0
|
|
22615
|
+
});
|
|
22616
|
+
const bounds = area;
|
|
22617
|
+
const background = new Konva.Rect({
|
|
22618
|
+
x: bounds.x - padding,
|
|
22619
|
+
y: bounds.y - padding,
|
|
22620
|
+
width: bounds.width + 2 * padding,
|
|
22621
|
+
height: bounds.height + 2 * padding,
|
|
22622
|
+
strokeWidth: 0,
|
|
22623
|
+
fill: backgroundColor
|
|
22624
|
+
});
|
|
22625
|
+
mainLayer.add(background);
|
|
22626
|
+
background.moveToBottom();
|
|
22627
|
+
stage.batchDraw();
|
|
22628
|
+
stage.toBlob({
|
|
22629
|
+
x: area.x,
|
|
22630
|
+
y: area.y,
|
|
22631
|
+
width: area.width,
|
|
22632
|
+
height: area.height,
|
|
22633
|
+
mimeType: format,
|
|
22634
|
+
pixelRatio,
|
|
22635
|
+
quality: options.quality ?? 1,
|
|
22636
|
+
callback: (blob) => {
|
|
22637
|
+
background.destroy();
|
|
22638
|
+
stage.position(originalPosition);
|
|
22639
|
+
stage.scale(originalScale);
|
|
22640
|
+
stage.batchDraw();
|
|
22641
|
+
if (nodesSelectionPluginPrev) this.getNodesSelectionPlugin()?.enable();
|
|
22642
|
+
if (nodesDistanceSnappingPluginPrev) this.getNodesDistanceSnappingPlugin()?.enable();
|
|
22643
|
+
if (nodesEdgeSnappingPluginPrev) this.getNodesEdgeSnappingPlugin()?.enable();
|
|
22644
|
+
if (nodesStageGridPluginPrev) this.getStageGridPlugin()?.enable();
|
|
22645
|
+
if (!blob) {
|
|
22646
|
+
(0, import_lodash.reject)(new Error("Failed to generate image blob"));
|
|
22647
|
+
return;
|
|
22648
|
+
}
|
|
22649
|
+
resolve(blob);
|
|
22650
|
+
}
|
|
22651
|
+
});
|
|
22652
|
+
});
|
|
22653
|
+
}
|
|
22654
|
+
exportAreaAsCanvas(area, options) {
|
|
22655
|
+
return new Promise((resolve) => {
|
|
22656
|
+
const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
|
|
22657
|
+
const nodesSelectionPluginPrev = this.getNodesSelectionPlugin()?.isEnabled();
|
|
22658
|
+
const nodesDistanceSnappingPluginPrev = this.getNodesDistanceSnappingPlugin()?.isEnabled();
|
|
22659
|
+
const nodesEdgeSnappingPluginPrev = this.getNodesDistanceSnappingPlugin()?.isEnabled();
|
|
22660
|
+
const nodesStageGridPluginPrev = this.getStageGridPlugin()?.isEnabled();
|
|
22661
|
+
this.getNodesSelectionPlugin()?.disable();
|
|
22662
|
+
this.getNodesDistanceSnappingPlugin()?.disable();
|
|
22663
|
+
this.getNodesEdgeSnappingPlugin()?.disable();
|
|
22664
|
+
this.getStageGridPlugin()?.disable();
|
|
22665
|
+
const stage = this.instance.getStage();
|
|
22666
|
+
const mainLayer = this.instance.getMainLayer();
|
|
22667
|
+
if (!mainLayer) throw new Error("Main layer not found");
|
|
22668
|
+
const originalPosition = {
|
|
22669
|
+
x: stage.x(),
|
|
22670
|
+
y: stage.y()
|
|
22671
|
+
};
|
|
22672
|
+
const originalScale = {
|
|
22673
|
+
x: stage.scaleX(),
|
|
22674
|
+
y: stage.scaleY()
|
|
22675
|
+
};
|
|
22676
|
+
stage.scale({
|
|
22677
|
+
x: 1,
|
|
22678
|
+
y: 1
|
|
22679
|
+
});
|
|
22680
|
+
stage.position({
|
|
22681
|
+
x: 0,
|
|
22682
|
+
y: 0
|
|
22683
|
+
});
|
|
22684
|
+
const bounds = area;
|
|
22685
|
+
const background = new Konva.Rect({
|
|
22686
|
+
x: bounds.x - padding,
|
|
22687
|
+
y: bounds.y - padding,
|
|
22688
|
+
width: bounds.width + 2 * padding,
|
|
22689
|
+
height: bounds.height + 2 * padding,
|
|
22690
|
+
strokeWidth: 0,
|
|
22691
|
+
fill: backgroundColor
|
|
22692
|
+
});
|
|
22693
|
+
mainLayer.add(background);
|
|
22694
|
+
background.moveToBottom();
|
|
22695
|
+
stage.batchDraw();
|
|
22696
|
+
stage.toCanvas({
|
|
22697
|
+
x: area.x,
|
|
22698
|
+
y: area.y,
|
|
22699
|
+
width: area.width,
|
|
22700
|
+
height: area.height,
|
|
22701
|
+
mimeType: format,
|
|
22702
|
+
pixelRatio,
|
|
22703
|
+
quality: options.quality ?? 1,
|
|
22704
|
+
callback: (canvas) => {
|
|
22705
|
+
background.destroy();
|
|
22706
|
+
stage.position(originalPosition);
|
|
22707
|
+
stage.scale(originalScale);
|
|
22708
|
+
stage.batchDraw();
|
|
22709
|
+
if (nodesSelectionPluginPrev) this.getNodesSelectionPlugin()?.enable();
|
|
22710
|
+
if (nodesDistanceSnappingPluginPrev) this.getNodesDistanceSnappingPlugin()?.enable();
|
|
22711
|
+
if (nodesEdgeSnappingPluginPrev) this.getNodesEdgeSnappingPlugin()?.enable();
|
|
22712
|
+
if (nodesStageGridPluginPrev) this.getStageGridPlugin()?.enable();
|
|
22713
|
+
resolve(canvas);
|
|
22714
|
+
}
|
|
22715
|
+
});
|
|
22716
|
+
});
|
|
22717
|
+
}
|
|
22371
22718
|
async exportNodesServerSide(nodes, boundingNodes, options) {
|
|
22372
22719
|
const { format = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
|
|
22373
22720
|
this.getNodesSelectionPlugin()?.disable();
|
|
@@ -22583,6 +22930,14 @@ var WeaveExportManager = class {
|
|
|
22583
22930
|
const snappingPlugin = this.instance.getPlugin(WEAVE_NODES_DISTANCE_SNAPPING_PLUGIN_KEY);
|
|
22584
22931
|
return snappingPlugin;
|
|
22585
22932
|
}
|
|
22933
|
+
blobToDataURL(blob) {
|
|
22934
|
+
return new Promise((resolve, reject) => {
|
|
22935
|
+
const reader = new FileReader();
|
|
22936
|
+
reader.onloadend = () => resolve(reader.result);
|
|
22937
|
+
reader.onerror = () => reject(new Error("Failed to convert blob to data URL"));
|
|
22938
|
+
reader.readAsDataURL(blob);
|
|
22939
|
+
});
|
|
22940
|
+
}
|
|
22586
22941
|
};
|
|
22587
22942
|
|
|
22588
22943
|
//#endregion
|
|
@@ -22834,7 +23189,12 @@ var WeaveAsyncManager = class {
|
|
|
22834
23189
|
this.instance.emitEvent("onAsyncElementChange");
|
|
22835
23190
|
}, new Map());
|
|
22836
23191
|
}
|
|
23192
|
+
reset() {
|
|
23193
|
+
this.asyncElements.clear();
|
|
23194
|
+
this.asyncElementsLoadedEventEmitted = false;
|
|
23195
|
+
}
|
|
22837
23196
|
checkForAsyncElements(elements) {
|
|
23197
|
+
this.instance.emitEvent("onAsyncElementsIdle");
|
|
22838
23198
|
const amountAsyncResourcesExtracted = this.extractAsyncResources(elements);
|
|
22839
23199
|
if (amountAsyncResourcesExtracted === 0 && !this.asyncElementsLoadedEventEmitted) {
|
|
22840
23200
|
this.instance.emitEvent("onAsyncElementsLoaded");
|
|
@@ -22887,7 +23247,7 @@ var WeaveAsyncManager = class {
|
|
|
22887
23247
|
status: WEAVE_ASYNC_STATUS.LOADING
|
|
22888
23248
|
};
|
|
22889
23249
|
this.asyncElements.set(nodeId, element);
|
|
22890
|
-
this.instance.emitEvent("onAsyncElementsLoading", {
|
|
23250
|
+
if (!this.asyncElementsLoadedEventEmitted) this.instance.emitEvent("onAsyncElementsLoading", {
|
|
22891
23251
|
loaded: this.getAmountAsyncElementsLoaded(),
|
|
22892
23252
|
total: this.getAmountAsyncElements()
|
|
22893
23253
|
});
|
|
@@ -22900,11 +23260,11 @@ var WeaveAsyncManager = class {
|
|
|
22900
23260
|
status: WEAVE_ASYNC_STATUS.LOADED
|
|
22901
23261
|
};
|
|
22902
23262
|
this.asyncElements.set(nodeId, element);
|
|
22903
|
-
this.instance.emitEvent("onAsyncElementsLoading", {
|
|
22904
|
-
loaded: this.getAmountAsyncElementsLoaded(),
|
|
22905
|
-
total: this.getAmountAsyncElements()
|
|
22906
|
-
});
|
|
22907
23263
|
if (!this.asyncElementsLoadedEventEmitted) {
|
|
23264
|
+
this.instance.emitEvent("onAsyncElementsLoading", {
|
|
23265
|
+
loaded: this.getAmountAsyncElementsLoaded(),
|
|
23266
|
+
total: this.getAmountAsyncElements()
|
|
23267
|
+
});
|
|
22908
23268
|
const allLoaded = this.asyncElementsLoaded();
|
|
22909
23269
|
if (allLoaded) {
|
|
22910
23270
|
this.instance.emitEvent("onAsyncElementsLoaded");
|
|
@@ -23029,6 +23389,7 @@ var Weave = class {
|
|
|
23029
23389
|
constructor(weaveConfig, stageConfig) {
|
|
23030
23390
|
globalThis._weave_isServerSide = false;
|
|
23031
23391
|
if (typeof window === "undefined") globalThis._weave_isServerSide = true;
|
|
23392
|
+
this.eventsController = void 0;
|
|
23032
23393
|
this.emitter = new Emittery();
|
|
23033
23394
|
Konva.showWarnings = false;
|
|
23034
23395
|
this.id = v4_default();
|
|
@@ -23074,6 +23435,7 @@ var Weave = class {
|
|
|
23074
23435
|
this.initialized = true;
|
|
23075
23436
|
this.status = WEAVE_INSTANCE_STATUS.RUNNING;
|
|
23076
23437
|
this.emitEvent("onInstanceStatus", this.status);
|
|
23438
|
+
this.emitEvent("onRender");
|
|
23077
23439
|
});
|
|
23078
23440
|
}
|
|
23079
23441
|
setStatus(status) {
|
|
@@ -23098,6 +23460,7 @@ var Weave = class {
|
|
|
23098
23460
|
async start() {
|
|
23099
23461
|
this.moduleLogger.info("Start instance");
|
|
23100
23462
|
if (!this.isServerSide()) {
|
|
23463
|
+
this.eventsController = new AbortController();
|
|
23101
23464
|
if (!window.weave) window.weave = this;
|
|
23102
23465
|
}
|
|
23103
23466
|
this.emitEvent("onRoomLoaded", false);
|
|
@@ -23121,8 +23484,39 @@ var Weave = class {
|
|
|
23121
23484
|
store.setup();
|
|
23122
23485
|
store.connect();
|
|
23123
23486
|
}
|
|
23487
|
+
async switchRoom() {
|
|
23488
|
+
this.moduleLogger.info(`Switching room`);
|
|
23489
|
+
const nodeHandlers = this.registerManager.getNodesHandlers();
|
|
23490
|
+
for (const nodeHandlerKey of Object.keys(nodeHandlers)) {
|
|
23491
|
+
const nodeHandler = nodeHandlers[nodeHandlerKey];
|
|
23492
|
+
nodeHandler?.onDestroyInstance();
|
|
23493
|
+
}
|
|
23494
|
+
const stage = this.getStage();
|
|
23495
|
+
if (stage) stage.destroy();
|
|
23496
|
+
if (this.eventsController) this.eventsController.abort();
|
|
23497
|
+
if (!this.isServerSide()) this.eventsController = new AbortController();
|
|
23498
|
+
this.registerManager.reset();
|
|
23499
|
+
this.asyncManager.reset();
|
|
23500
|
+
this.moduleLogger.info("Switching room instance");
|
|
23501
|
+
if (!this.isServerSide()) {
|
|
23502
|
+
if (!window.weave) window.weave = this;
|
|
23503
|
+
}
|
|
23504
|
+
this.emitEvent("onRoomLoaded", false);
|
|
23505
|
+
this.status = WEAVE_INSTANCE_STATUS.STARTING;
|
|
23506
|
+
this.emitEvent("onInstanceStatus", this.status);
|
|
23507
|
+
this.registerManager.reset();
|
|
23508
|
+
this.status = WEAVE_INSTANCE_STATUS.LOADING_FONTS;
|
|
23509
|
+
this.emitEvent("onInstanceStatus", this.status);
|
|
23510
|
+
await this.fontsManager.loadFonts();
|
|
23511
|
+
this.setupManager.setupLog();
|
|
23512
|
+
this.stageManager.initStage();
|
|
23513
|
+
this.status = WEAVE_INSTANCE_STATUS.CONNECTING_TO_ROOM;
|
|
23514
|
+
this.emitEvent("onInstanceStatus", this.status);
|
|
23515
|
+
this.addEventListener("onStoreConnectionStatusChange", this.handleStoreConnectionStatusChange.bind(this));
|
|
23516
|
+
}
|
|
23124
23517
|
destroy() {
|
|
23125
23518
|
this.moduleLogger.info(`Destroying the instance`);
|
|
23519
|
+
if (this.eventsController) this.eventsController.abort();
|
|
23126
23520
|
this.emitter.clearListeners();
|
|
23127
23521
|
this.status = WEAVE_INSTANCE_STATUS.IDLE;
|
|
23128
23522
|
this.emitEvent("onInstanceStatus", this.status);
|
|
@@ -23595,11 +23989,27 @@ var Weave = class {
|
|
|
23595
23989
|
async exportAreaServerSide(area, options) {
|
|
23596
23990
|
return await this.exportManager.exportAreaServerSide(area, options);
|
|
23597
23991
|
}
|
|
23598
|
-
async exportNodes(nodes, boundingNodes, options) {
|
|
23599
|
-
|
|
23992
|
+
async exportNodes(nodes, boundingNodes, options, returnFormat = WEAVE_EXPORT_RETURN_FORMAT.IMAGE) {
|
|
23993
|
+
switch (returnFormat) {
|
|
23994
|
+
case WEAVE_EXPORT_RETURN_FORMAT.BLOB: return await this.exportManager.exportNodesAsBlob(nodes, boundingNodes, options);
|
|
23995
|
+
case WEAVE_EXPORT_RETURN_FORMAT.CANVAS: return await this.exportManager.exportNodesAsCanvas(nodes, boundingNodes, options);
|
|
23996
|
+
case WEAVE_EXPORT_RETURN_FORMAT.DATA_URL: {
|
|
23997
|
+
const blob = await this.exportManager.exportNodesAsBlob(nodes, boundingNodes, options);
|
|
23998
|
+
return await this.exportManager.blobToDataURL(blob);
|
|
23999
|
+
}
|
|
24000
|
+
case WEAVE_EXPORT_RETURN_FORMAT.IMAGE: return await this.exportManager.exportNodesAsImage(nodes, boundingNodes, options);
|
|
24001
|
+
}
|
|
23600
24002
|
}
|
|
23601
|
-
async exportArea(area, options) {
|
|
23602
|
-
|
|
24003
|
+
async exportArea(area, options, returnFormat = WEAVE_EXPORT_RETURN_FORMAT.IMAGE) {
|
|
24004
|
+
switch (returnFormat) {
|
|
24005
|
+
case WEAVE_EXPORT_RETURN_FORMAT.BLOB: return await this.exportManager.exportAreaAsBlob(area, options);
|
|
24006
|
+
case WEAVE_EXPORT_RETURN_FORMAT.CANVAS: return await this.exportManager.exportAreaAsCanvas(area, options);
|
|
24007
|
+
case WEAVE_EXPORT_RETURN_FORMAT.DATA_URL: {
|
|
24008
|
+
const blob = await this.exportManager.exportAreaAsBlob(area, options);
|
|
24009
|
+
return await this.exportManager.blobToDataURL(blob);
|
|
24010
|
+
}
|
|
24011
|
+
case WEAVE_EXPORT_RETURN_FORMAT.IMAGE: return await this.exportManager.exportAreaAsImage(area, options);
|
|
24012
|
+
}
|
|
23603
24013
|
}
|
|
23604
24014
|
getExportBoundingBox(nodesIds) {
|
|
23605
24015
|
const nodes = [];
|
|
@@ -23763,6 +24173,9 @@ var Weave = class {
|
|
|
23763
24173
|
getDragProperties() {
|
|
23764
24174
|
return this.dragAndDropManager.getDragProperties();
|
|
23765
24175
|
}
|
|
24176
|
+
getEventsController() {
|
|
24177
|
+
return this.eventsController;
|
|
24178
|
+
}
|
|
23766
24179
|
};
|
|
23767
24180
|
|
|
23768
24181
|
//#endregion
|
|
@@ -23854,6 +24267,7 @@ const downscaleImageFromURL = (url, options) => {
|
|
|
23854
24267
|
//#endregion
|
|
23855
24268
|
//#region src/internal-utils/upscale.ts
|
|
23856
24269
|
const setupUpscaleStage = (instance, stage) => {
|
|
24270
|
+
if (instance.isServerSide()) return;
|
|
23857
24271
|
const config = instance.getConfiguration();
|
|
23858
24272
|
const doUpscale = config.performance?.upscale?.enabled ?? false;
|
|
23859
24273
|
if (doUpscale) {
|
|
@@ -23885,7 +24299,14 @@ const setupUpscaleStage = (instance, stage) => {
|
|
|
23885
24299
|
innerElement.style.transformOrigin = "0 0";
|
|
23886
24300
|
innerElement.style.transform = `scale(${scaleToCover})`;
|
|
23887
24301
|
}
|
|
23888
|
-
} else
|
|
24302
|
+
} else {
|
|
24303
|
+
const realContainer = stage.container();
|
|
24304
|
+
const containerWidth = realContainer.offsetWidth;
|
|
24305
|
+
const containerHeight = realContainer.offsetHeight;
|
|
24306
|
+
stage.width(containerWidth);
|
|
24307
|
+
stage.height(containerHeight);
|
|
24308
|
+
stage.setAttrs({ upscaleScale: 1 });
|
|
24309
|
+
}
|
|
23889
24310
|
};
|
|
23890
24311
|
|
|
23891
24312
|
//#endregion
|
|
@@ -23896,6 +24317,7 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23896
24317
|
wheelMousePressed = false;
|
|
23897
24318
|
isCmdCtrlPressed = false;
|
|
23898
24319
|
globalEventsInitialized = false;
|
|
24320
|
+
initialize = void 0;
|
|
23899
24321
|
onRender(props) {
|
|
23900
24322
|
const stage = new Konva.Stage({
|
|
23901
24323
|
...props,
|
|
@@ -23914,10 +24336,10 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23914
24336
|
container.setAttribute("tabindex", "0");
|
|
23915
24337
|
stage.container().addEventListener("focus", () => {
|
|
23916
24338
|
this.stageFocused = true;
|
|
23917
|
-
});
|
|
24339
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
23918
24340
|
stage.container().addEventListener("blur", () => {
|
|
23919
24341
|
this.stageFocused = false;
|
|
23920
|
-
});
|
|
24342
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
23921
24343
|
}
|
|
23922
24344
|
Konva.Stage.prototype.mode = function(mode) {
|
|
23923
24345
|
if (typeof mode !== "undefined") this._mode = mode;
|
|
@@ -23977,6 +24399,9 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23977
24399
|
setupEvents() {
|
|
23978
24400
|
if (this.globalEventsInitialized) return;
|
|
23979
24401
|
if (this.instance.isServerSide()) return;
|
|
24402
|
+
window.addEventListener("blur", () => {
|
|
24403
|
+
this.isCmdCtrlPressed = false;
|
|
24404
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
23980
24405
|
window.addEventListener("keydown", (e) => {
|
|
23981
24406
|
if (this.isOnlyCtrlOrMeta(e)) {
|
|
23982
24407
|
this.isCmdCtrlPressed = true;
|
|
@@ -23987,7 +24412,7 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23987
24412
|
const selectedNode = transformer.nodes()[0];
|
|
23988
24413
|
selectedNode.fire("onCmdCtrlPressed");
|
|
23989
24414
|
}
|
|
23990
|
-
});
|
|
24415
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
23991
24416
|
window.addEventListener("keyup", (e) => {
|
|
23992
24417
|
if (!(e.ctrlKey || e.metaKey)) {
|
|
23993
24418
|
this.isCmdCtrlPressed = false;
|
|
@@ -23998,7 +24423,7 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23998
24423
|
const selectedNode = transformer.nodes()[0];
|
|
23999
24424
|
selectedNode.fire("onCmdCtrlReleased");
|
|
24000
24425
|
}
|
|
24001
|
-
});
|
|
24426
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24002
24427
|
this.globalEventsInitialized = true;
|
|
24003
24428
|
}
|
|
24004
24429
|
isOnlyCtrlOrMeta(event) {
|
|
@@ -24018,6 +24443,7 @@ const WEAVE_LAYER_NODE_TYPE = "layer";
|
|
|
24018
24443
|
//#region src/nodes/layer/layer.ts
|
|
24019
24444
|
var WeaveLayerNode = class extends WeaveNode {
|
|
24020
24445
|
nodeType = WEAVE_LAYER_NODE_TYPE;
|
|
24446
|
+
initialize = void 0;
|
|
24021
24447
|
onRender(props) {
|
|
24022
24448
|
const layer = new Konva.Layer({ ...props });
|
|
24023
24449
|
layer.canMoveToContainer = function() {
|
|
@@ -24065,6 +24491,7 @@ const WEAVE_GROUP_NODE_TYPE = "group";
|
|
|
24065
24491
|
//#region src/nodes/group/group.ts
|
|
24066
24492
|
var WeaveGroupNode = class extends WeaveNode {
|
|
24067
24493
|
nodeType = WEAVE_GROUP_NODE_TYPE;
|
|
24494
|
+
initialize = void 0;
|
|
24068
24495
|
constructor(params) {
|
|
24069
24496
|
super();
|
|
24070
24497
|
const { config } = params ?? {};
|
|
@@ -24157,6 +24584,7 @@ const WEAVE_RECTANGLE_NODE_TYPE = "rectangle";
|
|
|
24157
24584
|
//#region src/nodes/rectangle/rectangle.ts
|
|
24158
24585
|
var WeaveRectangleNode = class extends WeaveNode {
|
|
24159
24586
|
nodeType = WEAVE_RECTANGLE_NODE_TYPE;
|
|
24587
|
+
initialize = void 0;
|
|
24160
24588
|
constructor(params) {
|
|
24161
24589
|
super();
|
|
24162
24590
|
const { config } = params ?? {};
|
|
@@ -24200,6 +24628,7 @@ const WEAVE_ELLIPSE_NODE_TYPE = "ellipse";
|
|
|
24200
24628
|
//#region src/nodes/ellipse/ellipse.ts
|
|
24201
24629
|
var WeaveEllipseNode = class extends WeaveNode {
|
|
24202
24630
|
nodeType = WEAVE_ELLIPSE_NODE_TYPE;
|
|
24631
|
+
initialize = void 0;
|
|
24203
24632
|
constructor(params) {
|
|
24204
24633
|
super();
|
|
24205
24634
|
const { config } = params ?? {};
|
|
@@ -24345,13 +24774,16 @@ var WeaveLineNode = class extends WeaveNode {
|
|
|
24345
24774
|
constructor(params) {
|
|
24346
24775
|
super();
|
|
24347
24776
|
this.config = mergeExceptArrays(WEAVE_LINE_NODE_DEFAULT_CONFIG, params?.config ?? {});
|
|
24348
|
-
this.handleNodeChanges = null;
|
|
24349
|
-
this.handleZoomChanges = null;
|
|
24350
24777
|
this.snapper = new GreedySnapper({
|
|
24351
24778
|
snapAngles: this.config.snapAngles.angles,
|
|
24352
24779
|
activateThreshold: this.config.snapAngles.activateThreshold,
|
|
24353
24780
|
releaseThreshold: this.config.snapAngles.releaseThreshold
|
|
24354
24781
|
});
|
|
24782
|
+
this.initialize();
|
|
24783
|
+
}
|
|
24784
|
+
initialize() {
|
|
24785
|
+
this.handleNodeChanges = null;
|
|
24786
|
+
this.handleZoomChanges = null;
|
|
24355
24787
|
}
|
|
24356
24788
|
onRender(props) {
|
|
24357
24789
|
const line = new Konva.Line({
|
|
@@ -24656,28 +25088,33 @@ const TEXT_LAYOUT = {
|
|
|
24656
25088
|
//#region src/nodes/text/text.ts
|
|
24657
25089
|
var WeaveTextNode = class extends WeaveNode {
|
|
24658
25090
|
nodeType = WEAVE_TEXT_NODE_TYPE;
|
|
24659
|
-
editing = false;
|
|
24660
|
-
textAreaSuperContainer = null;
|
|
24661
|
-
textAreaContainer = null;
|
|
24662
|
-
textArea = null;
|
|
24663
|
-
eventsInitialized = false;
|
|
24664
|
-
isCtrlMetaPressed = false;
|
|
24665
25091
|
constructor(params) {
|
|
24666
25092
|
super();
|
|
24667
25093
|
const { config } = params ?? {};
|
|
24668
25094
|
this.config = (0, import_lodash.merge)({}, WEAVE_TEXT_NODE_DEFAULT_CONFIG, config);
|
|
25095
|
+
this.initialize();
|
|
25096
|
+
}
|
|
25097
|
+
initialize() {
|
|
24669
25098
|
this.keyPressHandler = void 0;
|
|
25099
|
+
this.eventsInitialized = false;
|
|
25100
|
+
this.isCtrlMetaPressed = false;
|
|
25101
|
+
this.textAreaSuperContainer = null;
|
|
25102
|
+
this.textAreaContainer = null;
|
|
25103
|
+
this.textArea = null;
|
|
24670
25104
|
this.editing = false;
|
|
24671
25105
|
this.textArea = null;
|
|
24672
25106
|
}
|
|
24673
25107
|
initEvents() {
|
|
24674
25108
|
if (!this.eventsInitialized && !globalThis._weave_isServerSide) {
|
|
25109
|
+
window.addEventListener("blur", () => {
|
|
25110
|
+
this.isCtrlMetaPressed = false;
|
|
25111
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24675
25112
|
window.addEventListener("keydown", (e) => {
|
|
24676
25113
|
if (e.ctrlKey || e.metaKey) this.isCtrlMetaPressed = true;
|
|
24677
|
-
});
|
|
25114
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24678
25115
|
window.addEventListener("keyup", (e) => {
|
|
24679
25116
|
if (!(e.ctrlKey || e.metaKey)) this.isCtrlMetaPressed = false;
|
|
24680
|
-
});
|
|
25117
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
24681
25118
|
this.eventsInitialized = true;
|
|
24682
25119
|
}
|
|
24683
25120
|
}
|
|
@@ -24705,7 +25142,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24705
25142
|
onAdd() {
|
|
24706
25143
|
if (!this.instance.isServerSide() && !this.keyPressHandler) {
|
|
24707
25144
|
this.keyPressHandler = this.handleKeyPress.bind(this);
|
|
24708
|
-
window.addEventListener("keypress", this.keyPressHandler);
|
|
25145
|
+
window.addEventListener("keypress", this.keyPressHandler, { signal: this.instance.getEventsController()?.signal });
|
|
24709
25146
|
}
|
|
24710
25147
|
}
|
|
24711
25148
|
onRender(props) {
|
|
@@ -24859,7 +25296,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24859
25296
|
});
|
|
24860
25297
|
if (!this.instance.isServerSide() && !this.keyPressHandler) {
|
|
24861
25298
|
this.keyPressHandler = this.handleKeyPress.bind(this);
|
|
24862
|
-
window.addEventListener("keypress", this.keyPressHandler);
|
|
25299
|
+
window.addEventListener("keypress", this.keyPressHandler, { signal: this.instance.getEventsController()?.signal });
|
|
24863
25300
|
}
|
|
24864
25301
|
return text;
|
|
24865
25302
|
}
|
|
@@ -25118,17 +25555,17 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
25118
25555
|
this.textAreaSuperContainer.scrollTop = 0;
|
|
25119
25556
|
this.textAreaSuperContainer.scrollLeft = 0;
|
|
25120
25557
|
}
|
|
25121
|
-
});
|
|
25558
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
25122
25559
|
this.textAreaContainer.addEventListener("scroll", () => {
|
|
25123
25560
|
if (!this.textAreaContainer) return;
|
|
25124
25561
|
this.textAreaContainer.scrollTop = 0;
|
|
25125
25562
|
this.textAreaContainer.scrollLeft = 0;
|
|
25126
|
-
});
|
|
25563
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
25127
25564
|
this.textArea.addEventListener("scroll", () => {
|
|
25128
25565
|
if (!this.textArea) return;
|
|
25129
25566
|
this.textArea.scrollTop = 0;
|
|
25130
25567
|
this.textArea.scrollLeft = 0;
|
|
25131
|
-
});
|
|
25568
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
25132
25569
|
const rotation = textNode.getAbsoluteRotation();
|
|
25133
25570
|
if (rotation) {
|
|
25134
25571
|
const transform = "rotate(" + rotation + "deg)";
|
|
@@ -25177,8 +25614,8 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
25177
25614
|
this.textAreaDomResize(textNode);
|
|
25178
25615
|
}
|
|
25179
25616
|
};
|
|
25180
|
-
this.textArea.addEventListener("keydown", handleKeyDown);
|
|
25181
|
-
this.textArea.addEventListener("keyup", handleKeyUp);
|
|
25617
|
+
this.textArea.addEventListener("keydown", handleKeyDown, { signal: this.instance.getEventsController()?.signal });
|
|
25618
|
+
this.textArea.addEventListener("keyup", handleKeyUp, { signal: this.instance.getEventsController()?.signal });
|
|
25182
25619
|
this.textArea.tabIndex = 1;
|
|
25183
25620
|
this.textArea.focus();
|
|
25184
25621
|
const handleOutsideClick = (e) => {
|
|
@@ -25204,7 +25641,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
25204
25641
|
}
|
|
25205
25642
|
};
|
|
25206
25643
|
setTimeout(() => {
|
|
25207
|
-
window.addEventListener("pointerup", handleOutsideClick);
|
|
25644
|
+
window.addEventListener("pointerup", handleOutsideClick, { signal: this.instance.getEventsController()?.signal });
|
|
25208
25645
|
}, 0);
|
|
25209
25646
|
this.instance.getStage().mode(WEAVE_STAGE_TEXT_EDITION_MODE);
|
|
25210
25647
|
this.editing = true;
|
|
@@ -25540,7 +25977,7 @@ var WeaveImageCrop = class WeaveImageCrop {
|
|
|
25540
25977
|
utilityLayer?.add(this.transformer);
|
|
25541
25978
|
this.transformer?.forceUpdate();
|
|
25542
25979
|
this.cropGroup.show();
|
|
25543
|
-
window.addEventListener("keydown", this.handleHide);
|
|
25980
|
+
window.addEventListener("keydown", this.handleHide, { signal: this.instance.getEventsController()?.signal });
|
|
25544
25981
|
if (options.cmdCtrl.triggered) {
|
|
25545
25982
|
utilityLayer?.hide();
|
|
25546
25983
|
const stage = this.instance.getStage();
|
|
@@ -25990,24 +26427,21 @@ const isAllowedUrl = (value) => {
|
|
|
25990
26427
|
//#endregion
|
|
25991
26428
|
//#region src/nodes/image/image.ts
|
|
25992
26429
|
var WeaveImageNode = class extends WeaveNode {
|
|
25993
|
-
imageBitmapCache = {};
|
|
25994
|
-
imageSource = {};
|
|
25995
|
-
imageFallback = {};
|
|
25996
|
-
imageState = {};
|
|
25997
|
-
imageTryoutAttempts = {};
|
|
25998
|
-
imageTryoutIds = {};
|
|
25999
26430
|
nodeType = WEAVE_IMAGE_NODE_TYPE;
|
|
26000
26431
|
cursorsFallback = { loading: "wait" };
|
|
26001
26432
|
cursors = {};
|
|
26002
26433
|
constructor(params) {
|
|
26003
26434
|
super();
|
|
26004
26435
|
const { config } = params ?? {};
|
|
26436
|
+
this.config = mergeExceptArrays(WEAVE_IMAGE_DEFAULT_CONFIG, config);
|
|
26437
|
+
this.initialize();
|
|
26438
|
+
}
|
|
26439
|
+
initialize() {
|
|
26005
26440
|
this.tapStart = {
|
|
26006
26441
|
x: 0,
|
|
26007
26442
|
y: 0,
|
|
26008
26443
|
time: 0
|
|
26009
26444
|
};
|
|
26010
|
-
this.config = mergeExceptArrays(WEAVE_IMAGE_DEFAULT_CONFIG, config);
|
|
26011
26445
|
this.imageCrop = null;
|
|
26012
26446
|
this.imageBitmapCache = {};
|
|
26013
26447
|
this.imageSource = {};
|
|
@@ -26231,7 +26665,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26231
26665
|
};
|
|
26232
26666
|
this.updateImageCrop(image);
|
|
26233
26667
|
} else {
|
|
26234
|
-
this.updatePlaceholderSize(image
|
|
26668
|
+
this.updatePlaceholderSize(image);
|
|
26235
26669
|
this.loadImage(imageProps, image, true);
|
|
26236
26670
|
}
|
|
26237
26671
|
if (this.config.performance.cache.enabled) image.on("transformend", () => {
|
|
@@ -26614,7 +27048,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26614
27048
|
}
|
|
26615
27049
|
this.loadAsyncElement(id);
|
|
26616
27050
|
preloadFunction(id, realImageURL ?? "", {
|
|
26617
|
-
onLoad: () => {
|
|
27051
|
+
onLoad: async () => {
|
|
26618
27052
|
if (useFallback) this.imageTryoutIds[id] = setTimeout(() => {
|
|
26619
27053
|
const node = this.instance.getStage().findOne(`#${id}`);
|
|
26620
27054
|
if (node) {
|
|
@@ -26665,7 +27099,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26665
27099
|
error: false
|
|
26666
27100
|
};
|
|
26667
27101
|
this.updateImageCrop(image);
|
|
26668
|
-
this.resolveAsyncElement(id);
|
|
27102
|
+
if (!useFallback) this.resolveAsyncElement(id);
|
|
26669
27103
|
this.cacheNode(image);
|
|
26670
27104
|
}
|
|
26671
27105
|
},
|
|
@@ -26706,13 +27140,9 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26706
27140
|
}
|
|
26707
27141
|
}, loadTryout);
|
|
26708
27142
|
}
|
|
26709
|
-
updatePlaceholderSize(image
|
|
27143
|
+
updatePlaceholderSize(image) {
|
|
26710
27144
|
const imageAttrs = image.getAttrs();
|
|
26711
27145
|
if (!this.imageState[imageAttrs.id ?? ""]?.loaded) return;
|
|
26712
|
-
if (!imageAttrs.adding && !imageAttrs.cropInfo) {
|
|
26713
|
-
imagePlaceholder.width(imageAttrs.uncroppedImage.width);
|
|
26714
|
-
imagePlaceholder.height(imageAttrs.uncroppedImage.height);
|
|
26715
|
-
}
|
|
26716
27146
|
}
|
|
26717
27147
|
updateImageCrop(image) {
|
|
26718
27148
|
const imageAttrs = image.getAttrs();
|
|
@@ -26846,6 +27276,7 @@ const WEAVE_STAR_NODE_TYPE = "star";
|
|
|
26846
27276
|
//#region src/nodes/star/star.ts
|
|
26847
27277
|
var WeaveStarNode = class extends WeaveNode {
|
|
26848
27278
|
nodeType = WEAVE_STAR_NODE_TYPE;
|
|
27279
|
+
initialize = void 0;
|
|
26849
27280
|
constructor(params) {
|
|
26850
27281
|
super();
|
|
26851
27282
|
const { config } = params ?? {};
|
|
@@ -26931,6 +27362,7 @@ const WEAVE_ARROW_NODE_TYPE = "arrow";
|
|
|
26931
27362
|
//#region src/nodes/arrow/arrow.ts
|
|
26932
27363
|
var WeaveArrowNode = class extends WeaveNode {
|
|
26933
27364
|
nodeType = WEAVE_ARROW_NODE_TYPE;
|
|
27365
|
+
initialize = void 0;
|
|
26934
27366
|
constructor(params) {
|
|
26935
27367
|
super();
|
|
26936
27368
|
const { config } = params ?? {};
|
|
@@ -26987,6 +27419,7 @@ const WEAVE_REGULAR_POLYGON_NODE_TYPE = "regular-polygon";
|
|
|
26987
27419
|
//#region src/nodes/regular-polygon/regular-polygon.ts
|
|
26988
27420
|
var WeaveRegularPolygonNode = class extends WeaveNode {
|
|
26989
27421
|
nodeType = WEAVE_REGULAR_POLYGON_NODE_TYPE;
|
|
27422
|
+
initialize = void 0;
|
|
26990
27423
|
constructor(params) {
|
|
26991
27424
|
super();
|
|
26992
27425
|
const { config } = params ?? {};
|
|
@@ -27100,6 +27533,7 @@ var GroupFrame = class extends Konva.Group {
|
|
|
27100
27533
|
//#region src/nodes/frame/frame.ts
|
|
27101
27534
|
var WeaveFrameNode = class extends WeaveNode {
|
|
27102
27535
|
nodeType = WEAVE_FRAME_NODE_TYPE;
|
|
27536
|
+
initialize = void 0;
|
|
27103
27537
|
constructor(params) {
|
|
27104
27538
|
super();
|
|
27105
27539
|
const { config } = params ?? {};
|
|
@@ -27208,15 +27642,16 @@ var WeaveFrameNode = class extends WeaveNode {
|
|
|
27208
27642
|
width: props.frameWidth - borderWidth * 2,
|
|
27209
27643
|
height: props.frameHeight - borderWidth * 2,
|
|
27210
27644
|
strokeScaleEnabled: true,
|
|
27211
|
-
clipFunc: (ctx) => {
|
|
27212
|
-
const width = (frameInternal.width() + borderWidth) * frameInternal.scaleX();
|
|
27213
|
-
const height = (frameInternal.height() + borderWidth) * frameInternal.scaleY();
|
|
27214
|
-
ctx.rect(-(borderWidth / 2) * frameInternal.scaleX(), -(borderWidth / 2) * frameInternal.scaleY(), width, height);
|
|
27215
|
-
},
|
|
27216
27645
|
listening: true,
|
|
27217
27646
|
draggable: false,
|
|
27218
27647
|
isTargetable: false
|
|
27219
27648
|
});
|
|
27649
|
+
frameInternal.clip({
|
|
27650
|
+
x: -(borderWidth / 2) * frameInternal.scaleX(),
|
|
27651
|
+
y: -(borderWidth / 2) * frameInternal.scaleX(),
|
|
27652
|
+
width: (frameInternal.width() + borderWidth) * frameInternal.scaleX(),
|
|
27653
|
+
height: (frameInternal.height() + borderWidth) * frameInternal.scaleY()
|
|
27654
|
+
});
|
|
27220
27655
|
frame.add(frameInternal);
|
|
27221
27656
|
const selectionArea = new Konva.Rect({
|
|
27222
27657
|
...frameParams,
|
|
@@ -27316,6 +27751,12 @@ var WeaveFrameNode = class extends WeaveNode {
|
|
|
27316
27751
|
frame.getNodeAnchors = function() {
|
|
27317
27752
|
return [];
|
|
27318
27753
|
};
|
|
27754
|
+
frame.clip({
|
|
27755
|
+
x: 0,
|
|
27756
|
+
y: text.y(),
|
|
27757
|
+
width: frame.width(),
|
|
27758
|
+
height: frame.height() + text.height()
|
|
27759
|
+
});
|
|
27319
27760
|
return frame;
|
|
27320
27761
|
}
|
|
27321
27762
|
onUpdate(nodeInstance, nextProps) {
|
|
@@ -27400,6 +27841,7 @@ const WEAVE_STROKE_NODE_DEFAULT_CONFIG = {
|
|
|
27400
27841
|
//#region src/nodes/stroke/stroke.ts
|
|
27401
27842
|
var WeaveStrokeNode = class extends WeaveNode {
|
|
27402
27843
|
nodeType = WEAVE_STROKE_NODE_TYPE;
|
|
27844
|
+
initialize = void 0;
|
|
27403
27845
|
constructor(params) {
|
|
27404
27846
|
super();
|
|
27405
27847
|
const { config } = params ?? {};
|
|
@@ -27976,8 +28418,6 @@ var WeaveSquareLineTipManager = class extends WeaveBaseLineTipManager {
|
|
|
27976
28418
|
//#endregion
|
|
27977
28419
|
//#region src/nodes/stroke-single/stroke-single.ts
|
|
27978
28420
|
var WeaveStrokeSingleNode = class extends WeaveNode {
|
|
27979
|
-
startHandle = null;
|
|
27980
|
-
endHandle = null;
|
|
27981
28421
|
nodeType = WEAVE_STROKE_SINGLE_NODE_TYPE;
|
|
27982
28422
|
tipManagers = {
|
|
27983
28423
|
[WEAVE_STROKE_SINGLE_NODE_TIP_TYPE.ARROW]: new WeaveArrowLineTipManager(),
|
|
@@ -27988,24 +28428,29 @@ var WeaveStrokeSingleNode = class extends WeaveNode {
|
|
|
27988
28428
|
constructor(params) {
|
|
27989
28429
|
super();
|
|
27990
28430
|
this.config = mergeExceptArrays(WEAVE_STROKE_SINGLE_NODE_DEFAULT_CONFIG, params?.config ?? {});
|
|
27991
|
-
this.handleNodeChanges = null;
|
|
27992
|
-
this.handleZoomChanges = null;
|
|
27993
|
-
this.shiftPressed = false;
|
|
27994
28431
|
this.snapper = new GreedySnapper({
|
|
27995
28432
|
snapAngles: this.config.snapAngles.angles,
|
|
27996
28433
|
activateThreshold: this.config.snapAngles.activateThreshold,
|
|
27997
28434
|
releaseThreshold: this.config.snapAngles.releaseThreshold
|
|
27998
28435
|
});
|
|
28436
|
+
this.initialize();
|
|
28437
|
+
}
|
|
28438
|
+
initialize() {
|
|
27999
28439
|
this.eventsInitialized = false;
|
|
28440
|
+
this.startHandle = null;
|
|
28441
|
+
this.endHandle = null;
|
|
28442
|
+
this.handleNodeChanges = null;
|
|
28443
|
+
this.handleZoomChanges = null;
|
|
28444
|
+
this.shiftPressed = false;
|
|
28000
28445
|
}
|
|
28001
28446
|
initEvents() {
|
|
28002
28447
|
if (this.eventsInitialized) return;
|
|
28003
28448
|
window.addEventListener("keydown", (e) => {
|
|
28004
28449
|
if (e.key === "Shift") this.shiftPressed = true;
|
|
28005
|
-
});
|
|
28450
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
28006
28451
|
window.addEventListener("keyup", (e) => {
|
|
28007
28452
|
if (e.key === "Shift") this.shiftPressed = false;
|
|
28008
|
-
});
|
|
28453
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
28009
28454
|
this.eventsInitialized = true;
|
|
28010
28455
|
}
|
|
28011
28456
|
onRender(props) {
|
|
@@ -28492,6 +28937,9 @@ var WeaveCommentNode = class extends WeaveNode {
|
|
|
28492
28937
|
constructor(params) {
|
|
28493
28938
|
super();
|
|
28494
28939
|
this.config = mergeExceptArrays(WEAVE_COMMENT_NODE_DEFAULTS, params.config);
|
|
28940
|
+
this.initialize();
|
|
28941
|
+
}
|
|
28942
|
+
initialize() {
|
|
28495
28943
|
this.commentDomVisibleId = null;
|
|
28496
28944
|
this.commentDomVisible = false;
|
|
28497
28945
|
this.commentDomAction = null;
|
|
@@ -29120,10 +29568,6 @@ const WEAVE_VIDEO_DEFAULT_CONFIG = {
|
|
|
29120
29568
|
//#endregion
|
|
29121
29569
|
//#region src/nodes/video/video.ts
|
|
29122
29570
|
var WeaveVideoNode = class extends WeaveNode {
|
|
29123
|
-
videoState = {};
|
|
29124
|
-
videoSourceFrameId = {};
|
|
29125
|
-
videoSource = {};
|
|
29126
|
-
videoPlaceholder = {};
|
|
29127
29571
|
nodeType = WEAVE_VIDEO_NODE_TYPE;
|
|
29128
29572
|
constructor(params) {
|
|
29129
29573
|
super();
|
|
@@ -29136,6 +29580,13 @@ var WeaveVideoNode = class extends WeaveNode {
|
|
|
29136
29580
|
this.videoIconImage.src = this.config.style.icon.dataURL;
|
|
29137
29581
|
}
|
|
29138
29582
|
}
|
|
29583
|
+
initialize() {
|
|
29584
|
+
this.videoState = {};
|
|
29585
|
+
this.videoSource = {};
|
|
29586
|
+
this.videoSourceFrameId = {};
|
|
29587
|
+
this.videoPlaceholder = {};
|
|
29588
|
+
this.videoIconImage = void 0;
|
|
29589
|
+
}
|
|
29139
29590
|
async loadPlaceholder(params, video) {
|
|
29140
29591
|
const videoProps = params;
|
|
29141
29592
|
const { id } = videoProps;
|
|
@@ -29630,6 +30081,7 @@ const WEAVE_MEASURE_NODE_DEFAULT_CONFIG = { style: {
|
|
|
29630
30081
|
var WeaveMeasureNode = class extends WeaveNode {
|
|
29631
30082
|
nodeType = WEAVE_MEASURE_NODE_TYPE;
|
|
29632
30083
|
handlePointCircleRadius = 6;
|
|
30084
|
+
initialize = void 0;
|
|
29633
30085
|
constructor(params) {
|
|
29634
30086
|
super();
|
|
29635
30087
|
this.config = mergeExceptArrays(WEAVE_MEASURE_NODE_DEFAULT_CONFIG, params?.config ?? {});
|
|
@@ -30920,6 +31372,7 @@ var WeaveConnectorNode = class extends WeaveNode {
|
|
|
30920
31372
|
[WEAVE_CONNECTOR_NODE_DECORATOR_TYPE.DOT]: setupNodeDecoratorDot,
|
|
30921
31373
|
[WEAVE_CONNECTOR_NODE_DECORATOR_TYPE.ARROW]: setupNodeDecoratorArrow
|
|
30922
31374
|
};
|
|
31375
|
+
initialize = void 0;
|
|
30923
31376
|
constructor(params) {
|
|
30924
31377
|
super();
|
|
30925
31378
|
this.config = mergeExceptArrays(WEAVE_CONNECTOR_NODE_DEFAULT_CONFIG, params?.config);
|
|
@@ -31670,10 +32123,6 @@ const WEAVE_STAGE_ZOOM_DEFAULT_CONFIG = {
|
|
|
31670
32123
|
var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
31671
32124
|
getLayerName = void 0;
|
|
31672
32125
|
initLayer = void 0;
|
|
31673
|
-
pinching = false;
|
|
31674
|
-
zooming = false;
|
|
31675
|
-
isTrackpad = false;
|
|
31676
|
-
zoomVelocity = 0;
|
|
31677
32126
|
zoomInertiaType = WEAVE_STAGE_ZOOM_TYPE.MOUSE_WHEEL;
|
|
31678
32127
|
defaultStep = 3;
|
|
31679
32128
|
constructor(params) {
|
|
@@ -31681,8 +32130,13 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31681
32130
|
const { config } = params ?? {};
|
|
31682
32131
|
this.config = mergeExceptArrays(WEAVE_STAGE_ZOOM_DEFAULT_CONFIG, config);
|
|
31683
32132
|
if (!this.config.zoomSteps.includes(this.config.defaultZoom)) throw new Error(`Default zoom ${this.config.defaultZoom} is not in zoom steps`);
|
|
32133
|
+
this.initialize();
|
|
32134
|
+
}
|
|
32135
|
+
initialize() {
|
|
31684
32136
|
this.pinching = false;
|
|
32137
|
+
this.zooming = false;
|
|
31685
32138
|
this.isTrackpad = false;
|
|
32139
|
+
this.zoomVelocity = 0;
|
|
31686
32140
|
this.isCtrlOrMetaPressed = false;
|
|
31687
32141
|
this.updatedMinimumZoom = false;
|
|
31688
32142
|
this.actualStep = this.config.zoomSteps.findIndex((step) => step === this.config.defaultZoom);
|
|
@@ -31969,6 +32423,15 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31969
32423
|
if (box.width === 0 || box.height === 0) return;
|
|
31970
32424
|
this.fitToElements(box, finalOptions);
|
|
31971
32425
|
}
|
|
32426
|
+
fitToArea(area, options) {
|
|
32427
|
+
const finalOptions = mergeExceptArrays({
|
|
32428
|
+
smartZoom: false,
|
|
32429
|
+
overrideZoom: true
|
|
32430
|
+
}, options);
|
|
32431
|
+
if (!this.enabled) return;
|
|
32432
|
+
if (area.width === 0 || area.height === 0) return;
|
|
32433
|
+
this.fitToElements(area, finalOptions);
|
|
32434
|
+
}
|
|
31972
32435
|
enable() {
|
|
31973
32436
|
this.enabled = true;
|
|
31974
32437
|
}
|
|
@@ -31985,12 +32448,15 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
31985
32448
|
};
|
|
31986
32449
|
}
|
|
31987
32450
|
initEvents() {
|
|
32451
|
+
window.addEventListener("blur", () => {
|
|
32452
|
+
this.isCtrlOrMetaPressed = false;
|
|
32453
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
31988
32454
|
window.addEventListener("keydown", (e) => {
|
|
31989
32455
|
if (e.ctrlKey || e.metaKey) this.isCtrlOrMetaPressed = true;
|
|
31990
|
-
});
|
|
32456
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
31991
32457
|
window.addEventListener("keyup", (e) => {
|
|
31992
32458
|
if (!(e.ctrlKey || e.metaKey)) this.isCtrlOrMetaPressed = false;
|
|
31993
|
-
});
|
|
32459
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
31994
32460
|
const stage = this.instance.getStage();
|
|
31995
32461
|
let lastCenter = null;
|
|
31996
32462
|
let lastDist = 0;
|
|
@@ -32015,7 +32481,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
32015
32481
|
return;
|
|
32016
32482
|
}
|
|
32017
32483
|
}
|
|
32018
|
-
}, {
|
|
32484
|
+
}, {
|
|
32485
|
+
passive: false,
|
|
32486
|
+
signal: this.instance.getEventsController()?.signal
|
|
32487
|
+
});
|
|
32019
32488
|
stage.getContent().addEventListener("touchmove", (e) => {
|
|
32020
32489
|
e.preventDefault();
|
|
32021
32490
|
if (e.touches.length === 2) {
|
|
@@ -32055,12 +32524,18 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
32055
32524
|
lastDist = dist;
|
|
32056
32525
|
lastCenter = newCenter;
|
|
32057
32526
|
}
|
|
32058
|
-
}, {
|
|
32527
|
+
}, {
|
|
32528
|
+
passive: false,
|
|
32529
|
+
signal: this.instance.getEventsController()?.signal
|
|
32530
|
+
});
|
|
32059
32531
|
stage.getContent().addEventListener("touchend", () => {
|
|
32060
32532
|
this.pinching = false;
|
|
32061
32533
|
lastDist = 0;
|
|
32062
32534
|
lastCenter = null;
|
|
32063
|
-
}, {
|
|
32535
|
+
}, {
|
|
32536
|
+
passive: false,
|
|
32537
|
+
signal: this.instance.getEventsController()?.signal
|
|
32538
|
+
});
|
|
32064
32539
|
let doZoom = false;
|
|
32065
32540
|
const handleWheelImmediate = (e) => {
|
|
32066
32541
|
const performZoom = this.isCtrlOrMetaPressed || !this.isCtrlOrMetaPressed && e.ctrlKey && e.deltaMode === 0;
|
|
@@ -32078,7 +32553,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
32078
32553
|
e.preventDefault();
|
|
32079
32554
|
doZoom = true;
|
|
32080
32555
|
};
|
|
32081
|
-
window.addEventListener("wheel", handleWheelImmediate, {
|
|
32556
|
+
window.addEventListener("wheel", handleWheelImmediate, {
|
|
32557
|
+
signal: this.instance.getEventsController()?.signal,
|
|
32558
|
+
passive: false
|
|
32559
|
+
});
|
|
32082
32560
|
const handleWheel = (e) => {
|
|
32083
32561
|
if (!doZoom) return;
|
|
32084
32562
|
const delta = e.deltaY > 0 ? 1 : -1;
|
|
@@ -32091,7 +32569,10 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
32091
32569
|
}
|
|
32092
32570
|
};
|
|
32093
32571
|
const throttledHandleWheel = (0, import_lodash.throttle)(handleWheel, DEFAULT_THROTTLE_MS);
|
|
32094
|
-
window.addEventListener("wheel", throttledHandleWheel, {
|
|
32572
|
+
window.addEventListener("wheel", throttledHandleWheel, {
|
|
32573
|
+
signal: this.instance.getEventsController()?.signal,
|
|
32574
|
+
passive: true
|
|
32575
|
+
});
|
|
32095
32576
|
}
|
|
32096
32577
|
getInertiaScale() {
|
|
32097
32578
|
const stage = this.instance.getStage();
|
|
@@ -32149,6 +32630,7 @@ const ZOOM_OUT_TOOL_ACTION_NAME = "zoomOutTool";
|
|
|
32149
32630
|
//#region src/actions/zoom-out-tool/zoom-out-tool.ts
|
|
32150
32631
|
var WeaveZoomOutToolAction = class extends WeaveAction {
|
|
32151
32632
|
onPropsChange = void 0;
|
|
32633
|
+
initialize = void 0;
|
|
32152
32634
|
getName() {
|
|
32153
32635
|
return ZOOM_OUT_TOOL_ACTION_NAME;
|
|
32154
32636
|
}
|
|
@@ -32183,6 +32665,10 @@ const ZOOM_IN_TOOL_ACTION_NAME = "zoomInTool";
|
|
|
32183
32665
|
//#region src/actions/zoom-in-tool/zoom-in-tool.ts
|
|
32184
32666
|
var WeaveZoomInToolAction = class extends WeaveAction {
|
|
32185
32667
|
onPropsChange = void 0;
|
|
32668
|
+
initialize = void 0;
|
|
32669
|
+
constructor() {
|
|
32670
|
+
super();
|
|
32671
|
+
}
|
|
32186
32672
|
getName() {
|
|
32187
32673
|
return ZOOM_IN_TOOL_ACTION_NAME;
|
|
32188
32674
|
}
|
|
@@ -32217,6 +32703,10 @@ const FIT_TO_SCREEN_TOOL_ACTION_NAME = "fitToScreenTool";
|
|
|
32217
32703
|
//#region src/actions/fit-to-screen-tool/fit-to-screen-tool.ts
|
|
32218
32704
|
var WeaveFitToScreenToolAction = class extends WeaveAction {
|
|
32219
32705
|
onPropsChange = void 0;
|
|
32706
|
+
initialize = void 0;
|
|
32707
|
+
constructor() {
|
|
32708
|
+
super();
|
|
32709
|
+
}
|
|
32220
32710
|
getName() {
|
|
32221
32711
|
return FIT_TO_SCREEN_TOOL_ACTION_NAME;
|
|
32222
32712
|
}
|
|
@@ -32250,6 +32740,10 @@ const FIT_TO_SELECTION_TOOL_ACTION_NAME = "fitToSelectionTool";
|
|
|
32250
32740
|
//#region src/actions/fit-to-selection-tool/fit-to-selection-tool.ts
|
|
32251
32741
|
var WeaveFitToSelectionToolAction = class extends WeaveAction {
|
|
32252
32742
|
onPropsChange = void 0;
|
|
32743
|
+
initialize = void 0;
|
|
32744
|
+
constructor() {
|
|
32745
|
+
super();
|
|
32746
|
+
}
|
|
32253
32747
|
getName() {
|
|
32254
32748
|
return FIT_TO_SELECTION_TOOL_ACTION_NAME;
|
|
32255
32749
|
}
|
|
@@ -32292,6 +32786,9 @@ var WeaveMoveToolAction = class extends WeaveAction {
|
|
|
32292
32786
|
onInit = void 0;
|
|
32293
32787
|
constructor() {
|
|
32294
32788
|
super();
|
|
32789
|
+
this.initialize();
|
|
32790
|
+
}
|
|
32791
|
+
initialize() {
|
|
32295
32792
|
this.initialized = false;
|
|
32296
32793
|
this.state = MOVE_TOOL_STATE.IDLE;
|
|
32297
32794
|
}
|
|
@@ -32305,7 +32802,7 @@ var WeaveMoveToolAction = class extends WeaveAction {
|
|
|
32305
32802
|
this.cancelAction();
|
|
32306
32803
|
return;
|
|
32307
32804
|
}
|
|
32308
|
-
});
|
|
32805
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32309
32806
|
stage.on("pointerdown", () => {
|
|
32310
32807
|
if ([MOVE_TOOL_ACTION_NAME].includes(this.instance.getActiveAction() ?? "")) stage.container().style.cursor = "grabbing";
|
|
32311
32808
|
});
|
|
@@ -32364,6 +32861,9 @@ var WeaveSelectionToolAction = class extends WeaveAction {
|
|
|
32364
32861
|
onInit = void 0;
|
|
32365
32862
|
constructor() {
|
|
32366
32863
|
super();
|
|
32864
|
+
this.initialize();
|
|
32865
|
+
}
|
|
32866
|
+
initialize() {
|
|
32367
32867
|
this.initialized = false;
|
|
32368
32868
|
this.state = SELECTION_TOOL_STATE.IDLE;
|
|
32369
32869
|
}
|
|
@@ -32427,6 +32927,9 @@ var WeaveEraserToolAction = class extends WeaveAction {
|
|
|
32427
32927
|
onInit = void 0;
|
|
32428
32928
|
constructor() {
|
|
32429
32929
|
super();
|
|
32930
|
+
this.initialize();
|
|
32931
|
+
}
|
|
32932
|
+
initialize() {
|
|
32430
32933
|
this.initialized = false;
|
|
32431
32934
|
this.erasing = false;
|
|
32432
32935
|
this.state = ERASER_TOOL_STATE.IDLE;
|
|
@@ -32460,7 +32963,7 @@ var WeaveEraserToolAction = class extends WeaveAction {
|
|
|
32460
32963
|
this.cancelAction();
|
|
32461
32964
|
return;
|
|
32462
32965
|
}
|
|
32463
|
-
});
|
|
32966
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32464
32967
|
this.initialized = true;
|
|
32465
32968
|
}
|
|
32466
32969
|
setState(state) {
|
|
@@ -32527,6 +33030,9 @@ var WeaveRectangleToolAction = class extends WeaveAction {
|
|
|
32527
33030
|
onInit = void 0;
|
|
32528
33031
|
constructor() {
|
|
32529
33032
|
super();
|
|
33033
|
+
this.initialize();
|
|
33034
|
+
}
|
|
33035
|
+
initialize() {
|
|
32530
33036
|
this.pointers = new Map();
|
|
32531
33037
|
this.initialized = false;
|
|
32532
33038
|
this.state = RECTANGLE_TOOL_STATE.IDLE;
|
|
@@ -32562,7 +33068,7 @@ var WeaveRectangleToolAction = class extends WeaveAction {
|
|
|
32562
33068
|
this.cancelAction();
|
|
32563
33069
|
return;
|
|
32564
33070
|
}
|
|
32565
|
-
});
|
|
33071
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32566
33072
|
stage.on("pointermove", () => {
|
|
32567
33073
|
if (this.state === RECTANGLE_TOOL_STATE.IDLE) return;
|
|
32568
33074
|
this.setCursor();
|
|
@@ -32736,6 +33242,9 @@ var WeaveEllipseToolAction = class extends WeaveAction {
|
|
|
32736
33242
|
onInit = void 0;
|
|
32737
33243
|
constructor() {
|
|
32738
33244
|
super();
|
|
33245
|
+
this.initialize();
|
|
33246
|
+
}
|
|
33247
|
+
initialize() {
|
|
32739
33248
|
this.pointers = new Map();
|
|
32740
33249
|
this.initialized = false;
|
|
32741
33250
|
this.state = ELLIPSE_TOOL_STATE.IDLE;
|
|
@@ -32771,7 +33280,7 @@ var WeaveEllipseToolAction = class extends WeaveAction {
|
|
|
32771
33280
|
this.cancelAction();
|
|
32772
33281
|
return;
|
|
32773
33282
|
}
|
|
32774
|
-
});
|
|
33283
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32775
33284
|
stage.on("pointerdown", (e) => {
|
|
32776
33285
|
this.setTapStart(e);
|
|
32777
33286
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -32952,6 +33461,9 @@ var WeavePenToolAction = class extends WeaveAction {
|
|
|
32952
33461
|
onInit = void 0;
|
|
32953
33462
|
constructor() {
|
|
32954
33463
|
super();
|
|
33464
|
+
this.initialize();
|
|
33465
|
+
}
|
|
33466
|
+
initialize() {
|
|
32955
33467
|
this.pointers = new Map();
|
|
32956
33468
|
this.initialized = false;
|
|
32957
33469
|
this.state = PEN_TOOL_STATE.IDLE;
|
|
@@ -32987,7 +33499,7 @@ var WeavePenToolAction = class extends WeaveAction {
|
|
|
32987
33499
|
this.cancelAction();
|
|
32988
33500
|
return;
|
|
32989
33501
|
}
|
|
32990
|
-
});
|
|
33502
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
32991
33503
|
stage.on("pointerdown", (e) => {
|
|
32992
33504
|
this.setTapStart(e);
|
|
32993
33505
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -33224,6 +33736,9 @@ var WeaveLineToolAction = class extends WeaveAction {
|
|
|
33224
33736
|
constructor(params) {
|
|
33225
33737
|
super();
|
|
33226
33738
|
this.config = mergeExceptArrays(LINE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
|
|
33739
|
+
this.initialize();
|
|
33740
|
+
}
|
|
33741
|
+
initialize() {
|
|
33227
33742
|
this.pointers = new Map();
|
|
33228
33743
|
this.initialized = false;
|
|
33229
33744
|
this.state = LINE_TOOL_STATE.IDLE;
|
|
@@ -33268,13 +33783,13 @@ var WeaveLineToolAction = class extends WeaveAction {
|
|
|
33268
33783
|
this.snappedAngle = null;
|
|
33269
33784
|
this.shiftPressed = true;
|
|
33270
33785
|
}
|
|
33271
|
-
});
|
|
33786
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33272
33787
|
window.addEventListener("keyup", (e) => {
|
|
33273
33788
|
if (e.key === "Shift" && this.instance.getActiveAction() === LINE_TOOL_ACTION_NAME) {
|
|
33274
33789
|
this.snappedAngle = null;
|
|
33275
33790
|
this.shiftPressed = false;
|
|
33276
33791
|
}
|
|
33277
|
-
});
|
|
33792
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33278
33793
|
stage.on("pointerdown", (e) => {
|
|
33279
33794
|
this.setTapStart(e);
|
|
33280
33795
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -33489,6 +34004,9 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
33489
34004
|
constructor(params) {
|
|
33490
34005
|
super();
|
|
33491
34006
|
this.config = mergeExceptArrays(BRUSH_TOOL_DEFAULT_CONFIG, params?.config ?? {});
|
|
34007
|
+
this.initialize();
|
|
34008
|
+
}
|
|
34009
|
+
initialize() {
|
|
33492
34010
|
this.initialized = false;
|
|
33493
34011
|
this.state = BRUSH_TOOL_STATE.INACTIVE;
|
|
33494
34012
|
this.strokeId = null;
|
|
@@ -33517,7 +34035,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
33517
34035
|
const stage = this.instance.getStage();
|
|
33518
34036
|
window.addEventListener("keyup", (e) => {
|
|
33519
34037
|
if (e.code === "Space" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) this.isSpacePressed = false;
|
|
33520
|
-
});
|
|
34038
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33521
34039
|
window.addEventListener("keydown", (e) => {
|
|
33522
34040
|
if (e.code === "Enter" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) {
|
|
33523
34041
|
e.stopPropagation();
|
|
@@ -33533,7 +34051,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
33533
34051
|
e.stopPropagation();
|
|
33534
34052
|
this.cancelAction();
|
|
33535
34053
|
}
|
|
33536
|
-
});
|
|
34054
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33537
34055
|
const handlePointerDown = (e) => {
|
|
33538
34056
|
if (this.state === BRUSH_TOOL_STATE.INACTIVE) return;
|
|
33539
34057
|
if (this.state !== BRUSH_TOOL_STATE.IDLE) return;
|
|
@@ -33742,6 +34260,9 @@ var WeaveTextToolAction = class extends WeaveAction {
|
|
|
33742
34260
|
onInit = void 0;
|
|
33743
34261
|
constructor() {
|
|
33744
34262
|
super();
|
|
34263
|
+
this.initialize();
|
|
34264
|
+
}
|
|
34265
|
+
initialize() {
|
|
33745
34266
|
this.initialized = false;
|
|
33746
34267
|
this.state = TEXT_TOOL_STATE.IDLE;
|
|
33747
34268
|
this.textId = null;
|
|
@@ -33771,7 +34292,7 @@ var WeaveTextToolAction = class extends WeaveAction {
|
|
|
33771
34292
|
this.cancelAction();
|
|
33772
34293
|
return;
|
|
33773
34294
|
}
|
|
33774
|
-
});
|
|
34295
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33775
34296
|
stage.on("pointermove", () => {
|
|
33776
34297
|
if (this.state === TEXT_TOOL_STATE.IDLE) return;
|
|
33777
34298
|
this.setCursor();
|
|
@@ -33899,6 +34420,9 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
33899
34420
|
constructor(params) {
|
|
33900
34421
|
super();
|
|
33901
34422
|
this.config = mergeExceptArrays(WEAVE_IMAGE_TOOL_CONFIG_DEFAULT, params?.config ?? {});
|
|
34423
|
+
this.initialize();
|
|
34424
|
+
}
|
|
34425
|
+
initialize() {
|
|
33902
34426
|
this.pointers = new Map();
|
|
33903
34427
|
this.initialized = false;
|
|
33904
34428
|
this.imageId = null;
|
|
@@ -33942,7 +34466,7 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
33942
34466
|
this.cancelAction();
|
|
33943
34467
|
return;
|
|
33944
34468
|
}
|
|
33945
|
-
});
|
|
34469
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
33946
34470
|
stage.on("pointerdown", (e) => {
|
|
33947
34471
|
this.setTapStart(e);
|
|
33948
34472
|
if (this.ignorePointerEvents) return;
|
|
@@ -34339,6 +34863,9 @@ var WeaveImagesToolAction = class extends WeaveAction {
|
|
|
34339
34863
|
constructor(params) {
|
|
34340
34864
|
super();
|
|
34341
34865
|
this.config = mergeExceptArrays(WEAVE_IMAGES_TOOL_DEFAULT_CONFIG, params ?? {});
|
|
34866
|
+
this.initialize();
|
|
34867
|
+
}
|
|
34868
|
+
initialize() {
|
|
34342
34869
|
this.pointers = new Map();
|
|
34343
34870
|
this.initialized = false;
|
|
34344
34871
|
this.tempPointerFeedbackNode = null;
|
|
@@ -34385,7 +34912,7 @@ var WeaveImagesToolAction = class extends WeaveAction {
|
|
|
34385
34912
|
const stage = this.instance.getStage();
|
|
34386
34913
|
stage.container().addEventListener("keydown", (e) => {
|
|
34387
34914
|
if (e.key === "Escape" && this.instance.getActiveAction() === WEAVE_IMAGES_TOOL_ACTION_NAME) this.cancelAction();
|
|
34388
|
-
});
|
|
34915
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
34389
34916
|
stage.on("pointerdown", (e) => {
|
|
34390
34917
|
this.setTapStart(e);
|
|
34391
34918
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -34767,6 +35294,9 @@ var WeaveStarToolAction = class extends WeaveAction {
|
|
|
34767
35294
|
onInit = void 0;
|
|
34768
35295
|
constructor() {
|
|
34769
35296
|
super();
|
|
35297
|
+
this.initialize();
|
|
35298
|
+
}
|
|
35299
|
+
initialize() {
|
|
34770
35300
|
this.pointers = new Map();
|
|
34771
35301
|
this.initialized = false;
|
|
34772
35302
|
this.state = STAR_TOOL_STATE.IDLE;
|
|
@@ -34803,7 +35333,7 @@ var WeaveStarToolAction = class extends WeaveAction {
|
|
|
34803
35333
|
this.cancelAction();
|
|
34804
35334
|
return;
|
|
34805
35335
|
}
|
|
34806
|
-
});
|
|
35336
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
34807
35337
|
stage.on("pointerdown", (e) => {
|
|
34808
35338
|
this.setTapStart(e);
|
|
34809
35339
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -34968,8 +35498,8 @@ var WeaveStarToolAction = class extends WeaveAction {
|
|
|
34968
35498
|
|
|
34969
35499
|
//#endregion
|
|
34970
35500
|
//#region src/actions/arrow-tool/constants.ts
|
|
34971
|
-
const
|
|
34972
|
-
const
|
|
35501
|
+
const WEAVE_ARROW_TOOL_ACTION_NAME = "arrowTool";
|
|
35502
|
+
const WEAVE_ARROW_TOOL_STATE = {
|
|
34973
35503
|
["IDLE"]: "idle",
|
|
34974
35504
|
["ADDING"]: "adding",
|
|
34975
35505
|
["DEFINING_SIZE"]: "definingSize",
|
|
@@ -34985,9 +35515,12 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34985
35515
|
onInit = void 0;
|
|
34986
35516
|
constructor() {
|
|
34987
35517
|
super();
|
|
35518
|
+
this.initialize();
|
|
35519
|
+
}
|
|
35520
|
+
initialize() {
|
|
34988
35521
|
this.pointers = new Map();
|
|
34989
35522
|
this.initialized = false;
|
|
34990
|
-
this.state =
|
|
35523
|
+
this.state = WEAVE_ARROW_TOOL_STATE.IDLE;
|
|
34991
35524
|
this.arrowId = null;
|
|
34992
35525
|
this.tempArrowId = null;
|
|
34993
35526
|
this.tempMainArrowNode = null;
|
|
@@ -35000,7 +35533,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
35000
35533
|
this.props = this.initProps();
|
|
35001
35534
|
}
|
|
35002
35535
|
getName() {
|
|
35003
|
-
return
|
|
35536
|
+
return WEAVE_ARROW_TOOL_ACTION_NAME;
|
|
35004
35537
|
}
|
|
35005
35538
|
initProps() {
|
|
35006
35539
|
return {
|
|
@@ -35017,40 +35550,37 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
35017
35550
|
setupEvents() {
|
|
35018
35551
|
const stage = this.instance.getStage();
|
|
35019
35552
|
window.addEventListener("keydown", (e) => {
|
|
35020
|
-
if (e.code === "Enter" && this.instance.getActiveAction() ===
|
|
35553
|
+
if (e.code === "Enter" && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
|
|
35021
35554
|
this.cancelAction();
|
|
35022
35555
|
return;
|
|
35023
35556
|
}
|
|
35024
|
-
if (e.code === "Escape" && this.instance.getActiveAction() ===
|
|
35025
|
-
|
|
35026
|
-
return;
|
|
35027
|
-
}
|
|
35028
|
-
});
|
|
35557
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) this.cancelAction();
|
|
35558
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35029
35559
|
stage.on("pointerdown", (e) => {
|
|
35030
35560
|
this.setTapStart(e);
|
|
35031
35561
|
this.pointers.set(e.evt.pointerId, {
|
|
35032
35562
|
x: e.evt.clientX,
|
|
35033
35563
|
y: e.evt.clientY
|
|
35034
35564
|
});
|
|
35035
|
-
if (this.pointers.size === 2 && this.instance.getActiveAction() ===
|
|
35036
|
-
this.state =
|
|
35565
|
+
if (this.pointers.size === 2 && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
|
|
35566
|
+
this.state = WEAVE_ARROW_TOOL_STATE.ADDING;
|
|
35037
35567
|
return;
|
|
35038
35568
|
}
|
|
35039
|
-
if (!this.tempMainArrowNode && this.state ===
|
|
35040
|
-
if (this.tempMainArrowNode && this.state ===
|
|
35569
|
+
if (!this.tempMainArrowNode && this.state === WEAVE_ARROW_TOOL_STATE.ADDING) this.handleAdding();
|
|
35570
|
+
if (this.tempMainArrowNode && this.state === WEAVE_ARROW_TOOL_STATE.ADDING) this.state = WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE;
|
|
35041
35571
|
});
|
|
35042
35572
|
stage.on("pointermove", () => {
|
|
35043
|
-
if (this.state ===
|
|
35573
|
+
if (this.state === WEAVE_ARROW_TOOL_STATE.IDLE) return;
|
|
35044
35574
|
this.setCursor();
|
|
35045
|
-
if (this.pointers.size === 2 && this.instance.getActiveAction() ===
|
|
35046
|
-
this.state =
|
|
35575
|
+
if (this.pointers.size === 2 && this.instance.getActiveAction() === WEAVE_ARROW_TOOL_ACTION_NAME) {
|
|
35576
|
+
this.state = WEAVE_ARROW_TOOL_STATE.ADDING;
|
|
35047
35577
|
return;
|
|
35048
35578
|
}
|
|
35049
|
-
if (this.state ===
|
|
35579
|
+
if (this.state === WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) this.handleMovement();
|
|
35050
35580
|
});
|
|
35051
35581
|
stage.on("pointerup", (e) => {
|
|
35052
35582
|
this.pointers.delete(e.evt.pointerId);
|
|
35053
|
-
if (this.state ===
|
|
35583
|
+
if (this.state === WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) this.handleSettingSize();
|
|
35054
35584
|
});
|
|
35055
35585
|
this.initialized = true;
|
|
35056
35586
|
}
|
|
@@ -35064,7 +35594,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
35064
35594
|
this.tempPoint = void 0;
|
|
35065
35595
|
this.tempNextPoint = void 0;
|
|
35066
35596
|
this.clickPoint = null;
|
|
35067
|
-
this.setState(
|
|
35597
|
+
this.setState(WEAVE_ARROW_TOOL_STATE.ADDING);
|
|
35068
35598
|
}
|
|
35069
35599
|
handleAdding() {
|
|
35070
35600
|
const stage = this.instance.getStage();
|
|
@@ -35115,7 +35645,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
35115
35645
|
this.measureContainer?.add(this.tempNextPoint);
|
|
35116
35646
|
this.tempPoint.moveToTop();
|
|
35117
35647
|
this.tempNextPoint.moveToTop();
|
|
35118
|
-
this.setState(
|
|
35648
|
+
this.setState(WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE);
|
|
35119
35649
|
}
|
|
35120
35650
|
}
|
|
35121
35651
|
handleSettingSize() {
|
|
@@ -35142,11 +35672,11 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
35142
35672
|
y: mousePoint.y,
|
|
35143
35673
|
points: [0, 0]
|
|
35144
35674
|
});
|
|
35145
|
-
this.setState(
|
|
35675
|
+
this.setState(WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE);
|
|
35146
35676
|
}
|
|
35147
35677
|
}
|
|
35148
35678
|
handleMovement() {
|
|
35149
|
-
if (this.state !==
|
|
35679
|
+
if (this.state !== WEAVE_ARROW_TOOL_STATE.DEFINING_SIZE) return;
|
|
35150
35680
|
if (this.arrowId && this.tempArrowNode && this.measureContainer && this.tempNextPoint) {
|
|
35151
35681
|
const { mousePoint } = this.instance.getMousePointerRelativeToContainer(this.measureContainer);
|
|
35152
35682
|
this.tempArrowNode.setAttrs({
|
|
@@ -35213,7 +35743,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
35213
35743
|
this.container = void 0;
|
|
35214
35744
|
this.measureContainer = void 0;
|
|
35215
35745
|
this.clickPoint = null;
|
|
35216
|
-
this.setState(
|
|
35746
|
+
this.setState(WEAVE_ARROW_TOOL_STATE.IDLE);
|
|
35217
35747
|
}
|
|
35218
35748
|
setCursor() {
|
|
35219
35749
|
const stage = this.instance.getStage();
|
|
@@ -35257,13 +35787,15 @@ const WEAVE_STROKE_TOOL_DEFAULT_CONFIG = { snapAngles: {
|
|
|
35257
35787
|
var WeaveStrokeToolAction = class extends WeaveAction {
|
|
35258
35788
|
initialized = false;
|
|
35259
35789
|
initialCursor = null;
|
|
35260
|
-
snappedAngle = null;
|
|
35261
35790
|
shiftPressed = false;
|
|
35262
35791
|
onPropsChange = void 0;
|
|
35263
35792
|
onInit = void 0;
|
|
35264
35793
|
constructor(params) {
|
|
35265
35794
|
super();
|
|
35266
35795
|
this.config = mergeExceptArrays(WEAVE_STROKE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
|
|
35796
|
+
this.initialize();
|
|
35797
|
+
}
|
|
35798
|
+
initialize() {
|
|
35267
35799
|
this.pointers = new Map();
|
|
35268
35800
|
this.initialized = false;
|
|
35269
35801
|
this.state = WEAVE_STROKE_TOOL_STATE.IDLE;
|
|
@@ -35272,7 +35804,6 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35272
35804
|
this.tempLineId = null;
|
|
35273
35805
|
this.tempLineNode = null;
|
|
35274
35806
|
this.container = void 0;
|
|
35275
|
-
this.snappedAngle = null;
|
|
35276
35807
|
this.measureContainer = void 0;
|
|
35277
35808
|
this.clickPoint = null;
|
|
35278
35809
|
this.snapper = new GreedySnapper({
|
|
@@ -35285,6 +35816,9 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35285
35816
|
getName() {
|
|
35286
35817
|
return WEAVE_STROKE_TOOL_ACTION_NAME;
|
|
35287
35818
|
}
|
|
35819
|
+
getNames() {
|
|
35820
|
+
return [WEAVE_STROKE_TOOL_ACTION_NAME, ...WEAVE_STROKE_TOOL_ACTION_NAME_ALIASES];
|
|
35821
|
+
}
|
|
35288
35822
|
hasAliases() {
|
|
35289
35823
|
return true;
|
|
35290
35824
|
}
|
|
@@ -35303,32 +35837,26 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35303
35837
|
setupEvents() {
|
|
35304
35838
|
const stage = this.instance.getStage();
|
|
35305
35839
|
window.addEventListener("keydown", (e) => {
|
|
35306
|
-
if (e.code === "Enter" && this.instance.getActiveAction()
|
|
35840
|
+
if (e.code === "Enter" && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
|
|
35307
35841
|
this.cancelAction();
|
|
35308
35842
|
return;
|
|
35309
35843
|
}
|
|
35310
|
-
if (e.code === "Escape" && this.instance.getActiveAction()
|
|
35844
|
+
if (e.code === "Escape" && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
|
|
35311
35845
|
this.cancelAction();
|
|
35312
35846
|
return;
|
|
35313
35847
|
}
|
|
35314
|
-
if (e.key === "Shift" && this.instance.getActiveAction()
|
|
35315
|
-
|
|
35316
|
-
this.shiftPressed = true;
|
|
35317
|
-
}
|
|
35318
|
-
});
|
|
35848
|
+
if (e.key === "Shift" && this.getNames().includes(this.instance.getActiveAction() ?? "")) this.shiftPressed = true;
|
|
35849
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35319
35850
|
window.addEventListener("keyup", (e) => {
|
|
35320
|
-
if (e.key === "Shift" && this.instance.getActiveAction()
|
|
35321
|
-
|
|
35322
|
-
this.shiftPressed = false;
|
|
35323
|
-
}
|
|
35324
|
-
});
|
|
35851
|
+
if (e.key === "Shift" && this.getNames().includes(this.instance.getActiveAction() ?? "")) this.shiftPressed = false;
|
|
35852
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35325
35853
|
stage.on("pointerdown", (e) => {
|
|
35326
35854
|
this.setTapStart(e);
|
|
35327
35855
|
this.pointers.set(e.evt.pointerId, {
|
|
35328
35856
|
x: e.evt.clientX,
|
|
35329
35857
|
y: e.evt.clientY
|
|
35330
35858
|
});
|
|
35331
|
-
if (this.pointers.size === 2 && this.instance.getActiveAction()
|
|
35859
|
+
if (this.pointers.size === 2 && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
|
|
35332
35860
|
this.state = WEAVE_STROKE_TOOL_STATE.ADDING;
|
|
35333
35861
|
return;
|
|
35334
35862
|
}
|
|
@@ -35338,7 +35866,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35338
35866
|
stage.on("pointermove", () => {
|
|
35339
35867
|
if (this.state === WEAVE_STROKE_TOOL_STATE.IDLE) return;
|
|
35340
35868
|
this.setCursor();
|
|
35341
|
-
if (this.pointers.size === 2 && this.instance.getActiveAction()
|
|
35869
|
+
if (this.pointers.size === 2 && this.getNames().includes(this.instance.getActiveAction() ?? "")) {
|
|
35342
35870
|
this.state = WEAVE_STROKE_TOOL_STATE.ADDING;
|
|
35343
35871
|
return;
|
|
35344
35872
|
}
|
|
@@ -35356,7 +35884,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35356
35884
|
addLine() {
|
|
35357
35885
|
this.setCursor();
|
|
35358
35886
|
this.setFocusStage();
|
|
35359
|
-
this.instance.emitEvent("onAddingStroke", { actionName: this.instance.getActiveAction() ??
|
|
35887
|
+
this.instance.emitEvent("onAddingStroke", { actionName: this.instance.getActiveAction() ?? "not-defined" });
|
|
35360
35888
|
this.shiftPressed = false;
|
|
35361
35889
|
this.clickPoint = null;
|
|
35362
35890
|
this.setState(WEAVE_STROKE_TOOL_STATE.ADDING);
|
|
@@ -35464,7 +35992,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
35464
35992
|
});
|
|
35465
35993
|
delete finalLine.props.dragBoundFunc;
|
|
35466
35994
|
this.instance.addNode(finalLine, this.container?.getAttrs().id);
|
|
35467
|
-
this.instance.emitEvent("onAddedStroke", { actionName: this.instance.getActiveAction() ??
|
|
35995
|
+
this.instance.emitEvent("onAddedStroke", { actionName: this.instance.getActiveAction() ?? "not-defined" });
|
|
35468
35996
|
nodeCreated = true;
|
|
35469
35997
|
}
|
|
35470
35998
|
}
|
|
@@ -35514,6 +36042,9 @@ var WeaveRegularPolygonToolAction = class extends WeaveAction {
|
|
|
35514
36042
|
onInit = void 0;
|
|
35515
36043
|
constructor() {
|
|
35516
36044
|
super();
|
|
36045
|
+
this.initialize();
|
|
36046
|
+
}
|
|
36047
|
+
initialize() {
|
|
35517
36048
|
this.pointers = new Map();
|
|
35518
36049
|
this.initialized = false;
|
|
35519
36050
|
this.state = REGULAR_POLYGON_TOOL_STATE.IDLE;
|
|
@@ -35548,7 +36079,7 @@ var WeaveRegularPolygonToolAction = class extends WeaveAction {
|
|
|
35548
36079
|
this.cancelAction();
|
|
35549
36080
|
return;
|
|
35550
36081
|
}
|
|
35551
|
-
});
|
|
36082
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35552
36083
|
stage.on("pointerdown", (e) => {
|
|
35553
36084
|
this.setTapStart(e);
|
|
35554
36085
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -35722,6 +36253,9 @@ var WeaveFrameToolAction = class extends WeaveAction {
|
|
|
35722
36253
|
onInit = void 0;
|
|
35723
36254
|
constructor() {
|
|
35724
36255
|
super();
|
|
36256
|
+
this.initialize();
|
|
36257
|
+
}
|
|
36258
|
+
initialize() {
|
|
35725
36259
|
this.initialized = false;
|
|
35726
36260
|
this.state = FRAME_TOOL_STATE.IDLE;
|
|
35727
36261
|
this.frameId = null;
|
|
@@ -35749,7 +36283,7 @@ var WeaveFrameToolAction = class extends WeaveAction {
|
|
|
35749
36283
|
this.cancelAction();
|
|
35750
36284
|
return;
|
|
35751
36285
|
}
|
|
35752
|
-
});
|
|
36286
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
35753
36287
|
stage.on("pointermove", () => {
|
|
35754
36288
|
if (this.state === FRAME_TOOL_STATE.IDLE) return;
|
|
35755
36289
|
this.setCursor();
|
|
@@ -35851,12 +36385,16 @@ var WeaveExportStageToolAction = class extends WeaveAction {
|
|
|
35851
36385
|
};
|
|
35852
36386
|
onPropsChange = void 0;
|
|
35853
36387
|
onInit = void 0;
|
|
36388
|
+
initialize = void 0;
|
|
36389
|
+
constructor() {
|
|
36390
|
+
super();
|
|
36391
|
+
}
|
|
35854
36392
|
getName() {
|
|
35855
36393
|
return EXPORT_STAGE_TOOL_ACTION_NAME;
|
|
35856
36394
|
}
|
|
35857
36395
|
async exportStage(boundingNodes) {
|
|
35858
36396
|
const mainLayer = this.instance.getMainLayer();
|
|
35859
|
-
const img = await this.instance.exportNodes(mainLayer?.getChildren() ?? [], boundingNodes, this.options);
|
|
36397
|
+
const img = await this.instance.exportNodes(mainLayer?.getChildren() ?? [], boundingNodes, this.options, WEAVE_EXPORT_RETURN_FORMAT.IMAGE);
|
|
35860
36398
|
return img;
|
|
35861
36399
|
}
|
|
35862
36400
|
async trigger(cancelAction, { boundingNodes, options }) {
|
|
@@ -35898,11 +36436,15 @@ var WeaveExportNodesToolAction = class extends WeaveAction {
|
|
|
35898
36436
|
};
|
|
35899
36437
|
onPropsChange = void 0;
|
|
35900
36438
|
onInit = void 0;
|
|
36439
|
+
initialize = void 0;
|
|
36440
|
+
constructor() {
|
|
36441
|
+
super();
|
|
36442
|
+
}
|
|
35901
36443
|
getName() {
|
|
35902
36444
|
return EXPORT_NODES_TOOL_ACTION_NAME;
|
|
35903
36445
|
}
|
|
35904
36446
|
async exportNodes(nodes, boundingNodes) {
|
|
35905
|
-
const img = await this.instance.exportNodes(nodes, boundingNodes ?? ((nodes$1) => nodes$1), this.options);
|
|
36447
|
+
const img = await this.instance.exportNodes(nodes, boundingNodes ?? ((nodes$1) => nodes$1), this.options, WEAVE_EXPORT_RETURN_FORMAT.IMAGE);
|
|
35906
36448
|
return img;
|
|
35907
36449
|
}
|
|
35908
36450
|
async trigger(cancelAction, { nodes, boundingNodes, options, triggerSelectionTool = true }) {
|
|
@@ -35950,6 +36492,9 @@ var WeaveAlignNodesToolAction = class extends WeaveAction {
|
|
|
35950
36492
|
onInit = void 0;
|
|
35951
36493
|
constructor() {
|
|
35952
36494
|
super();
|
|
36495
|
+
this.initialize();
|
|
36496
|
+
}
|
|
36497
|
+
initialize() {
|
|
35953
36498
|
this.initialized = false;
|
|
35954
36499
|
this.state = ALIGN_NODES_TOOL_STATE.IDLE;
|
|
35955
36500
|
}
|
|
@@ -36199,6 +36744,9 @@ var WeaveCommentToolAction = class extends WeaveAction {
|
|
|
36199
36744
|
super();
|
|
36200
36745
|
const { config } = params ?? {};
|
|
36201
36746
|
this.config = mergeExceptArrays(WEAVE_COMMENT_TOOL_DEFAULT_CONFIG, config);
|
|
36747
|
+
this.initialize();
|
|
36748
|
+
}
|
|
36749
|
+
initialize() {
|
|
36202
36750
|
this.pointers = new Map();
|
|
36203
36751
|
this.initialized = false;
|
|
36204
36752
|
this.state = WEAVE_COMMENT_TOOL_STATE.IDLE;
|
|
@@ -36276,7 +36824,7 @@ var WeaveCommentToolAction = class extends WeaveAction {
|
|
|
36276
36824
|
return;
|
|
36277
36825
|
}
|
|
36278
36826
|
if (e.code === "Escape" && this.state === WEAVE_COMMENT_TOOL_STATE.CREATING_COMMENT) this.setState(WEAVE_COMMENT_TOOL_STATE.ADDING);
|
|
36279
|
-
});
|
|
36827
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
36280
36828
|
stage.on("pointermove", (e) => {
|
|
36281
36829
|
if (this.state === WEAVE_COMMENT_TOOL_STATE.IDLE) return;
|
|
36282
36830
|
if (commentNodeHandler?.isCommentViewing()) {
|
|
@@ -36427,6 +36975,9 @@ var WeaveVideoToolAction = class extends WeaveAction {
|
|
|
36427
36975
|
update = void 0;
|
|
36428
36976
|
constructor() {
|
|
36429
36977
|
super();
|
|
36978
|
+
this.initialize();
|
|
36979
|
+
}
|
|
36980
|
+
initialize() {
|
|
36430
36981
|
this.pointers = new Map();
|
|
36431
36982
|
this.initialized = false;
|
|
36432
36983
|
this.state = VIDEO_TOOL_STATE.IDLE;
|
|
@@ -36473,7 +37024,7 @@ var WeaveVideoToolAction = class extends WeaveAction {
|
|
|
36473
37024
|
this.cancelAction();
|
|
36474
37025
|
return;
|
|
36475
37026
|
}
|
|
36476
|
-
});
|
|
37027
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
36477
37028
|
stage.on("pointerdown", (e) => {
|
|
36478
37029
|
this.setTapStart(e);
|
|
36479
37030
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -36606,6 +37157,9 @@ var WeaveMeasureToolAction = class extends WeaveAction {
|
|
|
36606
37157
|
constructor(params) {
|
|
36607
37158
|
super();
|
|
36608
37159
|
this.config = mergeExceptArrays(WEAVE_MEASURE_TOOL_DEFAULT_CONFIG, params?.config ?? {});
|
|
37160
|
+
this.initialize();
|
|
37161
|
+
}
|
|
37162
|
+
initialize() {
|
|
36609
37163
|
this.initialized = false;
|
|
36610
37164
|
this.state = MEASURE_TOOL_STATE.IDLE;
|
|
36611
37165
|
this.measureId = null;
|
|
@@ -36632,7 +37186,7 @@ var WeaveMeasureToolAction = class extends WeaveAction {
|
|
|
36632
37186
|
const stage = this.instance.getStage();
|
|
36633
37187
|
window.addEventListener("keydown", (e) => {
|
|
36634
37188
|
if (e.code === "Escape" && this.instance.getActiveAction() === MEASURE_TOOL_ACTION_NAME) this.cancelAction();
|
|
36635
|
-
});
|
|
37189
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
36636
37190
|
stage.on("pointermove", () => {
|
|
36637
37191
|
if (this.state === MEASURE_TOOL_STATE.IDLE) return;
|
|
36638
37192
|
if (this.state === MEASURE_TOOL_STATE.SET_TO) {
|
|
@@ -36902,6 +37456,9 @@ var WeaveConnectorToolAction = class extends WeaveAction {
|
|
|
36902
37456
|
constructor(params) {
|
|
36903
37457
|
super();
|
|
36904
37458
|
this.config = mergeExceptArrays(CONNECTOR_TOOL_DEFAULT_CONFIG, params?.config);
|
|
37459
|
+
this.initialize();
|
|
37460
|
+
}
|
|
37461
|
+
initialize() {
|
|
36905
37462
|
this.pointers = new Map();
|
|
36906
37463
|
this.initialized = false;
|
|
36907
37464
|
this.tempLineNode = null;
|
|
@@ -36940,7 +37497,7 @@ var WeaveConnectorToolAction = class extends WeaveAction {
|
|
|
36940
37497
|
return;
|
|
36941
37498
|
}
|
|
36942
37499
|
if (e.code === "Escape" && this.instance.getActiveAction() === CONNECTOR_TOOL_ACTION_NAME) this.cancelAction();
|
|
36943
|
-
});
|
|
37500
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
36944
37501
|
let nodeHovered = void 0;
|
|
36945
37502
|
stage.on("pointermove", () => {
|
|
36946
37503
|
if (!(this.state === CONNECTOR_TOOL_STATE.SELECTING_INITIAL || this.state === CONNECTOR_TOOL_STATE.SELECTING_FINAL)) return;
|
|
@@ -37255,10 +37812,6 @@ var WeaveConnectorToolAction = class extends WeaveAction {
|
|
|
37255
37812
|
//#endregion
|
|
37256
37813
|
//#region src/plugins/stage-grid/stage-grid.ts
|
|
37257
37814
|
var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
37258
|
-
actStageZoomX = 1;
|
|
37259
|
-
actStageZoomY = 1;
|
|
37260
|
-
actStagePosX = 0;
|
|
37261
|
-
actStagePosY = 0;
|
|
37262
37815
|
constructor(params) {
|
|
37263
37816
|
super();
|
|
37264
37817
|
const { config } = params ?? {};
|
|
@@ -37274,6 +37827,10 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37274
37827
|
this.isMouseMiddleButtonPressed = false;
|
|
37275
37828
|
this.isSpaceKeyPressed = false;
|
|
37276
37829
|
this.forceStageChange = false;
|
|
37830
|
+
this.actStagePosX = 0;
|
|
37831
|
+
this.actStagePosY = 0;
|
|
37832
|
+
this.actStageZoomX = 1;
|
|
37833
|
+
this.actStageZoomY = 1;
|
|
37277
37834
|
}
|
|
37278
37835
|
getName() {
|
|
37279
37836
|
return WEAVE_STAGE_GRID_PLUGIN_KEY;
|
|
@@ -37298,10 +37855,10 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37298
37855
|
const stage = this.instance.getStage();
|
|
37299
37856
|
window.addEventListener("keydown", (e) => {
|
|
37300
37857
|
if (e.code === "Space") this.isSpaceKeyPressed = true;
|
|
37301
|
-
});
|
|
37858
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37302
37859
|
window.addEventListener("keyup", (e) => {
|
|
37303
37860
|
if (e.code === "Space") this.isSpaceKeyPressed = false;
|
|
37304
|
-
});
|
|
37861
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37305
37862
|
this.instance.addEventListener("onStageMove", () => {
|
|
37306
37863
|
this.onRender();
|
|
37307
37864
|
});
|
|
@@ -37567,15 +38124,14 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
37567
38124
|
//#endregion
|
|
37568
38125
|
//#region src/plugins/stage-panning/stage-panning.ts
|
|
37569
38126
|
var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
37570
|
-
panning = false;
|
|
37571
|
-
currentPointer = null;
|
|
37572
|
-
stageScrollInterval = void 0;
|
|
37573
|
-
panEdgeTargets = {};
|
|
37574
38127
|
getLayerName = void 0;
|
|
37575
38128
|
initLayer = void 0;
|
|
37576
38129
|
constructor(params) {
|
|
37577
38130
|
super();
|
|
37578
38131
|
this.config = mergeExceptArrays(WEAVE_STAGE_PANNING_DEFAULT_CONFIG, params?.config ?? {});
|
|
38132
|
+
this.initialize();
|
|
38133
|
+
}
|
|
38134
|
+
initialize() {
|
|
37579
38135
|
this.pointers = new Map();
|
|
37580
38136
|
this.panning = false;
|
|
37581
38137
|
this.isDragging = false;
|
|
@@ -37587,6 +38143,9 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37587
38143
|
this.isCtrlOrMetaPressed = false;
|
|
37588
38144
|
this.isSpaceKeyPressed = false;
|
|
37589
38145
|
this.previousPointer = null;
|
|
38146
|
+
this.currentPointer = null;
|
|
38147
|
+
this.stageScrollInterval = void 0;
|
|
38148
|
+
this.panEdgeTargets = {};
|
|
37590
38149
|
}
|
|
37591
38150
|
getName() {
|
|
37592
38151
|
return WEAVE_STAGE_PANNING_KEY;
|
|
@@ -37610,6 +38169,9 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37610
38169
|
}
|
|
37611
38170
|
initEvents() {
|
|
37612
38171
|
const stage = this.instance.getStage();
|
|
38172
|
+
window.addEventListener("blur", () => {
|
|
38173
|
+
this.isCtrlOrMetaPressed = false;
|
|
38174
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37613
38175
|
window.addEventListener("keydown", (e) => {
|
|
37614
38176
|
if (e.ctrlKey || e.metaKey) this.isCtrlOrMetaPressed = true;
|
|
37615
38177
|
if (e.code === "Space") {
|
|
@@ -37620,7 +38182,7 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37620
38182
|
this.isSpaceKeyPressed = true;
|
|
37621
38183
|
this.setCursor();
|
|
37622
38184
|
}
|
|
37623
|
-
});
|
|
38185
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37624
38186
|
window.addEventListener("keyup", (e) => {
|
|
37625
38187
|
if (e.key === "Meta" || e.key === "Control") this.isCtrlOrMetaPressed = false;
|
|
37626
38188
|
if (e.code === "Space") {
|
|
@@ -37631,7 +38193,7 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37631
38193
|
this.isSpaceKeyPressed = false;
|
|
37632
38194
|
this.disableMove();
|
|
37633
38195
|
}
|
|
37634
|
-
});
|
|
38196
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
37635
38197
|
let lastPos = null;
|
|
37636
38198
|
stage.on("pointerdown", (e) => {
|
|
37637
38199
|
this.pointers.set(e.evt.pointerId, {
|
|
@@ -37704,7 +38266,10 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37704
38266
|
this.instance.emitEvent("onStageMove");
|
|
37705
38267
|
};
|
|
37706
38268
|
const handleWheelThrottled = (0, import_lodash.throttle)(handleWheel, WEAVE_STAGE_PANNING_THROTTLE_MS);
|
|
37707
|
-
window.addEventListener("wheel", handleWheelThrottled, {
|
|
38269
|
+
window.addEventListener("wheel", handleWheelThrottled, {
|
|
38270
|
+
passive: true,
|
|
38271
|
+
signal: this.instance.getEventsController()?.signal
|
|
38272
|
+
});
|
|
37708
38273
|
stage.on("dragstart", (e) => {
|
|
37709
38274
|
const duration = 1e3 / 60;
|
|
37710
38275
|
if (this.panEdgeTargets[e.target.getAttrs().id ?? ""] !== void 0) return;
|
|
@@ -37762,7 +38327,10 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
37762
38327
|
stage.container().style.setProperty("-webkit-user-drag", "none");
|
|
37763
38328
|
stage.getContent().addEventListener("touchmove", function(e) {
|
|
37764
38329
|
e.preventDefault();
|
|
37765
|
-
}, {
|
|
38330
|
+
}, {
|
|
38331
|
+
passive: false,
|
|
38332
|
+
signal: this.instance.getEventsController()?.signal
|
|
38333
|
+
});
|
|
37766
38334
|
}
|
|
37767
38335
|
isPanning() {
|
|
37768
38336
|
return this.panning;
|
|
@@ -37840,6 +38408,9 @@ var WeaveStageMinimapPlugin = class extends WeavePlugin {
|
|
|
37840
38408
|
constructor(params) {
|
|
37841
38409
|
super();
|
|
37842
38410
|
this.config = mergeExceptArrays(STAGE_MINIMAP_DEFAULT_CONFIG, params.config);
|
|
38411
|
+
this.initialize();
|
|
38412
|
+
}
|
|
38413
|
+
initialize() {
|
|
37843
38414
|
this.initialized = false;
|
|
37844
38415
|
}
|
|
37845
38416
|
getName() {
|
|
@@ -38017,6 +38588,7 @@ const WEAVE_STAGE_RESIZE_KEY = "stageResize";
|
|
|
38017
38588
|
var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
38018
38589
|
getLayerName = void 0;
|
|
38019
38590
|
initLayer = void 0;
|
|
38591
|
+
initialize = void 0;
|
|
38020
38592
|
getName() {
|
|
38021
38593
|
return WEAVE_STAGE_RESIZE_KEY;
|
|
38022
38594
|
}
|
|
@@ -38036,6 +38608,10 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
|
38036
38608
|
const pluginInstance = plugins[pluginId];
|
|
38037
38609
|
pluginInstance.onRender?.();
|
|
38038
38610
|
}
|
|
38611
|
+
this.instance.emitEvent("onStageResize", {
|
|
38612
|
+
width: stage.width(),
|
|
38613
|
+
height: stage.height()
|
|
38614
|
+
});
|
|
38039
38615
|
}
|
|
38040
38616
|
}
|
|
38041
38617
|
onInit() {
|
|
@@ -38044,7 +38620,7 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
|
38044
38620
|
}, DEFAULT_THROTTLE_MS);
|
|
38045
38621
|
window.addEventListener("resize", () => {
|
|
38046
38622
|
throttledResize();
|
|
38047
|
-
});
|
|
38623
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
38048
38624
|
const resizeObserver = new ResizeObserver(() => {
|
|
38049
38625
|
throttledResize();
|
|
38050
38626
|
});
|
|
@@ -38062,10 +38638,12 @@ var WeaveStageResizePlugin = class extends WeavePlugin {
|
|
|
38062
38638
|
//#endregion
|
|
38063
38639
|
//#region src/plugins/nodes-multi-selection-feedback/nodes-multi-selection-feedback.ts
|
|
38064
38640
|
var WeaveNodesMultiSelectionFeedbackPlugin = class extends WeavePlugin {
|
|
38065
|
-
selectedHalos = {};
|
|
38066
38641
|
constructor(params) {
|
|
38067
38642
|
super();
|
|
38068
38643
|
this.config = mergeExceptArrays(WEAVE_NODES_MULTI_SELECTION_FEEDBACK_PLUGIN_DEFAULT_CONFIG, params?.config ?? {});
|
|
38644
|
+
this.initialize();
|
|
38645
|
+
}
|
|
38646
|
+
initialize() {
|
|
38069
38647
|
this.selectedHalos = {};
|
|
38070
38648
|
}
|
|
38071
38649
|
getName() {
|
|
@@ -38231,12 +38809,14 @@ var WeaveNodesMultiSelectionFeedbackPlugin = class extends WeavePlugin {
|
|
|
38231
38809
|
//#endregion
|
|
38232
38810
|
//#region src/plugins/connected-users/connected-users.ts
|
|
38233
38811
|
var WeaveConnectedUsersPlugin = class extends WeavePlugin {
|
|
38234
|
-
connectedUsers = {};
|
|
38235
38812
|
getLayerName = void 0;
|
|
38236
38813
|
constructor(params) {
|
|
38237
38814
|
super();
|
|
38238
38815
|
const { config } = params ?? {};
|
|
38239
38816
|
this.config = config;
|
|
38817
|
+
this.initialize();
|
|
38818
|
+
}
|
|
38819
|
+
initialize() {
|
|
38240
38820
|
this.connectedUsers = {};
|
|
38241
38821
|
}
|
|
38242
38822
|
getName() {
|
|
@@ -38283,6 +38863,9 @@ var WeaveUsersSelectionPlugin = class extends WeavePlugin {
|
|
|
38283
38863
|
this.config = config;
|
|
38284
38864
|
this.config.getUser = memoize(this.config.getUser);
|
|
38285
38865
|
this.config.getUserColor = memoize(this.config.getUserColor);
|
|
38866
|
+
this.initialize();
|
|
38867
|
+
}
|
|
38868
|
+
initialize() {
|
|
38286
38869
|
this.usersSelection = {};
|
|
38287
38870
|
}
|
|
38288
38871
|
getName() {
|
|
@@ -38475,6 +39058,9 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
38475
39058
|
this.config.getUser = memoize(this.config.getUser);
|
|
38476
39059
|
this.config.getUserBackgroundColor = memoize(this.config.getUserBackgroundColor);
|
|
38477
39060
|
this.config.getUserForegroundColor = memoize(this.config.getUserForegroundColor);
|
|
39061
|
+
this.initialize();
|
|
39062
|
+
}
|
|
39063
|
+
initialize() {
|
|
38478
39064
|
this.usersPointers = {};
|
|
38479
39065
|
this.usersOperations = {};
|
|
38480
39066
|
}
|
|
@@ -38685,6 +39271,9 @@ var WeaveUsersPresencePlugin = class extends WeavePlugin {
|
|
|
38685
39271
|
super();
|
|
38686
39272
|
const { config } = params;
|
|
38687
39273
|
this.config = mergeExceptArrays(WEAVE_USERS_PRESENCE_CONFIG_DEFAULT_PROPS, config);
|
|
39274
|
+
this.initialize();
|
|
39275
|
+
}
|
|
39276
|
+
initialize() {
|
|
38688
39277
|
this.userPresence = {};
|
|
38689
39278
|
}
|
|
38690
39279
|
getName() {
|
|
@@ -38760,6 +39349,9 @@ var WeaveStageDropAreaPlugin = class extends WeavePlugin {
|
|
|
38760
39349
|
initLayer = void 0;
|
|
38761
39350
|
constructor() {
|
|
38762
39351
|
super();
|
|
39352
|
+
this.initialize();
|
|
39353
|
+
}
|
|
39354
|
+
initialize() {
|
|
38763
39355
|
this.enabled = true;
|
|
38764
39356
|
}
|
|
38765
39357
|
getName() {
|
|
@@ -38773,14 +39365,20 @@ var WeaveStageDropAreaPlugin = class extends WeavePlugin {
|
|
|
38773
39365
|
stage.container().addEventListener("dragover", (e) => {
|
|
38774
39366
|
e.preventDefault();
|
|
38775
39367
|
e.stopPropagation();
|
|
38776
|
-
});
|
|
39368
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
38777
39369
|
stage.container().addEventListener("drop", (e) => {
|
|
38778
39370
|
e.preventDefault();
|
|
38779
39371
|
e.stopPropagation();
|
|
38780
39372
|
this.instance.emitEvent("onStageDrop", e);
|
|
39373
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
39374
|
+
window.addEventListener("dragover", (e) => e.preventDefault(), {
|
|
39375
|
+
signal: this.instance.getEventsController()?.signal,
|
|
39376
|
+
passive: false
|
|
39377
|
+
});
|
|
39378
|
+
window.addEventListener("drop", (e) => e.preventDefault(), {
|
|
39379
|
+
signal: this.instance.getEventsController()?.signal,
|
|
39380
|
+
passive: false
|
|
38781
39381
|
});
|
|
38782
|
-
window.addEventListener("dragover", (e) => e.preventDefault(), { passive: false });
|
|
38783
|
-
window.addEventListener("drop", (e) => e.preventDefault(), { passive: false });
|
|
38784
39382
|
}
|
|
38785
39383
|
enable() {
|
|
38786
39384
|
this.enabled = true;
|
|
@@ -38799,6 +39397,9 @@ var WeaveNodesEdgeSnappingPlugin = class extends WeavePlugin {
|
|
|
38799
39397
|
this.guideLineConfig = config?.guideLine ?? GUIDE_LINE_DEFAULT_CONFIG;
|
|
38800
39398
|
this.dragSnappingThreshold = config?.dragSnappingThreshold ?? GUIDE_LINE_DRAG_SNAPPING_THRESHOLD;
|
|
38801
39399
|
this.transformSnappingThreshold = config?.transformSnappingThreshold ?? GUIDE_LINE_TRANSFORM_SNAPPING_THRESHOLD;
|
|
39400
|
+
this.initialize();
|
|
39401
|
+
}
|
|
39402
|
+
initialize() {
|
|
38802
39403
|
this.enabled = true;
|
|
38803
39404
|
}
|
|
38804
39405
|
getName() {
|
|
@@ -39175,6 +39776,9 @@ var WeaveNodesDistanceSnappingPlugin = class extends WeavePlugin {
|
|
|
39175
39776
|
this.enterSnappingTolerance = config?.enterSnappingTolerance ?? GUIDE_ENTER_SNAPPING_TOLERANCE;
|
|
39176
39777
|
this.exitSnappingTolerance = config?.exitSnappingTolerance ?? GUIDE_EXIT_SNAPPING_TOLERANCE;
|
|
39177
39778
|
this.uiConfig = mergeExceptArrays(GUIDE_DISTANCE_LINE_DEFAULT_CONFIG, config?.ui);
|
|
39779
|
+
this.initialize();
|
|
39780
|
+
}
|
|
39781
|
+
initialize() {
|
|
39178
39782
|
this.enabled = true;
|
|
39179
39783
|
}
|
|
39180
39784
|
getName() {
|
|
@@ -39821,12 +40425,14 @@ var WeaveNodesDistanceSnappingPlugin = class extends WeavePlugin {
|
|
|
39821
40425
|
//#endregion
|
|
39822
40426
|
//#region src/plugins/comments-renderer/comments-renderer.ts
|
|
39823
40427
|
var WeaveCommentsRendererPlugin = class extends WeavePlugin {
|
|
39824
|
-
comments = [];
|
|
39825
40428
|
getLayerName = void 0;
|
|
39826
40429
|
constructor(params) {
|
|
39827
40430
|
super();
|
|
39828
40431
|
const { config } = params ?? {};
|
|
39829
40432
|
this.config = config;
|
|
40433
|
+
this.initialize();
|
|
40434
|
+
}
|
|
40435
|
+
initialize() {
|
|
39830
40436
|
this.comments = [];
|
|
39831
40437
|
}
|
|
39832
40438
|
getName() {
|
|
@@ -39917,6 +40523,7 @@ const WEAVE_STAGE_KEYBOARD_MOVE_DEFAULT_CONFIG = { movementDelta: 5 };
|
|
|
39917
40523
|
var WeaveStageKeyboardMovePlugin = class extends WeavePlugin {
|
|
39918
40524
|
getLayerName = void 0;
|
|
39919
40525
|
initLayer = void 0;
|
|
40526
|
+
initialize = void 0;
|
|
39920
40527
|
constructor(params) {
|
|
39921
40528
|
super();
|
|
39922
40529
|
this.config = mergeExceptArrays(WEAVE_STAGE_KEYBOARD_MOVE_DEFAULT_CONFIG, params?.config ?? {});
|
|
@@ -39955,7 +40562,7 @@ var WeaveStageKeyboardMovePlugin = class extends WeavePlugin {
|
|
|
39955
40562
|
if (e.code === "ArrowLeft" && e.shiftKey) this.handleNodesMovement("left");
|
|
39956
40563
|
if (e.code === "ArrowRight" && e.shiftKey) this.handleNodesMovement("right");
|
|
39957
40564
|
if (e.code === "ArrowDown" && e.shiftKey) this.handleNodesMovement("down");
|
|
39958
|
-
});
|
|
40565
|
+
}, { signal: this.instance.getEventsController()?.signal });
|
|
39959
40566
|
}
|
|
39960
40567
|
enable() {
|
|
39961
40568
|
this.enabled = true;
|
|
@@ -39977,4 +40584,4 @@ const setupCanvasBackend = async () => {
|
|
|
39977
40584
|
};
|
|
39978
40585
|
|
|
39979
40586
|
//#endregion
|
|
39980
|
-
export { ALIGN_NODES_ALIGN_TO, ALIGN_NODES_TOOL_ACTION_NAME, ALIGN_NODES_TOOL_STATE,
|
|
40587
|
+
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, getPositionRelativeToContainerOnPosition, getSelectedNodesMetadata, getStageClickPoint, getTargetAndSkipNodes, getTargetedNode, getTopmostShadowHost, getVisibleNodes, getVisibleNodesInViewport, hasFrames, hasImages, intersectArrays, isIOS, isInShadowDOM, isNodeInSelection, isServer, loadImageSource, memoize, mergeExceptArrays, moveNodeToContainer, moveNodeToContainerNT, resetScale, setupCanvasBackend, setupSkiaBackend };
|