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