@inditextech/weave-sdk 0.36.0 → 0.38.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.cjs +520 -184
- package/dist/sdk.d.cts +89 -16
- package/dist/sdk.d.cts.map +1 -1
- package/dist/sdk.d.ts +89 -16
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +533 -200
- package/dist/sdk.js.map +1 -1
- package/package.json +2 -2
package/dist/sdk.js
CHANGED
|
@@ -15493,7 +15493,6 @@ var require_lodash = __commonJS({ "../../node_modules/lodash/lodash.js"(exports,
|
|
|
15493
15493
|
} else root._ = _;
|
|
15494
15494
|
}).call(exports);
|
|
15495
15495
|
} });
|
|
15496
|
-
var import_lodash$1 = __toESM(require_lodash());
|
|
15497
15496
|
var import_lodash = __toESM(require_lodash(), 1);
|
|
15498
15497
|
|
|
15499
15498
|
//#endregion
|
|
@@ -15587,12 +15586,12 @@ var WeaveStore = class {
|
|
|
15587
15586
|
node: JSON.parse(JSON.stringify(nodeInfo.node))
|
|
15588
15587
|
});
|
|
15589
15588
|
}
|
|
15590
|
-
if (!this.isRoomLoaded && !(0, import_lodash
|
|
15589
|
+
if (!this.isRoomLoaded && !(0, import_lodash.isEmpty)(this.state.weave)) {
|
|
15591
15590
|
this.instance.setupRenderer();
|
|
15592
15591
|
this.isRoomLoaded = true;
|
|
15593
15592
|
this.instance.emitEvent("onRoomLoaded", this.isRoomLoaded);
|
|
15594
15593
|
}
|
|
15595
|
-
if (this.isRoomLoaded && !(0, import_lodash
|
|
15594
|
+
if (this.isRoomLoaded && !(0, import_lodash.isEmpty)(this.state.weave)) this.instance.render();
|
|
15596
15595
|
});
|
|
15597
15596
|
}
|
|
15598
15597
|
canUndoStateStep() {
|
|
@@ -15656,6 +15655,9 @@ var WeaveContextMenuPlugin = class extends WeavePlugin {
|
|
|
15656
15655
|
initLayer = void 0;
|
|
15657
15656
|
constructor(params) {
|
|
15658
15657
|
super();
|
|
15658
|
+
this.onAction = void 0;
|
|
15659
|
+
this.dragging = false;
|
|
15660
|
+
this.transforming = false;
|
|
15659
15661
|
this.touchTimer = void 0;
|
|
15660
15662
|
this.tapHold = false;
|
|
15661
15663
|
this.contextMenuVisible = false;
|
|
@@ -15730,11 +15732,16 @@ var WeaveContextMenuPlugin = class extends WeavePlugin {
|
|
|
15730
15732
|
}
|
|
15731
15733
|
initEvents() {
|
|
15732
15734
|
const stage = this.instance.getStage();
|
|
15735
|
+
this.instance.addEventListener("onActiveActionChange", (activeAction) => {
|
|
15736
|
+
this.onAction = activeAction;
|
|
15737
|
+
});
|
|
15733
15738
|
this.instance.addEventListener("onDrag", (node) => {
|
|
15739
|
+
this.actualNode = node;
|
|
15734
15740
|
if (node) this.dragging = true;
|
|
15735
15741
|
else this.dragging = false;
|
|
15736
15742
|
});
|
|
15737
15743
|
this.instance.addEventListener("onTransform", (node) => {
|
|
15744
|
+
this.actualNode = node;
|
|
15738
15745
|
if (node) this.transforming = true;
|
|
15739
15746
|
else this.transforming = false;
|
|
15740
15747
|
});
|
|
@@ -15744,15 +15751,22 @@ var WeaveContextMenuPlugin = class extends WeavePlugin {
|
|
|
15744
15751
|
if (e.evt.pointerType === "touch" && Object.keys(this.pointers).length > 1) return;
|
|
15745
15752
|
this.touchTimer = setTimeout(() => {
|
|
15746
15753
|
this.tapHold = true;
|
|
15747
|
-
|
|
15754
|
+
const actualActions = this.instance.getActiveAction();
|
|
15755
|
+
if (actualActions !== "selectionTool") return;
|
|
15756
|
+
const shouldKillLongPressTimer = this.touchTimer && (typeof this.onAction === "undefined" || typeof this.onAction !== "undefined" && ["selectionTool"].includes(this.onAction)) && (typeof this.dragging !== "undefined" && this.dragging || typeof this.transforming !== "undefined" && this.transforming);
|
|
15757
|
+
if (shouldKillLongPressTimer) {
|
|
15748
15758
|
clearTimeout(this.touchTimer);
|
|
15749
15759
|
return;
|
|
15750
15760
|
}
|
|
15761
|
+
this.actualNode?.stopDrag();
|
|
15762
|
+
delete this.pointers[e.evt.pointerId];
|
|
15751
15763
|
this.triggerContextMenu(e.target);
|
|
15752
15764
|
}, this.tapHoldTimeout);
|
|
15753
15765
|
});
|
|
15754
15766
|
stage.on("pointermove", (e) => {
|
|
15755
|
-
if (e.evt.pointerType
|
|
15767
|
+
if (["mouse"].includes(e.evt.pointerType)) return;
|
|
15768
|
+
if (["pen"].includes(e.evt.pointerType) && e.evt.pressure === 0) return;
|
|
15769
|
+
if (["pen"].includes(e.evt.pointerType) && (e.evt.movementX >= -1 && e.evt.movementX <= 1 || e.evt.movementY >= -1 && e.evt.movementY >= 1)) return;
|
|
15756
15770
|
if (this.touchTimer) clearTimeout(this.touchTimer);
|
|
15757
15771
|
});
|
|
15758
15772
|
stage.on("pointerup", (e) => {
|
|
@@ -15823,8 +15837,11 @@ function checkIfOverContainer(instance, node) {
|
|
|
15823
15837
|
if (!node.getAttrs().containerId && nodesIntersected && nodeActualContainer?.getAttrs().id !== nodesIntersected.getAttrs().id) layerToMove = nodesIntersected;
|
|
15824
15838
|
return layerToMove;
|
|
15825
15839
|
}
|
|
15826
|
-
function moveNodeToContainer(instance, node) {
|
|
15840
|
+
function moveNodeToContainer(instance, node, ignoreContainers = []) {
|
|
15827
15841
|
const nodeIntersected = instance.pointIntersectsContainerElement();
|
|
15842
|
+
let realNodeIntersected = nodeIntersected;
|
|
15843
|
+
if (realNodeIntersected && realNodeIntersected.getAttrs().nodeType === "frame" && !realNodeIntersected.getAttrs().nodeId) realNodeIntersected = instance.getStage().findOne(`#${realNodeIntersected.getAttrs().id}-selector-area`);
|
|
15844
|
+
if (realNodeIntersected && ignoreContainers.includes(realNodeIntersected)) return void 0;
|
|
15828
15845
|
const isLocked = instance.allNodesLocked([node]);
|
|
15829
15846
|
if (isLocked) return;
|
|
15830
15847
|
let nodeActualContainer = node.getParent();
|
|
@@ -15981,6 +15998,8 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
15981
15998
|
];
|
|
15982
15999
|
this.active = false;
|
|
15983
16000
|
this.cameFromSelectingMultiple = false;
|
|
16001
|
+
this.didMove = false;
|
|
16002
|
+
this.selectionTriggered = false;
|
|
15984
16003
|
this.selecting = false;
|
|
15985
16004
|
this.dragging = false;
|
|
15986
16005
|
this.initialized = false;
|
|
@@ -16039,12 +16058,13 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16039
16058
|
const handleTransform = () => {
|
|
16040
16059
|
this.triggerSelectedNodesEvent();
|
|
16041
16060
|
};
|
|
16042
|
-
tr.on("transform", (0, import_lodash
|
|
16061
|
+
tr.on("transform", (0, import_lodash.throttle)(handleTransform, 50));
|
|
16043
16062
|
tr.on("transformend", () => {
|
|
16044
16063
|
this.triggerSelectedNodesEvent();
|
|
16045
16064
|
});
|
|
16046
16065
|
tr.on("dragstart", (e) => {
|
|
16047
16066
|
this.dragging = true;
|
|
16067
|
+
this.didMove = false;
|
|
16048
16068
|
const stage$1 = this.instance.getStage();
|
|
16049
16069
|
if (stage$1.isMouseWheelPressed()) {
|
|
16050
16070
|
e.cancelBubble = true;
|
|
@@ -16054,7 +16074,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16054
16074
|
const selectedNodes = tr.nodes();
|
|
16055
16075
|
for (let i = 0; i < selectedNodes.length; i++) {
|
|
16056
16076
|
const node = selectedNodes[i];
|
|
16057
|
-
node.updatePosition(
|
|
16077
|
+
node.updatePosition(node.getAbsolutePosition());
|
|
16058
16078
|
}
|
|
16059
16079
|
tr.forceUpdate();
|
|
16060
16080
|
e.cancelBubble = true;
|
|
@@ -16066,40 +16086,47 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16066
16086
|
e.target.stopDrag();
|
|
16067
16087
|
return;
|
|
16068
16088
|
}
|
|
16089
|
+
this.didMove = true;
|
|
16090
|
+
e.cancelBubble = true;
|
|
16069
16091
|
const selectedNodes = tr.nodes();
|
|
16092
|
+
let hasFrames = false;
|
|
16070
16093
|
for (let i = 0; i < selectedNodes.length; i++) {
|
|
16071
16094
|
const node = selectedNodes[i];
|
|
16072
|
-
node.
|
|
16095
|
+
if (node.getAttrs().nodeType === "frame") hasFrames = hasFrames || true;
|
|
16096
|
+
node.updatePosition(node.getAbsolutePosition());
|
|
16073
16097
|
}
|
|
16074
|
-
e.cancelBubble = true;
|
|
16075
16098
|
if (this.isSelecting() && selectedNodes.length > 1) {
|
|
16076
16099
|
clearContainerTargets(this.instance);
|
|
16077
16100
|
const layerToMove = checkIfOverContainer(this.instance, e.target);
|
|
16078
|
-
if (layerToMove) layerToMove.fire(WEAVE_NODE_CUSTOM_EVENTS.onTargetEnter, { bubbles: true });
|
|
16101
|
+
if (layerToMove && !hasFrames) layerToMove.fire(WEAVE_NODE_CUSTOM_EVENTS.onTargetEnter, { bubbles: true });
|
|
16079
16102
|
}
|
|
16080
16103
|
tr.forceUpdate();
|
|
16081
16104
|
};
|
|
16082
|
-
tr.on("dragmove",
|
|
16105
|
+
tr.on("dragmove", handleDragMove);
|
|
16083
16106
|
tr.on("dragend", (e) => {
|
|
16107
|
+
if (!this.didMove) return;
|
|
16084
16108
|
this.dragging = false;
|
|
16085
16109
|
e.cancelBubble = true;
|
|
16086
16110
|
const selectedNodes = tr.nodes();
|
|
16111
|
+
let hasFrames = false;
|
|
16087
16112
|
for (let i = 0; i < selectedNodes.length; i++) {
|
|
16088
16113
|
const node = selectedNodes[i];
|
|
16089
|
-
node.
|
|
16114
|
+
if (node.getAttrs().nodeType === "frame") hasFrames = hasFrames || true;
|
|
16115
|
+
node.updatePosition(node.getAbsolutePosition());
|
|
16090
16116
|
}
|
|
16091
16117
|
if (this.isSelecting() && tr.nodes().length > 1) {
|
|
16092
16118
|
const actualCursor = stage.container().style.cursor;
|
|
16093
16119
|
stage.container().style.cursor = "wait";
|
|
16094
16120
|
clearContainerTargets(this.instance);
|
|
16121
|
+
const toSelect = [];
|
|
16095
16122
|
const toUpdate = [];
|
|
16096
16123
|
const nodeUpdatePromise = (node) => {
|
|
16097
16124
|
return new Promise((resolve) => {
|
|
16098
16125
|
setTimeout(() => {
|
|
16099
|
-
|
|
16100
|
-
if (layerToMove) return resolve();
|
|
16126
|
+
moveNodeToContainer(this.instance, node, selectedNodes);
|
|
16101
16127
|
const nodeHandler = this.instance.getNodeHandler(node.getAttrs().nodeType);
|
|
16102
16128
|
if (!nodeHandler) return resolve();
|
|
16129
|
+
toSelect.push(node.getAttrs().id ?? "");
|
|
16103
16130
|
toUpdate.push(nodeHandler.serialize(node));
|
|
16104
16131
|
resolve();
|
|
16105
16132
|
}, 0);
|
|
@@ -16111,6 +16138,15 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16111
16138
|
if (results.length > 0) this.instance.updateNodes(toUpdate);
|
|
16112
16139
|
stage.container().style.cursor = actualCursor;
|
|
16113
16140
|
});
|
|
16141
|
+
setTimeout(() => {
|
|
16142
|
+
const finalSelectedNodes = [];
|
|
16143
|
+
toSelect.forEach((nodeId) => {
|
|
16144
|
+
const actNode = this.instance.getStage().findOne(`#${nodeId}`);
|
|
16145
|
+
if (actNode) finalSelectedNodes.push(actNode);
|
|
16146
|
+
});
|
|
16147
|
+
tr.nodes(finalSelectedNodes);
|
|
16148
|
+
tr.forceUpdate();
|
|
16149
|
+
}, 0);
|
|
16114
16150
|
}
|
|
16115
16151
|
tr.forceUpdate();
|
|
16116
16152
|
});
|
|
@@ -16189,6 +16225,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16189
16225
|
if (!this.initialized) return;
|
|
16190
16226
|
if (!this.active) return;
|
|
16191
16227
|
if (e.evt.pointerType === "mouse" && e.evt.button !== 0) return;
|
|
16228
|
+
if (e.evt.pointerType === "pen" && e.evt.pressure <= .05) return;
|
|
16192
16229
|
if (e.evt.pointerType === "touch" && Object.keys(this.pointers).length > 1) return;
|
|
16193
16230
|
const selectedGroup = this.instance.getInstanceRecursive(e.target);
|
|
16194
16231
|
if (!(e.target instanceof Konva.Stage) && !(selectedGroup && selectedGroup.getAttrs().nodeType === "frame")) return;
|
|
@@ -16203,11 +16240,16 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16203
16240
|
this.selectionRectangle.height(0);
|
|
16204
16241
|
this.selecting = true;
|
|
16205
16242
|
this.instance.emitEvent("onSelectionState", true);
|
|
16206
|
-
if (!(e.target instanceof Konva.Stage)) this.cameFromSelectingMultiple = true;
|
|
16207
16243
|
});
|
|
16208
16244
|
const handleMouseMove = (e) => {
|
|
16245
|
+
if (this.selectionTriggered) {
|
|
16246
|
+
this.selectionTriggered = false;
|
|
16247
|
+
this.selectionRectangle.setAttrs({ visible: false });
|
|
16248
|
+
return;
|
|
16249
|
+
}
|
|
16209
16250
|
if (!this.initialized) return;
|
|
16210
16251
|
if (!this.active) return;
|
|
16252
|
+
if (e.evt.pointerType === "pen" && e.evt.pressure <= .05) return;
|
|
16211
16253
|
if (e.evt.pointerType === "touch" && Object.keys(this.pointers).length > 1) return;
|
|
16212
16254
|
const contextMenuPlugin = this.instance.getPlugin("contextMenu");
|
|
16213
16255
|
if (contextMenuPlugin && contextMenuPlugin.isContextMenuVisible()) {
|
|
@@ -16229,12 +16271,18 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16229
16271
|
height: Math.abs(y2 - y1)
|
|
16230
16272
|
});
|
|
16231
16273
|
};
|
|
16232
|
-
stage.on("pointermove",
|
|
16274
|
+
stage.on("pointermove", handleMouseMove);
|
|
16233
16275
|
stage.on("pointerup", (e) => {
|
|
16234
16276
|
delete this.pointers[e.evt.pointerId];
|
|
16277
|
+
if (this.selectionTriggered) {
|
|
16278
|
+
this.selectionTriggered = false;
|
|
16279
|
+
this.selectionRectangle.setAttrs({ visible: false });
|
|
16280
|
+
return;
|
|
16281
|
+
}
|
|
16235
16282
|
if (!this.initialized) return;
|
|
16236
16283
|
if (!this.active) return;
|
|
16237
16284
|
if (!this.selecting) return;
|
|
16285
|
+
if (e.evt.pointerType === "pen" && e.evt.pressure > 0) return;
|
|
16238
16286
|
if (e.evt.pointerType === "touch" && Object.keys(this.pointers).length + 1 > 1) return;
|
|
16239
16287
|
const contextMenuPlugin = this.instance.getPlugin("contextMenu");
|
|
16240
16288
|
if (contextMenuPlugin && contextMenuPlugin.isContextMenuVisible()) {
|
|
@@ -16247,7 +16295,6 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16247
16295
|
this.cameFromSelectingMultiple = false;
|
|
16248
16296
|
return;
|
|
16249
16297
|
}
|
|
16250
|
-
this.tr.nodes([]);
|
|
16251
16298
|
this.selectionRectangle.visible(false);
|
|
16252
16299
|
const shapes = stage.find((node) => {
|
|
16253
16300
|
return ["Shape", "Group"].includes(node.getType()) && typeof node.getAttrs().id !== "undefined";
|
|
@@ -16267,9 +16314,9 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16267
16314
|
});
|
|
16268
16315
|
const selectedNodes = new Set();
|
|
16269
16316
|
const framesNodes = selected.filter((shape) => {
|
|
16270
|
-
return shape.getAttrs().nodeType === "frame";
|
|
16317
|
+
return shape instanceof Konva.Rect && shape.getAttrs().nodeType === "frame";
|
|
16271
16318
|
});
|
|
16272
|
-
|
|
16319
|
+
let framesNodesIds = framesNodes.map((shape) => {
|
|
16273
16320
|
if (shape.getAttrs().nodeType === "frame" && shape.getAttrs().nodeId) return stage.findOne(`#${shape.getAttrs().nodeId}`);
|
|
16274
16321
|
return shape;
|
|
16275
16322
|
}).filter((shape) => {
|
|
@@ -16277,6 +16324,8 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16277
16324
|
}).map((shape) => {
|
|
16278
16325
|
return shape.getAttrs().id;
|
|
16279
16326
|
});
|
|
16327
|
+
const uniqueFramesNodesIds = new Set(framesNodesIds);
|
|
16328
|
+
framesNodesIds = Array.from(uniqueFramesNodesIds);
|
|
16280
16329
|
const otherNodes = selected.filter((shape) => shape.getAttrs().nodeType !== "frame");
|
|
16281
16330
|
otherNodes.forEach((node) => {
|
|
16282
16331
|
let parent = this.instance.getInstanceRecursive(node.getParent());
|
|
@@ -16287,12 +16336,15 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16287
16336
|
const frameNode = node;
|
|
16288
16337
|
if (!frameNode.getAttrs().locked) selectedNodes.add(frameNode);
|
|
16289
16338
|
});
|
|
16339
|
+
this.selecting = false;
|
|
16290
16340
|
this.tr.nodes([...selectedNodes]);
|
|
16291
16341
|
this.triggerSelectedNodesEvent();
|
|
16292
16342
|
stage.container().tabIndex = 1;
|
|
16293
16343
|
stage.container().focus();
|
|
16294
16344
|
});
|
|
16295
16345
|
stage.on("pointerclick", (e) => {
|
|
16346
|
+
e.cancelBubble = true;
|
|
16347
|
+
this.selectionTriggered = false;
|
|
16296
16348
|
if (!this.enabled) return;
|
|
16297
16349
|
if (this.instance.getActiveAction() !== "selectionTool") return;
|
|
16298
16350
|
if (this.dragging) return;
|
|
@@ -16308,17 +16360,17 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16308
16360
|
let selectedGroup = void 0;
|
|
16309
16361
|
const mousePos = stage.getPointerPosition();
|
|
16310
16362
|
if (mousePos) {
|
|
16311
|
-
const
|
|
16312
|
-
if (
|
|
16363
|
+
const allInter = stage.getAllIntersections(mousePos);
|
|
16364
|
+
if (allInter && allInter.length === 1) selectedGroup = this.instance.getInstanceRecursive(allInter[0]);
|
|
16313
16365
|
}
|
|
16314
16366
|
if (!this.initialized) return;
|
|
16315
|
-
if (e.evt.button && e.evt.button !== 0) return;
|
|
16316
|
-
if (this.selectionRectangle.visible()) return;
|
|
16367
|
+
if (e.evt.pointerType === "mouse" && e.evt.button && e.evt.button !== 0) return;
|
|
16317
16368
|
if (e.target instanceof Konva.Stage && !selectedGroup) {
|
|
16369
|
+
e.evt.preventDefault();
|
|
16318
16370
|
this.tr.nodes([]);
|
|
16319
16371
|
this.triggerSelectedNodesEvent();
|
|
16320
16372
|
if (contextMenuPlugin && !contextMenuPlugin.isTapHold()) this.instance.emitEvent("onStageSelection");
|
|
16321
|
-
return;
|
|
16373
|
+
return false;
|
|
16322
16374
|
}
|
|
16323
16375
|
let areNodesSelected = false;
|
|
16324
16376
|
let nodeTargeted = selectedGroup && !(selectedGroup.getAttrs().active ?? false) ? selectedGroup : e.target;
|
|
@@ -16365,6 +16417,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16365
16417
|
stage.container().focus();
|
|
16366
16418
|
stage.container().style.cursor = "grab";
|
|
16367
16419
|
}
|
|
16420
|
+
this.selectionTriggered = true;
|
|
16368
16421
|
this.triggerSelectedNodesEvent();
|
|
16369
16422
|
});
|
|
16370
16423
|
}
|
|
@@ -16735,7 +16788,7 @@ var WeaveNode = class {
|
|
|
16735
16788
|
if (nodeHandler) this.instance.updateNode(nodeHandler.serialize(node$1));
|
|
16736
16789
|
}
|
|
16737
16790
|
};
|
|
16738
|
-
node.on("transform", (0, import_lodash
|
|
16791
|
+
node.on("transform", (0, import_lodash.throttle)(handleTransform, 100));
|
|
16739
16792
|
node.on("transformend", (e) => {
|
|
16740
16793
|
const node$1 = e.target;
|
|
16741
16794
|
this.instance.emitEvent("onTransform", null);
|
|
@@ -16748,7 +16801,13 @@ var WeaveNode = class {
|
|
|
16748
16801
|
if (nodeHandler) this.instance.updateNode(nodeHandler.serialize(node$1));
|
|
16749
16802
|
});
|
|
16750
16803
|
node.on("dragstart", (e) => {
|
|
16804
|
+
this.didMove = false;
|
|
16751
16805
|
const stage = this.instance.getStage();
|
|
16806
|
+
const isErasing = this.instance.getActiveAction() === "eraseTool";
|
|
16807
|
+
if (isErasing) {
|
|
16808
|
+
e.target.stopDrag();
|
|
16809
|
+
return;
|
|
16810
|
+
}
|
|
16752
16811
|
this.instance.emitEvent("onDrag", e.target);
|
|
16753
16812
|
if (stage.isMouseWheelPressed()) {
|
|
16754
16813
|
e.cancelBubble = true;
|
|
@@ -16756,7 +16815,13 @@ var WeaveNode = class {
|
|
|
16756
16815
|
}
|
|
16757
16816
|
});
|
|
16758
16817
|
const handleDragMove = (e) => {
|
|
16818
|
+
this.didMove = true;
|
|
16759
16819
|
const stage = this.instance.getStage();
|
|
16820
|
+
const isErasing = this.instance.getActiveAction() === "eraseTool";
|
|
16821
|
+
if (isErasing) {
|
|
16822
|
+
e.target.stopDrag();
|
|
16823
|
+
return;
|
|
16824
|
+
}
|
|
16760
16825
|
if (stage.isMouseWheelPressed()) {
|
|
16761
16826
|
e.cancelBubble = true;
|
|
16762
16827
|
e.target.stopDrag();
|
|
@@ -16766,12 +16831,16 @@ var WeaveNode = class {
|
|
|
16766
16831
|
clearContainerTargets(this.instance);
|
|
16767
16832
|
const layerToMove = checkIfOverContainer(this.instance, e.target);
|
|
16768
16833
|
if (layerToMove) layerToMove.fire(WEAVE_NODE_CUSTOM_EVENTS.onTargetEnter, { bubbles: true });
|
|
16769
|
-
const nodeHandler = this.instance.getNodeHandler(node.getAttrs().nodeType);
|
|
16770
|
-
if (nodeHandler) this.instance.updateNode(nodeHandler.serialize(node));
|
|
16771
16834
|
}
|
|
16772
16835
|
};
|
|
16773
|
-
node.on("dragmove", (0, import_lodash
|
|
16836
|
+
node.on("dragmove", (0, import_lodash.throttle)(handleDragMove, 100));
|
|
16774
16837
|
node.on("dragend", (e) => {
|
|
16838
|
+
if (!this.didMove) return;
|
|
16839
|
+
const isErasing = this.instance.getActiveAction() === "eraseTool";
|
|
16840
|
+
if (isErasing) {
|
|
16841
|
+
e.target.stopDrag();
|
|
16842
|
+
return;
|
|
16843
|
+
}
|
|
16775
16844
|
this.instance.emitEvent("onDrag", null);
|
|
16776
16845
|
if (this.isSelecting() && this.isNodeSelected(node)) {
|
|
16777
16846
|
clearContainerTargets(this.instance);
|
|
@@ -16875,14 +16944,19 @@ var WeaveNode = class {
|
|
|
16875
16944
|
}
|
|
16876
16945
|
unlock(instance) {
|
|
16877
16946
|
if (instance.getAttrs().nodeType !== this.getNodeType()) return;
|
|
16878
|
-
|
|
16879
|
-
this.instance.
|
|
16880
|
-
|
|
16947
|
+
let realInstance = instance;
|
|
16948
|
+
if (instance.getAttrs().nodeId) realInstance = this.instance.getStage().findOne(`#${instance.getAttrs().nodeId}`);
|
|
16949
|
+
if (!realInstance) return;
|
|
16950
|
+
realInstance.setAttrs({ locked: false });
|
|
16951
|
+
this.instance.updateNode(this.serialize(realInstance));
|
|
16952
|
+
this.setupDefaultNodeEvents(realInstance);
|
|
16881
16953
|
const stage = this.instance.getStage();
|
|
16882
16954
|
stage.container().style.cursor = "default";
|
|
16883
16955
|
}
|
|
16884
16956
|
isLocked(instance) {
|
|
16885
|
-
|
|
16957
|
+
let realInstance = instance;
|
|
16958
|
+
if (instance.getAttrs().nodeId === false) realInstance = this.instance.getInstanceRecursive(instance);
|
|
16959
|
+
return realInstance.getAttrs().locked ?? false;
|
|
16886
16960
|
}
|
|
16887
16961
|
};
|
|
16888
16962
|
|
|
@@ -16890,6 +16964,11 @@ var WeaveNode = class {
|
|
|
16890
16964
|
//#region src/actions/action.ts
|
|
16891
16965
|
var WeaveAction = class {
|
|
16892
16966
|
constructor() {
|
|
16967
|
+
this.tapStart = {
|
|
16968
|
+
x: 0,
|
|
16969
|
+
y: 0,
|
|
16970
|
+
time: 0
|
|
16971
|
+
};
|
|
16893
16972
|
return new Proxy(this, { set: (target, key, value) => {
|
|
16894
16973
|
Reflect.set(target, key, value);
|
|
16895
16974
|
this.onPropsChange?.();
|
|
@@ -16921,6 +17000,26 @@ var WeaveAction = class {
|
|
|
16921
17000
|
getProps() {
|
|
16922
17001
|
return this.props;
|
|
16923
17002
|
}
|
|
17003
|
+
isPressed(e) {
|
|
17004
|
+
return e.evt.buttons > 0;
|
|
17005
|
+
}
|
|
17006
|
+
setTapStart(e) {
|
|
17007
|
+
this.tapStart = {
|
|
17008
|
+
x: e.evt.clientX,
|
|
17009
|
+
y: e.evt.clientY,
|
|
17010
|
+
time: performance.now()
|
|
17011
|
+
};
|
|
17012
|
+
}
|
|
17013
|
+
isTap(e) {
|
|
17014
|
+
if (!this.tapStart) return false;
|
|
17015
|
+
const dx = e.evt.clientX - this.tapStart.x;
|
|
17016
|
+
const dy = e.evt.clientY - this.tapStart.y;
|
|
17017
|
+
const dist = Math.sqrt(dx * dx + dy * dy);
|
|
17018
|
+
const dt = performance.now() - this.tapStart.time;
|
|
17019
|
+
const TAP_DISTANCE = 10;
|
|
17020
|
+
const TAP_TIME = 300;
|
|
17021
|
+
return (e.evt.pointerType === "pen" || e.evt.pointerType === "touch") && dist < TAP_DISTANCE && dt < TAP_TIME;
|
|
17022
|
+
}
|
|
16924
17023
|
};
|
|
16925
17024
|
|
|
16926
17025
|
//#endregion
|
|
@@ -17976,23 +18075,30 @@ var WeaveZIndexManager = class {
|
|
|
17976
18075
|
this.instance.moveNode(node, WEAVE_NODE_POSITION.DOWN);
|
|
17977
18076
|
}
|
|
17978
18077
|
}
|
|
17979
|
-
sendToBack(
|
|
17980
|
-
|
|
17981
|
-
|
|
17982
|
-
const
|
|
17983
|
-
|
|
17984
|
-
const
|
|
17985
|
-
|
|
18078
|
+
sendToBack(instances) {
|
|
18079
|
+
const nodes = Array.isArray(instances) ? instances : [instances];
|
|
18080
|
+
const nodesDescending = nodes.toSorted((a, b) => b.zIndex() - a.zIndex());
|
|
18081
|
+
for (const node of nodesDescending) {
|
|
18082
|
+
node.moveToBottom();
|
|
18083
|
+
const handler = this.instance.getNodeHandler(node.getAttrs().nodeType);
|
|
18084
|
+
if (handler) {
|
|
18085
|
+
const nodeState = handler.serialize(node);
|
|
18086
|
+
this.instance.updateNode(nodeState);
|
|
18087
|
+
this.instance.moveNode(nodeState, WEAVE_NODE_POSITION.BACK);
|
|
18088
|
+
}
|
|
17986
18089
|
}
|
|
17987
18090
|
}
|
|
17988
|
-
bringToFront(
|
|
17989
|
-
|
|
17990
|
-
|
|
17991
|
-
const
|
|
17992
|
-
|
|
17993
|
-
const
|
|
17994
|
-
|
|
17995
|
-
|
|
18091
|
+
bringToFront(instances) {
|
|
18092
|
+
const nodes = Array.isArray(instances) ? instances : [instances];
|
|
18093
|
+
const nodesAscending = nodes.toSorted((a, b) => a.zIndex() - b.zIndex());
|
|
18094
|
+
for (const node of nodesAscending) {
|
|
18095
|
+
node.moveToTop();
|
|
18096
|
+
const handler = this.instance.getNodeHandler(node.getAttrs().nodeType);
|
|
18097
|
+
if (handler) {
|
|
18098
|
+
const nodeState = handler.serialize(node);
|
|
18099
|
+
this.instance.updateNode(nodeState);
|
|
18100
|
+
this.instance.moveNode(nodeState, WEAVE_NODE_POSITION.FRONT);
|
|
18101
|
+
}
|
|
17996
18102
|
}
|
|
17997
18103
|
}
|
|
17998
18104
|
};
|
|
@@ -18064,7 +18170,7 @@ var WeaveStateManager = class {
|
|
|
18064
18170
|
};
|
|
18065
18171
|
return this.findNodeById(state, nodeKey);
|
|
18066
18172
|
}
|
|
18067
|
-
addNode(node, parentId = "mainLayer", index = void 0
|
|
18173
|
+
addNode(node, parentId = "mainLayer", index = void 0) {
|
|
18068
18174
|
const userName = this.instance.getStore().getUser().name;
|
|
18069
18175
|
this.instance.getStore().getDocument().transact(() => {
|
|
18070
18176
|
const state = this.instance.getStore().getState();
|
|
@@ -18072,8 +18178,7 @@ var WeaveStateManager = class {
|
|
|
18072
18178
|
const msg = `State is empty, cannot add the node`;
|
|
18073
18179
|
this.logger.warn({
|
|
18074
18180
|
node,
|
|
18075
|
-
parentId
|
|
18076
|
-
doRender
|
|
18181
|
+
parentId
|
|
18077
18182
|
}, msg);
|
|
18078
18183
|
return;
|
|
18079
18184
|
}
|
|
@@ -18082,8 +18187,7 @@ var WeaveStateManager = class {
|
|
|
18082
18187
|
const msg = `Node with key [${node.key}] already exists, cannot add it`;
|
|
18083
18188
|
this.logger.warn({
|
|
18084
18189
|
node,
|
|
18085
|
-
parentId
|
|
18086
|
-
doRender
|
|
18190
|
+
parentId
|
|
18087
18191
|
}, msg);
|
|
18088
18192
|
return;
|
|
18089
18193
|
}
|
|
@@ -18092,8 +18196,7 @@ var WeaveStateManager = class {
|
|
|
18092
18196
|
const msg = `Parent container with key [${node.key}] doesn't exists, cannot add it`;
|
|
18093
18197
|
this.logger.warn({
|
|
18094
18198
|
node,
|
|
18095
|
-
parentId
|
|
18096
|
-
doRender
|
|
18199
|
+
parentId
|
|
18097
18200
|
}, msg);
|
|
18098
18201
|
return;
|
|
18099
18202
|
}
|
|
@@ -18123,28 +18226,21 @@ var WeaveStateManager = class {
|
|
|
18123
18226
|
parent.props.children.push(finalNode);
|
|
18124
18227
|
}
|
|
18125
18228
|
this.instance.emitEvent("onNodeAdded", node);
|
|
18126
|
-
if (doRender) this.instance.render();
|
|
18127
18229
|
}, userName);
|
|
18128
18230
|
}
|
|
18129
|
-
updateNode(node
|
|
18231
|
+
updateNode(node) {
|
|
18130
18232
|
const userName = this.instance.getStore().getUser().name;
|
|
18131
18233
|
this.instance.getStore().getDocument().transact(() => {
|
|
18132
18234
|
const state = this.instance.getStore().getState();
|
|
18133
18235
|
if ((0, import_lodash.isEmpty)(state.weave)) {
|
|
18134
18236
|
const msg = `State is empty, cannot update the node`;
|
|
18135
|
-
this.logger.warn({
|
|
18136
|
-
node,
|
|
18137
|
-
doRender
|
|
18138
|
-
}, msg);
|
|
18237
|
+
this.logger.warn({ node }, msg);
|
|
18139
18238
|
return;
|
|
18140
18239
|
}
|
|
18141
18240
|
const { node: nodeState } = this.findNodeById(state.weave, node.key);
|
|
18142
18241
|
if (!nodeState) {
|
|
18143
18242
|
const msg = `Node with key [${node.key}] doesn't exists, cannot update it`;
|
|
18144
|
-
this.logger.warn({
|
|
18145
|
-
node,
|
|
18146
|
-
doRender
|
|
18147
|
-
}, msg);
|
|
18243
|
+
this.logger.warn({ node }, msg);
|
|
18148
18244
|
return;
|
|
18149
18245
|
}
|
|
18150
18246
|
const nodeNew = JSON.parse(JSON.stringify({
|
|
@@ -18153,28 +18249,21 @@ var WeaveStateManager = class {
|
|
|
18153
18249
|
}));
|
|
18154
18250
|
nodeState.props = { ...nodeNew };
|
|
18155
18251
|
this.instance.emitEvent("onNodeUpdated", node);
|
|
18156
|
-
if (doRender) this.instance.render();
|
|
18157
18252
|
}, userName);
|
|
18158
18253
|
}
|
|
18159
|
-
removeNode(node
|
|
18254
|
+
removeNode(node) {
|
|
18160
18255
|
const userName = this.instance.getStore().getUser().name;
|
|
18161
18256
|
this.instance.getStore().getDocument().transact(() => {
|
|
18162
18257
|
const state = this.instance.getStore().getState();
|
|
18163
18258
|
if ((0, import_lodash.isEmpty)(state.weave)) {
|
|
18164
18259
|
const msg = `State is empty, cannot update the node`;
|
|
18165
|
-
this.logger.warn({
|
|
18166
|
-
node,
|
|
18167
|
-
doRender
|
|
18168
|
-
}, msg);
|
|
18260
|
+
this.logger.warn({ node }, msg);
|
|
18169
18261
|
return;
|
|
18170
18262
|
}
|
|
18171
18263
|
const { node: nodeState, parent: parentState } = this.findNodeById(state.weave, node.key);
|
|
18172
18264
|
if (!nodeState) {
|
|
18173
18265
|
const msg = `Node with key [${node.key}] doesn't exists, cannot remove it`;
|
|
18174
|
-
this.logger.warn({
|
|
18175
|
-
node,
|
|
18176
|
-
doRender
|
|
18177
|
-
}, msg);
|
|
18266
|
+
this.logger.warn({ node }, msg);
|
|
18178
18267
|
return;
|
|
18179
18268
|
}
|
|
18180
18269
|
if (parentState) {
|
|
@@ -18183,32 +18272,24 @@ var WeaveStateManager = class {
|
|
|
18183
18272
|
parentState.props.children = filteredChildren;
|
|
18184
18273
|
}
|
|
18185
18274
|
this.instance.emitEvent("onNodeRemoved", node);
|
|
18186
|
-
if (doRender) this.instance.render();
|
|
18187
18275
|
}, userName);
|
|
18188
18276
|
}
|
|
18189
|
-
removeNodes(nodes
|
|
18190
|
-
for (const node of nodes) this.removeNode(node
|
|
18191
|
-
if (doRender) this.instance.render();
|
|
18277
|
+
removeNodes(nodes) {
|
|
18278
|
+
for (const node of nodes) this.removeNode(node);
|
|
18192
18279
|
}
|
|
18193
|
-
moveNode(node, position
|
|
18280
|
+
moveNode(node, position) {
|
|
18194
18281
|
const userName = this.instance.getStore().getUser().name;
|
|
18195
18282
|
this.instance.getStore().getDocument().transact(() => {
|
|
18196
18283
|
const state = this.instance.getStore().getState();
|
|
18197
18284
|
if ((0, import_lodash.isEmpty)(state.weave)) {
|
|
18198
18285
|
const msg = `State is empty, cannot update the node`;
|
|
18199
|
-
this.logger.warn({
|
|
18200
|
-
node,
|
|
18201
|
-
doRender
|
|
18202
|
-
}, msg);
|
|
18286
|
+
this.logger.warn({ node }, msg);
|
|
18203
18287
|
return;
|
|
18204
18288
|
}
|
|
18205
18289
|
const { node: nodeState, parent: nodeParent } = this.findNodeById(state.weave, node.key);
|
|
18206
18290
|
if (!nodeState) {
|
|
18207
18291
|
const msg = `Node with key [${node.key}] doesn't exists, cannot update it`;
|
|
18208
|
-
this.logger.warn({
|
|
18209
|
-
node,
|
|
18210
|
-
doRender
|
|
18211
|
-
}, msg);
|
|
18292
|
+
this.logger.warn({ node }, msg);
|
|
18212
18293
|
return;
|
|
18213
18294
|
}
|
|
18214
18295
|
if (nodeParent) {
|
|
@@ -18232,7 +18313,6 @@ var WeaveStateManager = class {
|
|
|
18232
18313
|
});
|
|
18233
18314
|
if (!nodeParent.props.children) nodeParent.props.children = [];
|
|
18234
18315
|
nodeParent.props.children = nodeParentNewChildren;
|
|
18235
|
-
if (doRender) this.instance.render();
|
|
18236
18316
|
}
|
|
18237
18317
|
}, userName);
|
|
18238
18318
|
}
|
|
@@ -18318,7 +18398,7 @@ var WeaveRegisterManager = class {
|
|
|
18318
18398
|
|
|
18319
18399
|
//#endregion
|
|
18320
18400
|
//#region package.json
|
|
18321
|
-
var version = "0.
|
|
18401
|
+
var version = "0.38.0";
|
|
18322
18402
|
|
|
18323
18403
|
//#endregion
|
|
18324
18404
|
//#region src/managers/setup.ts
|
|
@@ -18860,31 +18940,27 @@ var Weave = class {
|
|
|
18860
18940
|
getNode(nodeKey) {
|
|
18861
18941
|
return this.stateManager.getNode(nodeKey);
|
|
18862
18942
|
}
|
|
18863
|
-
addNode(node, parentId = "mainLayer", index = void 0
|
|
18864
|
-
this.stateManager.addNode(node, parentId, index
|
|
18943
|
+
addNode(node, parentId = "mainLayer", index = void 0) {
|
|
18944
|
+
this.stateManager.addNode(node, parentId, index);
|
|
18865
18945
|
}
|
|
18866
|
-
updateNode(node
|
|
18867
|
-
this.stateManager.updateNode(node
|
|
18946
|
+
updateNode(node) {
|
|
18947
|
+
this.stateManager.updateNode(node);
|
|
18868
18948
|
}
|
|
18869
|
-
updateNodes(nodes
|
|
18870
|
-
for (const node of nodes) this.updateNode(node
|
|
18871
|
-
const selectionPlugin = this.getPlugin("nodesSelection");
|
|
18872
|
-
if (selectionPlugin) selectionPlugin.setSelectedNodes([]);
|
|
18873
|
-
if (doRender) this.render();
|
|
18949
|
+
updateNodes(nodes) {
|
|
18950
|
+
for (const node of nodes) this.updateNode(node);
|
|
18874
18951
|
}
|
|
18875
|
-
removeNode(node
|
|
18876
|
-
this.stateManager.removeNode(node
|
|
18952
|
+
removeNode(node) {
|
|
18953
|
+
this.stateManager.removeNode(node);
|
|
18877
18954
|
const selectionPlugin = this.getPlugin("nodesSelection");
|
|
18878
18955
|
if (selectionPlugin) selectionPlugin.setSelectedNodes([]);
|
|
18879
18956
|
}
|
|
18880
|
-
removeNodes(nodes
|
|
18881
|
-
for (const node of nodes) this.removeNode(node
|
|
18957
|
+
removeNodes(nodes) {
|
|
18958
|
+
for (const node of nodes) this.removeNode(node);
|
|
18882
18959
|
const selectionPlugin = this.getPlugin("nodesSelection");
|
|
18883
18960
|
if (selectionPlugin) selectionPlugin.setSelectedNodes([]);
|
|
18884
|
-
if (doRender) this.render();
|
|
18885
18961
|
}
|
|
18886
|
-
moveNode(node, position
|
|
18887
|
-
this.stateManager.moveNode(node, position
|
|
18962
|
+
moveNode(node, position) {
|
|
18963
|
+
this.stateManager.moveNode(node, position);
|
|
18888
18964
|
}
|
|
18889
18965
|
getElementsTree() {
|
|
18890
18966
|
return this.stateManager.getElementsTree();
|
|
@@ -18898,11 +18974,11 @@ var Weave = class {
|
|
|
18898
18974
|
moveDown(node) {
|
|
18899
18975
|
this.zIndexManager.moveDown(node);
|
|
18900
18976
|
}
|
|
18901
|
-
sendToBack(
|
|
18902
|
-
this.zIndexManager.sendToBack(
|
|
18977
|
+
sendToBack(nodes) {
|
|
18978
|
+
this.zIndexManager.sendToBack(nodes);
|
|
18903
18979
|
}
|
|
18904
|
-
bringToFront(
|
|
18905
|
-
this.zIndexManager.bringToFront(
|
|
18980
|
+
bringToFront(nodes) {
|
|
18981
|
+
this.zIndexManager.bringToFront(nodes);
|
|
18906
18982
|
}
|
|
18907
18983
|
group(nodes) {
|
|
18908
18984
|
this.groupsManager.group(nodes);
|
|
@@ -19417,7 +19493,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
19417
19493
|
text.on("transformstart", (e) => {
|
|
19418
19494
|
this.instance.emitEvent("onTransform", e.target);
|
|
19419
19495
|
});
|
|
19420
|
-
text.on("transform", (0, import_lodash
|
|
19496
|
+
text.on("transform", (0, import_lodash.throttle)(handleTextTransform, 50));
|
|
19421
19497
|
text.on("transformend", () => {
|
|
19422
19498
|
this.instance.emitEvent("onTransform", null);
|
|
19423
19499
|
});
|
|
@@ -19661,7 +19737,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
19661
19737
|
}
|
|
19662
19738
|
const measures = textNode.measureSize(textNode.text());
|
|
19663
19739
|
const px = 0 * stage.scaleX();
|
|
19664
|
-
const py =
|
|
19740
|
+
const py = measures.actualBoundingBoxDescent * stage.scaleY();
|
|
19665
19741
|
let transform = "";
|
|
19666
19742
|
transform += "translateX(" + px + "px)";
|
|
19667
19743
|
transform += "translateY(" + py + "px)";
|
|
@@ -20613,7 +20689,6 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
20613
20689
|
const imageProps = params;
|
|
20614
20690
|
const imagePlaceholder = image.findOne(`#${imageProps.id}-placeholder`);
|
|
20615
20691
|
const internalImage = image.findOne(`#${imageProps.id}-image`);
|
|
20616
|
-
console.log("crossOrigin", this.config.crossOrigin);
|
|
20617
20692
|
const imageObj = new Image();
|
|
20618
20693
|
imageObj.crossOrigin = this.config.crossOrigin;
|
|
20619
20694
|
imageObj.onerror = (error) => {
|
|
@@ -20670,7 +20745,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
20670
20745
|
const stage = this.instance.getStage();
|
|
20671
20746
|
const image = stage.findOne(`#${imageAttrs.id}`);
|
|
20672
20747
|
const internalImage = image?.findOne(`#${imageAttrs.id}-image`);
|
|
20673
|
-
if (image && internalImage && !imageAttrs.adding && imageAttrs.cropInfo && !(0, import_lodash
|
|
20748
|
+
if (image && internalImage && !imageAttrs.adding && imageAttrs.cropInfo && !(0, import_lodash.isEqual)(imageAttrs.cropInfo, this.cachedCropInfo[imageAttrs.id ?? ""])) {
|
|
20674
20749
|
const actualScale = imageAttrs.uncroppedImage.width / imageAttrs.imageInfo.width;
|
|
20675
20750
|
internalImage.width(imageAttrs.uncroppedImage.width);
|
|
20676
20751
|
internalImage.height(imageAttrs.uncroppedImage.height);
|
|
@@ -20687,7 +20762,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
20687
20762
|
internalImage.height(imageAttrs.cropSize.height);
|
|
20688
20763
|
this.cachedCropInfo[imageAttrs.id ?? ""] = imageAttrs.cropInfo;
|
|
20689
20764
|
}
|
|
20690
|
-
if (image && internalImage && !imageAttrs.adding && !imageAttrs.cropInfo && !(0, import_lodash
|
|
20765
|
+
if (image && internalImage && !imageAttrs.adding && !imageAttrs.cropInfo && !(0, import_lodash.isEqual)(imageAttrs.cropInfo, this.cachedCropInfo[imageAttrs.id ?? ""])) {
|
|
20691
20766
|
internalImage.width(imageAttrs.uncroppedImage.width);
|
|
20692
20767
|
internalImage.height(imageAttrs.uncroppedImage.height);
|
|
20693
20768
|
internalImage.rotation(0);
|
|
@@ -21048,7 +21123,28 @@ var WeaveFrameNode = class extends WeaveNode {
|
|
|
21048
21123
|
width: props.frameWidth,
|
|
21049
21124
|
height: props.frameHeight,
|
|
21050
21125
|
fill: "transparent",
|
|
21051
|
-
draggable:
|
|
21126
|
+
draggable: true
|
|
21127
|
+
});
|
|
21128
|
+
selectorArea.on("dragmove", () => {
|
|
21129
|
+
if (this.isSelecting() && this.isNodeSelected(selectorArea)) {
|
|
21130
|
+
clearContainerTargets(this.instance);
|
|
21131
|
+
frame.setAbsolutePosition(selectorArea.getAbsolutePosition());
|
|
21132
|
+
selectorArea.setAttrs({
|
|
21133
|
+
x: 0,
|
|
21134
|
+
y: 0
|
|
21135
|
+
});
|
|
21136
|
+
}
|
|
21137
|
+
});
|
|
21138
|
+
selectorArea.on("dragend", () => {
|
|
21139
|
+
if (this.isSelecting() && this.isNodeSelected(selectorArea)) {
|
|
21140
|
+
clearContainerTargets(this.instance);
|
|
21141
|
+
frame.setAbsolutePosition(selectorArea.getAbsolutePosition());
|
|
21142
|
+
selectorArea.setAttrs({
|
|
21143
|
+
x: 0,
|
|
21144
|
+
y: 0
|
|
21145
|
+
});
|
|
21146
|
+
this.instance.updateNode(this.serialize(selectorArea));
|
|
21147
|
+
}
|
|
21052
21148
|
});
|
|
21053
21149
|
selectorArea.getTransformerProperties = () => {
|
|
21054
21150
|
return this.config.transform;
|
|
@@ -21059,7 +21155,6 @@ var WeaveFrameNode = class extends WeaveNode {
|
|
|
21059
21155
|
x: 0,
|
|
21060
21156
|
y: 0
|
|
21061
21157
|
});
|
|
21062
|
-
this.instance.updateNode(this.serialize(selectorArea));
|
|
21063
21158
|
};
|
|
21064
21159
|
const updateFrame = (e) => {
|
|
21065
21160
|
const selectorArea$1 = e.target;
|
|
@@ -21105,7 +21200,7 @@ var WeaveFrameNode = class extends WeaveNode {
|
|
|
21105
21200
|
selectorArea.on("transformend", (e) => {
|
|
21106
21201
|
this.instance.emitEvent("onTransform", e.target);
|
|
21107
21202
|
});
|
|
21108
|
-
selectorArea.on("transform", (0, import_lodash
|
|
21203
|
+
selectorArea.on("transform", (0, import_lodash.throttle)(handleSelectorAreaTransform, 50));
|
|
21109
21204
|
selectorArea.on("transformend", (e) => {
|
|
21110
21205
|
this.instance.emitEvent("onTransform", null);
|
|
21111
21206
|
const nodesSnappingPlugin = this.instance.getPlugin("nodesSnapping");
|
|
@@ -21130,17 +21225,18 @@ var WeaveFrameNode = class extends WeaveNode {
|
|
|
21130
21225
|
width: props.frameWidth - borderWidth * 2,
|
|
21131
21226
|
height: props.frameHeight - borderWidth * 2,
|
|
21132
21227
|
strokeScaleEnabled: true,
|
|
21228
|
+
clipFunc: (ctx) => {
|
|
21229
|
+
const width = (frameInternal.width() + borderWidth) * frameInternal.scaleX();
|
|
21230
|
+
const height = (frameInternal.height() + borderWidth) * frameInternal.scaleY();
|
|
21231
|
+
ctx.rect(-(borderWidth / 2) * frameInternal.scaleX(), -(borderWidth / 2) * frameInternal.scaleY(), width, height);
|
|
21232
|
+
},
|
|
21133
21233
|
draggable: false
|
|
21134
21234
|
});
|
|
21135
|
-
frameInternal.clipFunc((ctx) => {
|
|
21136
|
-
const width = (frameInternal.width() + borderWidth) * frameInternal.scaleX();
|
|
21137
|
-
const height = (frameInternal.height() + borderWidth) * frameInternal.scaleY();
|
|
21138
|
-
ctx.rect(-(borderWidth / 2) * frameInternal.scaleX(), -(borderWidth / 2) * frameInternal.scaleY(), width, height);
|
|
21139
|
-
});
|
|
21140
21235
|
frameInternalGroup.add(frameInternal);
|
|
21141
21236
|
this.setupDefaultNodeEvents(frame);
|
|
21142
|
-
frame.
|
|
21143
|
-
frame.
|
|
21237
|
+
frame.off("dragstart");
|
|
21238
|
+
frame.off("dragmove");
|
|
21239
|
+
frame.off("dragend");
|
|
21144
21240
|
frame.on(WEAVE_NODE_CUSTOM_EVENTS.onTargetLeave, () => {
|
|
21145
21241
|
background.setAttrs({
|
|
21146
21242
|
stroke: onTargetLeaveBorderColor,
|
|
@@ -21248,10 +21344,125 @@ var WeaveFrameNode = class extends WeaveNode {
|
|
|
21248
21344
|
}
|
|
21249
21345
|
};
|
|
21250
21346
|
|
|
21347
|
+
//#endregion
|
|
21348
|
+
//#region src/nodes/stroke/constants.ts
|
|
21349
|
+
const WEAVE_STROKE_NODE_TYPE = "stroke";
|
|
21350
|
+
|
|
21351
|
+
//#endregion
|
|
21352
|
+
//#region src/nodes/stroke/stroke.ts
|
|
21353
|
+
var WeaveStrokeNode = class extends WeaveNode {
|
|
21354
|
+
nodeType = WEAVE_STROKE_NODE_TYPE;
|
|
21355
|
+
constructor(params) {
|
|
21356
|
+
super();
|
|
21357
|
+
const { config } = params ?? {};
|
|
21358
|
+
this.config = { transform: {
|
|
21359
|
+
...WEAVE_DEFAULT_TRANSFORM_PROPERTIES,
|
|
21360
|
+
...config?.transform
|
|
21361
|
+
} };
|
|
21362
|
+
}
|
|
21363
|
+
drawStroke(strokeElements, context, shape) {
|
|
21364
|
+
context.strokeStyle = shape.getAttrs().stroke ?? "black";
|
|
21365
|
+
context.lineCap = "round";
|
|
21366
|
+
context.lineJoin = "round";
|
|
21367
|
+
const l = strokeElements.length - 1;
|
|
21368
|
+
if (strokeElements.length >= 3) {
|
|
21369
|
+
const xc = (strokeElements[l].x + strokeElements[l - 1].x) / 2;
|
|
21370
|
+
const yc = (strokeElements[l].y + strokeElements[l - 1].y) / 2;
|
|
21371
|
+
context.lineWidth = strokeElements[l - 1].lineWidth;
|
|
21372
|
+
context.quadraticCurveTo(strokeElements[l - 1].x, strokeElements[l - 1].y, xc, yc);
|
|
21373
|
+
context.stroke();
|
|
21374
|
+
context.beginPath();
|
|
21375
|
+
context.moveTo(xc, yc);
|
|
21376
|
+
} else {
|
|
21377
|
+
const point = strokeElements[l];
|
|
21378
|
+
context.lineWidth = point.lineWidth;
|
|
21379
|
+
context.beginPath();
|
|
21380
|
+
context.moveTo(point.x, point.y);
|
|
21381
|
+
context.stroke();
|
|
21382
|
+
}
|
|
21383
|
+
}
|
|
21384
|
+
onRender(props) {
|
|
21385
|
+
const stroke = new Konva.Shape({
|
|
21386
|
+
...props,
|
|
21387
|
+
name: "node",
|
|
21388
|
+
sceneFunc: (context, shape) => {
|
|
21389
|
+
context.beginPath();
|
|
21390
|
+
const strokeElements = shape.getAttrs().strokeElements;
|
|
21391
|
+
const strokePath = [];
|
|
21392
|
+
strokeElements.forEach((point) => {
|
|
21393
|
+
strokePath.push(point);
|
|
21394
|
+
this.drawStroke(strokePath, context, shape);
|
|
21395
|
+
});
|
|
21396
|
+
},
|
|
21397
|
+
hitFunc: (context, shape) => {
|
|
21398
|
+
context.beginPath();
|
|
21399
|
+
context.rect(0, 0, shape.width(), shape.height());
|
|
21400
|
+
context.closePath();
|
|
21401
|
+
context.fillStrokeShape(shape);
|
|
21402
|
+
}
|
|
21403
|
+
});
|
|
21404
|
+
this.setupDefaultNodeAugmentation(stroke);
|
|
21405
|
+
stroke.getTransformerProperties = () => {
|
|
21406
|
+
return this.config.transform;
|
|
21407
|
+
};
|
|
21408
|
+
this.setupDefaultNodeEvents(stroke);
|
|
21409
|
+
return stroke;
|
|
21410
|
+
}
|
|
21411
|
+
onUpdate(nodeInstance, nextProps) {
|
|
21412
|
+
nodeInstance.setAttrs({ ...nextProps });
|
|
21413
|
+
const nodesSelectionPlugin = this.instance.getPlugin("nodesSelection");
|
|
21414
|
+
if (nodesSelectionPlugin) nodesSelectionPlugin.getTransformer().forceUpdate();
|
|
21415
|
+
}
|
|
21416
|
+
scaleReset(node) {
|
|
21417
|
+
const strokeNode = node;
|
|
21418
|
+
const oldPoints = [...strokeNode.getAttrs().strokeElements];
|
|
21419
|
+
const newPoints = [];
|
|
21420
|
+
for (const actPoint of oldPoints) {
|
|
21421
|
+
const point = {
|
|
21422
|
+
...actPoint,
|
|
21423
|
+
x: actPoint.x * strokeNode.scaleX(),
|
|
21424
|
+
y: actPoint.y * strokeNode.scaleY()
|
|
21425
|
+
};
|
|
21426
|
+
newPoints.push(point);
|
|
21427
|
+
}
|
|
21428
|
+
strokeNode.setAttrs({ strokeElements: newPoints });
|
|
21429
|
+
node.width(Math.max(5, node.width() * node.scaleX()));
|
|
21430
|
+
node.height(Math.max(5, node.height() * node.scaleY()));
|
|
21431
|
+
node.scaleX(1);
|
|
21432
|
+
node.scaleY(1);
|
|
21433
|
+
}
|
|
21434
|
+
serialize(instance) {
|
|
21435
|
+
const attrs = instance.getAttrs();
|
|
21436
|
+
const cleanedAttrs = { ...attrs };
|
|
21437
|
+
delete cleanedAttrs.draggable;
|
|
21438
|
+
delete cleanedAttrs.sceneFunc;
|
|
21439
|
+
delete cleanedAttrs.hitFunc;
|
|
21440
|
+
return {
|
|
21441
|
+
key: attrs.id ?? "",
|
|
21442
|
+
type: attrs.nodeType,
|
|
21443
|
+
props: {
|
|
21444
|
+
...cleanedAttrs,
|
|
21445
|
+
id: attrs.id ?? "",
|
|
21446
|
+
nodeType: attrs.nodeType,
|
|
21447
|
+
children: []
|
|
21448
|
+
}
|
|
21449
|
+
};
|
|
21450
|
+
}
|
|
21451
|
+
};
|
|
21452
|
+
|
|
21251
21453
|
//#endregion
|
|
21252
21454
|
//#region src/plugins/stage-zoom/constants.ts
|
|
21455
|
+
const WEAVE_STAGE_ZOOM_TYPE = {
|
|
21456
|
+
MOUSE_WHEEL: "mouseWheel",
|
|
21457
|
+
PINCH_ZOOM: "pinchZoom"
|
|
21458
|
+
};
|
|
21253
21459
|
const WEAVE_STAGE_ZOOM_KEY = "stageZoom";
|
|
21254
21460
|
const WEAVE_STAGE_ZOOM_DEFAULT_CONFIG = {
|
|
21461
|
+
zoomInertia: {
|
|
21462
|
+
friction: .9,
|
|
21463
|
+
mouseWheelStep: .01,
|
|
21464
|
+
trackpadStep: .005
|
|
21465
|
+
},
|
|
21255
21466
|
zoomSteps: [
|
|
21256
21467
|
.01,
|
|
21257
21468
|
.05,
|
|
@@ -22948,22 +23159,30 @@ var require_hammer = __commonJS({ "../../node_modules/hammerjs/hammer.js"(export
|
|
|
22948
23159
|
else window$1[exportName] = Hammer;
|
|
22949
23160
|
})(window, document, "Hammer");
|
|
22950
23161
|
} });
|
|
22951
|
-
var import_hammer = __toESM(require_hammer());
|
|
23162
|
+
var import_hammer = __toESM(require_hammer(), 1);
|
|
22952
23163
|
|
|
22953
23164
|
//#endregion
|
|
22954
23165
|
//#region src/plugins/stage-zoom/stage-zoom.ts
|
|
22955
23166
|
var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
22956
23167
|
getLayerName = void 0;
|
|
22957
23168
|
initLayer = void 0;
|
|
23169
|
+
zooming = false;
|
|
23170
|
+
isTrackpad = false;
|
|
23171
|
+
zoomVelocity = 0;
|
|
23172
|
+
zoomInertiaType = WEAVE_STAGE_ZOOM_TYPE.MOUSE_WHEEL;
|
|
23173
|
+
initialScale = 0;
|
|
23174
|
+
lastTime = 0;
|
|
23175
|
+
center = {
|
|
23176
|
+
x: 0,
|
|
23177
|
+
y: 0
|
|
23178
|
+
};
|
|
22958
23179
|
defaultStep = 3;
|
|
22959
23180
|
constructor(params) {
|
|
22960
23181
|
super();
|
|
22961
23182
|
const { config } = params ?? {};
|
|
22962
|
-
this.config =
|
|
22963
|
-
...WEAVE_STAGE_ZOOM_DEFAULT_CONFIG,
|
|
22964
|
-
...config
|
|
22965
|
-
};
|
|
23183
|
+
this.config = (0, import_lodash.merge)(WEAVE_STAGE_ZOOM_DEFAULT_CONFIG, config);
|
|
22966
23184
|
if (!this.config.zoomSteps.includes(this.config.defaultZoom)) throw new Error(`Default zoom ${this.config.defaultZoom} is not in zoom steps`);
|
|
23185
|
+
this.isTrackpad = false;
|
|
22967
23186
|
this.isCtrlOrMetaPressed = false;
|
|
22968
23187
|
this.updatedMinimumZoom = false;
|
|
22969
23188
|
this.actualStep = this.config.zoomSteps.findIndex((step) => step === this.config.defaultZoom);
|
|
@@ -22988,7 +23207,7 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
22988
23207
|
this.config.zoomSteps = [minimumZoom, ...this.config.zoomSteps];
|
|
22989
23208
|
}
|
|
22990
23209
|
};
|
|
22991
|
-
mainLayer?.on("draw", (0, import_lodash
|
|
23210
|
+
mainLayer?.on("draw", (0, import_lodash.throttle)(handleDraw, 50));
|
|
22992
23211
|
this.setZoom(this.config.zoomSteps[this.actualStep]);
|
|
22993
23212
|
}
|
|
22994
23213
|
setZoom(scale, centered = true, pointer) {
|
|
@@ -23216,38 +23435,68 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
23216
23435
|
threshold: 0,
|
|
23217
23436
|
pointers: 2
|
|
23218
23437
|
}));
|
|
23219
|
-
|
|
23220
|
-
|
|
23221
|
-
|
|
23222
|
-
|
|
23223
|
-
|
|
23224
|
-
sc.on("pinchstart", (ev) => {
|
|
23225
|
-
initialScale = stage.scaleX();
|
|
23226
|
-
center = {
|
|
23227
|
-
x: ev.center.x,
|
|
23228
|
-
y: ev.center.y
|
|
23438
|
+
sc.on("pinchstart", (e) => {
|
|
23439
|
+
this.initialScale = this.instance.getStage().scaleX();
|
|
23440
|
+
this.center = {
|
|
23441
|
+
x: e.center.x,
|
|
23442
|
+
y: e.center.y
|
|
23229
23443
|
};
|
|
23444
|
+
this.lastTime = performance.now();
|
|
23445
|
+
});
|
|
23446
|
+
sc.on("pinchmove", (e) => {
|
|
23447
|
+
const now = performance.now();
|
|
23448
|
+
const newScale = Math.max(this.config.zoomSteps[0], Math.min(this.config.zoomSteps[this.config.zoomSteps.length - 1], this.initialScale * e.scale));
|
|
23449
|
+
this.setZoom(newScale, false, this.center);
|
|
23450
|
+
const dt = now - this.lastTime;
|
|
23451
|
+
this.zoomVelocity = (newScale - 1) / (dt * 16.6);
|
|
23452
|
+
this.lastTime = now;
|
|
23230
23453
|
});
|
|
23231
|
-
sc.on("
|
|
23232
|
-
|
|
23233
|
-
|
|
23234
|
-
this.
|
|
23454
|
+
sc.on("pinchend", () => {
|
|
23455
|
+
this.zooming = true;
|
|
23456
|
+
this.zoomInertiaType = WEAVE_STAGE_ZOOM_TYPE.PINCH_ZOOM;
|
|
23457
|
+
requestAnimationFrame(this.zoomTick.bind(this));
|
|
23235
23458
|
});
|
|
23236
23459
|
const handleWheel = (e) => {
|
|
23237
23460
|
e.evt.preventDefault();
|
|
23238
23461
|
const stage$1 = this.instance.getStage();
|
|
23239
23462
|
const performZoom = this.isCtrlOrMetaPressed || !this.isCtrlOrMetaPressed && e.evt.ctrlKey && e.evt.deltaMode === 0;
|
|
23240
23463
|
if (!this.enabled || !stage$1.isFocused() || !performZoom) return;
|
|
23241
|
-
const
|
|
23242
|
-
|
|
23243
|
-
|
|
23244
|
-
|
|
23245
|
-
|
|
23246
|
-
|
|
23247
|
-
|
|
23464
|
+
const delta = e.evt.deltaY > 0 ? 1 : -1;
|
|
23465
|
+
this.zoomVelocity += delta;
|
|
23466
|
+
this.isTrackpad = Math.abs(e.evt.deltaY) < 15 && e.evt.deltaMode === 0;
|
|
23467
|
+
if (!this.zooming) {
|
|
23468
|
+
this.zooming = true;
|
|
23469
|
+
this.zoomInertiaType = WEAVE_STAGE_ZOOM_TYPE.MOUSE_WHEEL;
|
|
23470
|
+
requestAnimationFrame(this.zoomTick.bind(this));
|
|
23471
|
+
}
|
|
23248
23472
|
};
|
|
23249
23473
|
stage.on("wheel", handleWheel);
|
|
23250
23474
|
}
|
|
23475
|
+
getInertiaScale() {
|
|
23476
|
+
const stage = this.instance.getStage();
|
|
23477
|
+
let step = 1;
|
|
23478
|
+
if (this.zoomInertiaType === WEAVE_STAGE_ZOOM_TYPE.MOUSE_WHEEL && !this.isTrackpad) step = this.config.zoomInertia.mouseWheelStep;
|
|
23479
|
+
if (this.zoomInertiaType === WEAVE_STAGE_ZOOM_TYPE.MOUSE_WHEEL && this.isTrackpad) step = this.config.zoomInertia.trackpadStep;
|
|
23480
|
+
const oldScale = stage.scaleX();
|
|
23481
|
+
let newScale = oldScale * (1 - this.zoomVelocity * step);
|
|
23482
|
+
newScale = Math.max(this.config.zoomSteps[0], Math.min(this.config.zoomSteps[this.config.zoomSteps.length - 1], newScale));
|
|
23483
|
+
return newScale;
|
|
23484
|
+
}
|
|
23485
|
+
zoomTick() {
|
|
23486
|
+
if (Math.abs(this.zoomVelocity) < .001) {
|
|
23487
|
+
this.zooming = false;
|
|
23488
|
+
return;
|
|
23489
|
+
}
|
|
23490
|
+
let pointer = this.center;
|
|
23491
|
+
if (this.zoomInertiaType === WEAVE_STAGE_ZOOM_TYPE.MOUSE_WHEEL) {
|
|
23492
|
+
const stage = this.instance.getStage();
|
|
23493
|
+
pointer = stage.getPointerPosition();
|
|
23494
|
+
}
|
|
23495
|
+
if (!pointer) return;
|
|
23496
|
+
this.setZoom(this.getInertiaScale(), false, pointer);
|
|
23497
|
+
this.zoomVelocity *= this.config.zoomInertia.friction;
|
|
23498
|
+
requestAnimationFrame(this.zoomTick.bind(this));
|
|
23499
|
+
}
|
|
23251
23500
|
};
|
|
23252
23501
|
|
|
23253
23502
|
//#endregion
|
|
@@ -23572,7 +23821,10 @@ var WeaveEraserToolAction = class extends WeaveAction {
|
|
|
23572
23821
|
stage.container().focus();
|
|
23573
23822
|
this.cancelAction = cancelAction;
|
|
23574
23823
|
const selectionPlugin = this.instance.getPlugin("nodesSelection");
|
|
23575
|
-
if (selectionPlugin)
|
|
23824
|
+
if (selectionPlugin) {
|
|
23825
|
+
selectionPlugin.setSelectedNodes([]);
|
|
23826
|
+
selectionPlugin.disable();
|
|
23827
|
+
}
|
|
23576
23828
|
this.setEraser();
|
|
23577
23829
|
}
|
|
23578
23830
|
cleanup() {
|
|
@@ -23640,19 +23892,23 @@ var WeaveRectangleToolAction = class extends WeaveAction {
|
|
|
23640
23892
|
return;
|
|
23641
23893
|
}
|
|
23642
23894
|
});
|
|
23643
|
-
stage.on("pointerdown", () => {
|
|
23895
|
+
stage.on("pointerdown", (e) => {
|
|
23896
|
+
this.setTapStart(e);
|
|
23644
23897
|
if (this.state === RECTANGLE_TOOL_STATE.ADDING) {
|
|
23645
23898
|
this.creating = true;
|
|
23646
23899
|
this.handleAdding();
|
|
23647
23900
|
}
|
|
23648
23901
|
});
|
|
23649
|
-
stage.on("pointermove", () => {
|
|
23902
|
+
stage.on("pointermove", (e) => {
|
|
23903
|
+
if (!this.isPressed(e)) return;
|
|
23650
23904
|
if (this.state === RECTANGLE_TOOL_STATE.DEFINING_SIZE) {
|
|
23651
23905
|
this.moved = true;
|
|
23652
23906
|
this.handleMovement();
|
|
23653
23907
|
}
|
|
23654
23908
|
});
|
|
23655
|
-
stage.on("pointerup", () => {
|
|
23909
|
+
stage.on("pointerup", (e) => {
|
|
23910
|
+
const isTap = this.isTap(e);
|
|
23911
|
+
if (isTap) this.moved = false;
|
|
23656
23912
|
if (this.state === RECTANGLE_TOOL_STATE.DEFINING_SIZE) {
|
|
23657
23913
|
this.creating = false;
|
|
23658
23914
|
this.handleSettingSize();
|
|
@@ -23815,19 +24071,23 @@ var WeaveEllipseToolAction = class extends WeaveAction {
|
|
|
23815
24071
|
return;
|
|
23816
24072
|
}
|
|
23817
24073
|
});
|
|
23818
|
-
stage.on("pointerdown", () => {
|
|
24074
|
+
stage.on("pointerdown", (e) => {
|
|
24075
|
+
this.setTapStart(e);
|
|
23819
24076
|
if (this.state === ELLIPSE_TOOL_STATE.ADDING) {
|
|
23820
24077
|
this.creating = true;
|
|
23821
24078
|
this.handleAdding();
|
|
23822
24079
|
}
|
|
23823
24080
|
});
|
|
23824
|
-
stage.on("pointermove", () => {
|
|
24081
|
+
stage.on("pointermove", (e) => {
|
|
24082
|
+
if (!this.isPressed(e)) return;
|
|
23825
24083
|
if (this.state === ELLIPSE_TOOL_STATE.DEFINING_SIZE) {
|
|
23826
24084
|
this.moved = true;
|
|
23827
24085
|
this.handleMovement();
|
|
23828
24086
|
}
|
|
23829
24087
|
});
|
|
23830
|
-
stage.on("pointerup", () => {
|
|
24088
|
+
stage.on("pointerup", (e) => {
|
|
24089
|
+
const isTap = this.isTap(e);
|
|
24090
|
+
if (isTap) this.moved = false;
|
|
23831
24091
|
if (this.state === ELLIPSE_TOOL_STATE.DEFINING_SIZE) {
|
|
23832
24092
|
this.creating = false;
|
|
23833
24093
|
this.handleSettingSize();
|
|
@@ -24197,11 +24457,13 @@ const BRUSH_TOOL_STATE = {
|
|
|
24197
24457
|
//#region src/actions/brush-tool/brush-tool.ts
|
|
24198
24458
|
var WeaveBrushToolAction = class extends WeaveAction {
|
|
24199
24459
|
initialized = false;
|
|
24460
|
+
lineWidth = 0;
|
|
24200
24461
|
onPropsChange = void 0;
|
|
24201
24462
|
onInit = void 0;
|
|
24202
24463
|
constructor() {
|
|
24203
24464
|
super();
|
|
24204
24465
|
this.initialized = false;
|
|
24466
|
+
this.lineWidth = 0;
|
|
24205
24467
|
this.state = BRUSH_TOOL_STATE.INACTIVE;
|
|
24206
24468
|
this.strokeId = null;
|
|
24207
24469
|
this.clickPoint = null;
|
|
@@ -24219,6 +24481,11 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
24219
24481
|
opacity: 1
|
|
24220
24482
|
};
|
|
24221
24483
|
}
|
|
24484
|
+
getPointPressure(e) {
|
|
24485
|
+
let pressure = 1;
|
|
24486
|
+
if (e.evt instanceof PointerEvent && e.evt.pointerType === "pen") pressure = e.evt.pressure;
|
|
24487
|
+
return pressure;
|
|
24488
|
+
}
|
|
24222
24489
|
setupEvents() {
|
|
24223
24490
|
const stage = this.instance.getStage();
|
|
24224
24491
|
stage.container().tabIndex = 1;
|
|
@@ -24233,75 +24500,132 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
24233
24500
|
return;
|
|
24234
24501
|
}
|
|
24235
24502
|
});
|
|
24236
|
-
|
|
24503
|
+
const handlePointerDown = (e) => {
|
|
24237
24504
|
if (this.state !== BRUSH_TOOL_STATE.IDLE) return;
|
|
24505
|
+
const pointPressure = this.getPointPressure(e);
|
|
24506
|
+
this.lineWidth = Math.log(pointPressure + 1) * this.props.strokeWidth;
|
|
24238
24507
|
this.handleStartStroke();
|
|
24239
24508
|
e.evt.stopPropagation();
|
|
24240
|
-
}
|
|
24241
|
-
stage.on("
|
|
24509
|
+
};
|
|
24510
|
+
stage.on("pointerdown touchstart", handlePointerDown);
|
|
24511
|
+
const handlePointerMove = (e) => {
|
|
24242
24512
|
if (this.state !== BRUSH_TOOL_STATE.DEFINE_STROKE) return;
|
|
24513
|
+
const pointPressure = this.getPointPressure(e);
|
|
24514
|
+
this.lineWidth = Math.log(pointPressure + 1) * this.props.strokeWidth * .2 + this.lineWidth * .8;
|
|
24243
24515
|
this.handleMovement();
|
|
24244
24516
|
e.evt.stopPropagation();
|
|
24245
|
-
}
|
|
24246
|
-
stage.on("
|
|
24517
|
+
};
|
|
24518
|
+
stage.on("pointermove touchmove", handlePointerMove);
|
|
24519
|
+
const handlePointerUp = (e) => {
|
|
24247
24520
|
if (this.state !== BRUSH_TOOL_STATE.DEFINE_STROKE) return;
|
|
24248
24521
|
this.handleEndStroke();
|
|
24249
24522
|
e.evt.stopPropagation();
|
|
24250
|
-
}
|
|
24523
|
+
};
|
|
24524
|
+
stage.on("pointerup touchend", handlePointerUp);
|
|
24251
24525
|
this.initialized = true;
|
|
24252
24526
|
}
|
|
24253
24527
|
setState(state) {
|
|
24254
24528
|
this.state = state;
|
|
24255
24529
|
}
|
|
24530
|
+
getBoundingBox(strokeElements) {
|
|
24531
|
+
if (strokeElements.length === 0) return {
|
|
24532
|
+
x: 0,
|
|
24533
|
+
y: 0,
|
|
24534
|
+
width: 0,
|
|
24535
|
+
height: 0
|
|
24536
|
+
};
|
|
24537
|
+
let minX = strokeElements[0].x;
|
|
24538
|
+
let maxX = strokeElements[0].x;
|
|
24539
|
+
let minY = strokeElements[0].y;
|
|
24540
|
+
let maxY = strokeElements[0].y;
|
|
24541
|
+
strokeElements.forEach((point) => {
|
|
24542
|
+
minX = Math.min(minX, point.x);
|
|
24543
|
+
maxX = Math.max(maxX, point.x);
|
|
24544
|
+
minY = Math.min(minY, point.y);
|
|
24545
|
+
maxY = Math.max(maxY, point.y);
|
|
24546
|
+
});
|
|
24547
|
+
return {
|
|
24548
|
+
x: minX,
|
|
24549
|
+
y: minY,
|
|
24550
|
+
width: maxX - minX,
|
|
24551
|
+
height: maxY - minY
|
|
24552
|
+
};
|
|
24553
|
+
}
|
|
24256
24554
|
handleStartStroke() {
|
|
24257
24555
|
const { mousePoint, container, measureContainer } = this.instance.getMousePointer();
|
|
24258
24556
|
this.clickPoint = mousePoint;
|
|
24259
24557
|
this.container = container;
|
|
24260
24558
|
this.measureContainer = measureContainer;
|
|
24261
24559
|
this.strokeId = v4_default();
|
|
24262
|
-
const nodeHandler = this.instance.getNodeHandler("
|
|
24560
|
+
const nodeHandler = this.instance.getNodeHandler("stroke");
|
|
24263
24561
|
if (nodeHandler) {
|
|
24264
24562
|
const node = nodeHandler.create(this.strokeId, {
|
|
24265
24563
|
...this.props,
|
|
24266
24564
|
strokeScaleEnabled: true,
|
|
24267
|
-
x:
|
|
24268
|
-
y:
|
|
24269
|
-
|
|
24565
|
+
x: 0,
|
|
24566
|
+
y: 0,
|
|
24567
|
+
width: 0,
|
|
24568
|
+
height: 0,
|
|
24569
|
+
strokeElements: []
|
|
24270
24570
|
});
|
|
24271
|
-
|
|
24571
|
+
const nodeInstance = nodeHandler.onRender(node.props);
|
|
24572
|
+
this.container?.add(nodeInstance);
|
|
24272
24573
|
}
|
|
24273
24574
|
this.setState(BRUSH_TOOL_STATE.DEFINE_STROKE);
|
|
24274
24575
|
}
|
|
24576
|
+
handleMovement() {
|
|
24577
|
+
if (this.state !== BRUSH_TOOL_STATE.DEFINE_STROKE) return;
|
|
24578
|
+
const tempStroke = this.instance.getStage().findOne(`#${this.strokeId}`);
|
|
24579
|
+
if (this.measureContainer && tempStroke) {
|
|
24580
|
+
const { mousePoint } = this.instance.getMousePointerRelativeToContainer(this.measureContainer);
|
|
24581
|
+
const newStrokeElements = [...tempStroke.getAttrs().strokeElements];
|
|
24582
|
+
newStrokeElements.push({
|
|
24583
|
+
x: mousePoint.x - tempStroke.x(),
|
|
24584
|
+
y: mousePoint.y - tempStroke.y(),
|
|
24585
|
+
lineWidth: this.lineWidth
|
|
24586
|
+
});
|
|
24587
|
+
const box = this.getBoundingBox(newStrokeElements);
|
|
24588
|
+
tempStroke.setAttrs({
|
|
24589
|
+
width: box.width,
|
|
24590
|
+
height: box.height,
|
|
24591
|
+
x: 0,
|
|
24592
|
+
y: 0,
|
|
24593
|
+
strokeElements: newStrokeElements
|
|
24594
|
+
});
|
|
24595
|
+
const nodeHandler = this.instance.getNodeHandler("stroke");
|
|
24596
|
+
if (nodeHandler) nodeHandler.onUpdate(tempStroke, tempStroke.getAttrs());
|
|
24597
|
+
}
|
|
24598
|
+
}
|
|
24275
24599
|
handleEndStroke() {
|
|
24276
24600
|
const stage = this.instance.getStage();
|
|
24277
24601
|
const tempStroke = this.instance.getStage().findOne(`#${this.strokeId}`);
|
|
24278
24602
|
if (tempStroke) {
|
|
24279
|
-
const nodeHandler = this.instance.getNodeHandler("
|
|
24280
|
-
|
|
24281
|
-
|
|
24282
|
-
|
|
24283
|
-
|
|
24284
|
-
|
|
24603
|
+
const nodeHandler = this.instance.getNodeHandler("stroke");
|
|
24604
|
+
if (nodeHandler) {
|
|
24605
|
+
const box = this.getBoundingBox(tempStroke.getAttrs().strokeElements);
|
|
24606
|
+
let newStrokeElements = [...tempStroke.getAttrs().strokeElements];
|
|
24607
|
+
newStrokeElements = newStrokeElements.map((point) => ({
|
|
24608
|
+
...point,
|
|
24609
|
+
x: point.x - box.x,
|
|
24610
|
+
y: point.y - box.y
|
|
24611
|
+
}));
|
|
24612
|
+
tempStroke.setAttrs({
|
|
24613
|
+
width: box.width,
|
|
24614
|
+
height: box.height,
|
|
24615
|
+
x: box.x,
|
|
24616
|
+
y: box.y,
|
|
24617
|
+
strokeElements: newStrokeElements
|
|
24618
|
+
});
|
|
24619
|
+
const realNode = this.instance.getStage().findOne(`#${tempStroke.getAttrs().id}`);
|
|
24620
|
+
if (realNode) realNode.destroy();
|
|
24621
|
+
this.instance.addNode(nodeHandler.serialize(tempStroke), this.container?.getAttrs().id);
|
|
24622
|
+
}
|
|
24285
24623
|
this.clickPoint = null;
|
|
24286
24624
|
stage.container().tabIndex = 1;
|
|
24287
24625
|
stage.container().focus();
|
|
24288
24626
|
this.setState(BRUSH_TOOL_STATE.IDLE);
|
|
24289
24627
|
}
|
|
24290
24628
|
}
|
|
24291
|
-
handleMovement() {
|
|
24292
|
-
if (this.state !== BRUSH_TOOL_STATE.DEFINE_STROKE) return;
|
|
24293
|
-
const tempStroke = this.instance.getStage().findOne(`#${this.strokeId}`);
|
|
24294
|
-
if (this.measureContainer && tempStroke) {
|
|
24295
|
-
const { mousePoint } = this.instance.getMousePointerRelativeToContainer(this.measureContainer);
|
|
24296
|
-
tempStroke.points([
|
|
24297
|
-
...tempStroke.points(),
|
|
24298
|
-
mousePoint.x - tempStroke.x(),
|
|
24299
|
-
mousePoint.y - tempStroke.y()
|
|
24300
|
-
]);
|
|
24301
|
-
const nodeHandler = this.instance.getNodeHandler("line");
|
|
24302
|
-
if (nodeHandler) this.instance.updateNode(nodeHandler.serialize(tempStroke));
|
|
24303
|
-
}
|
|
24304
|
-
}
|
|
24305
24629
|
trigger(cancel) {
|
|
24306
24630
|
if (!this.instance) throw new Error("Instance not defined");
|
|
24307
24631
|
if (!this.initialized) this.setupEvents();
|
|
@@ -24495,19 +24819,23 @@ var WeaveStarToolAction = class extends WeaveAction {
|
|
|
24495
24819
|
return;
|
|
24496
24820
|
}
|
|
24497
24821
|
});
|
|
24498
|
-
stage.on("pointerdown", () => {
|
|
24822
|
+
stage.on("pointerdown", (e) => {
|
|
24823
|
+
this.setTapStart(e);
|
|
24499
24824
|
if (this.state === STAR_TOOL_STATE.ADDING) {
|
|
24500
24825
|
this.creating = true;
|
|
24501
24826
|
this.handleAdding();
|
|
24502
24827
|
}
|
|
24503
24828
|
});
|
|
24504
|
-
stage.on("pointermove", () => {
|
|
24829
|
+
stage.on("pointermove", (e) => {
|
|
24830
|
+
if (!this.isPressed(e)) return;
|
|
24505
24831
|
if (this.state === STAR_TOOL_STATE.DEFINING_SIZE) {
|
|
24506
24832
|
this.moved = true;
|
|
24507
24833
|
this.handleMovement();
|
|
24508
24834
|
}
|
|
24509
24835
|
});
|
|
24510
|
-
stage.on("pointerup", () => {
|
|
24836
|
+
stage.on("pointerup", (e) => {
|
|
24837
|
+
const isTap = this.isTap(e);
|
|
24838
|
+
if (isTap) this.moved = false;
|
|
24511
24839
|
if (this.state === STAR_TOOL_STATE.DEFINING_SIZE) {
|
|
24512
24840
|
this.creating = false;
|
|
24513
24841
|
this.handleSettingSize();
|
|
@@ -24933,19 +25261,23 @@ var WeaveRegularPolygonToolAction = class extends WeaveAction {
|
|
|
24933
25261
|
return;
|
|
24934
25262
|
}
|
|
24935
25263
|
});
|
|
24936
|
-
stage.on("pointerdown", () => {
|
|
25264
|
+
stage.on("pointerdown", (e) => {
|
|
25265
|
+
this.setTapStart(e);
|
|
24937
25266
|
if (this.state === REGULAR_POLYGON_TOOL_STATE.ADDING) {
|
|
24938
25267
|
this.creating = true;
|
|
24939
25268
|
this.handleAdding();
|
|
24940
25269
|
}
|
|
24941
25270
|
});
|
|
24942
|
-
stage.on("pointermove", () => {
|
|
25271
|
+
stage.on("pointermove", (e) => {
|
|
25272
|
+
if (!this.isPressed(e)) return;
|
|
24943
25273
|
if (this.state === REGULAR_POLYGON_TOOL_STATE.DEFINING_SIZE) {
|
|
24944
25274
|
this.moved = true;
|
|
24945
25275
|
this.handleMovement();
|
|
24946
25276
|
}
|
|
24947
25277
|
});
|
|
24948
|
-
stage.on("pointerup", () => {
|
|
25278
|
+
stage.on("pointerup", (e) => {
|
|
25279
|
+
const isTap = this.isTap(e);
|
|
25280
|
+
if (isTap) this.moved = false;
|
|
24949
25281
|
if (this.state === REGULAR_POLYGON_TOOL_STATE.DEFINING_SIZE) {
|
|
24950
25282
|
this.creating = false;
|
|
24951
25283
|
this.handleSettingSize();
|
|
@@ -25593,7 +25925,7 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
25593
25925
|
if (!this.enabled || !(this.isSpaceKeyPressed || this.isMouseMiddleButtonPressed || this.moveToolActive)) return;
|
|
25594
25926
|
this.onRender();
|
|
25595
25927
|
};
|
|
25596
|
-
stage.on("pointermove", (0, import_lodash
|
|
25928
|
+
stage.on("pointermove", (0, import_lodash.throttle)(handleMouseMove, 50));
|
|
25597
25929
|
stage.on("pointermove", () => {
|
|
25598
25930
|
if (!this.enabled) return;
|
|
25599
25931
|
this.onRender();
|
|
@@ -25888,7 +26220,7 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
25888
26220
|
stage.y(stage.y() - deltaY);
|
|
25889
26221
|
this.instance.emitEvent("onStageMove");
|
|
25890
26222
|
};
|
|
25891
|
-
stage.on("pointermove", (0, import_lodash
|
|
26223
|
+
stage.on("pointermove", (0, import_lodash.throttle)(handleMouseMove, 50));
|
|
25892
26224
|
stage.on("pointerdown", () => {
|
|
25893
26225
|
const mousePos = stage.getPointerPosition();
|
|
25894
26226
|
previousMouseX = mousePos?.x ?? 0;
|
|
@@ -26004,7 +26336,7 @@ var WeaveConnectedUsersPlugin = class extends WeavePlugin {
|
|
|
26004
26336
|
newConnectedUsers[userInformation.name] = userInformation;
|
|
26005
26337
|
}
|
|
26006
26338
|
}
|
|
26007
|
-
if (!(0, import_lodash
|
|
26339
|
+
if (!(0, import_lodash.isEqual)(this.connectedUsers, newConnectedUsers)) this.instance.emitEvent("onConnectedUsersChange", newConnectedUsers);
|
|
26008
26340
|
this.connectedUsers = newConnectedUsers;
|
|
26009
26341
|
});
|
|
26010
26342
|
}
|
|
@@ -26362,6 +26694,7 @@ var WeaveStageDropAreaPlugin = class extends WeavePlugin {
|
|
|
26362
26694
|
initEvents() {
|
|
26363
26695
|
const stage = this.instance.getStage();
|
|
26364
26696
|
stage.container().addEventListener("dragover", (e) => {
|
|
26697
|
+
e.preventDefault();
|
|
26365
26698
|
e.stopPropagation();
|
|
26366
26699
|
});
|
|
26367
26700
|
stage.container().addEventListener("drop", (e) => {
|
|
@@ -26742,5 +27075,5 @@ var WeaveNodesSnappingPlugin = class extends WeavePlugin {
|
|
|
26742
27075
|
};
|
|
26743
27076
|
|
|
26744
27077
|
//#endregion
|
|
26745
|
-
export { ALIGN_NODES_ALIGN_TO, ALIGN_NODES_TOOL_ACTION_NAME, ALIGN_NODES_TOOL_STATE, ARROW_TOOL_ACTION_NAME, ARROW_TOOL_STATE, BRUSH_TOOL_ACTION_NAME, BRUSH_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_LINE_DEFAULT_CONFIG, GUIDE_LINE_DRAG_SNAPPING_THRESHOLD, GUIDE_LINE_NAME, GUIDE_LINE_TRANSFORM_SNAPPING_THRESHOLD, GUIDE_ORIENTATION, IMAGE_TOOL_ACTION_NAME, IMAGE_TOOL_STATE, MOVE_TOOL_ACTION_NAME, MOVE_TOOL_STATE, NODE_SNAP, 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, STAR_TOOL_ACTION_NAME, STAR_TOOL_STATE, TEXT_LAYOUT, TEXT_TOOL_ACTION_NAME, TEXT_TOOL_STATE, WEAVE_ARROW_NODE_TYPE, WEAVE_COPY_PASTE_NODES_KEY, WEAVE_DEFAULT_USER_INFO_FUNCTION, WEAVE_ELLIPSE_NODE_TYPE, WEAVE_FRAME_NODE_DEFAULT_CONFIG, WEAVE_FRAME_NODE_DEFAULT_PROPS, WEAVE_FRAME_NODE_TYPE, WEAVE_GRID_DEFAULT_COLOR, WEAVE_GRID_DEFAULT_MAJOR_DOT_RATIO, WEAVE_GRID_DEFAULT_MAJOR_EVERY, WEAVE_GRID_DEFAULT_MAJOR_LINE_RATIO, WEAVE_GRID_DEFAULT_ORIGIN_COLOR, WEAVE_GRID_DEFAULT_RADIUS, WEAVE_GRID_DEFAULT_SIZE, WEAVE_GRID_DEFAULT_STROKE, WEAVE_GRID_DEFAULT_TYPE, WEAVE_GRID_LAYER_ID, WEAVE_GRID_TYPES, WEAVE_GROUP_NODE_TYPE, WEAVE_IMAGE_CROP_END_TYPE, WEAVE_IMAGE_NODE_TYPE, WEAVE_LAYER_NODE_TYPE, WEAVE_LINE_NODE_TYPE, WEAVE_NODES_SELECTION_KEY, WEAVE_NODES_SELECTION_LAYER_ID, WEAVE_NODES_SNAPPING_KEY, WEAVE_RECTANGLE_NODE_TYPE, WEAVE_REGULAR_POLYGON_NODE_TYPE, WEAVE_STAGE_GRID_KEY, WEAVE_STAGE_NODE_TYPE, WEAVE_STAR_NODE_TYPE, WEAVE_TEXT_NODE_TYPE, WEAVE_USERS_POINTERS_KEY, WEAVE_USERS_SELECTION_KEY, WEAVE_USER_POINTERS_DEFAULT_PROPS, WEAVE_USER_POINTER_KEY, WEAVE_USER_SELECTION_KEY, Weave, WeaveAction, WeaveAlignNodesToolAction, WeaveArrowNode, WeaveArrowToolAction, WeaveBrushToolAction, WeaveConnectedUsersPlugin, WeaveContextMenuPlugin, WeaveCopyPasteNodesPlugin, WeaveEllipseNode, WeaveEllipseToolAction, WeaveEraserToolAction, WeaveExportNodesToolAction, WeaveExportStageToolAction, WeaveFitToScreenToolAction, WeaveFitToSelectionToolAction, WeaveFrameNode, WeaveFrameToolAction, WeaveGroupNode, WeaveImageNode, WeaveImageToolAction, WeaveLayerNode, WeaveLineNode, WeaveMoveToolAction, WeaveNode, WeaveNodesSelectionPlugin, WeaveNodesSnappingPlugin, WeavePenToolAction, WeavePlugin, WeaveRectangleNode, WeaveRectangleToolAction, WeaveRegularPolygonNode, WeaveRegularPolygonToolAction, WeaveSelectionToolAction, WeaveStageDropAreaPlugin, WeaveStageGridPlugin, WeaveStageNode, WeaveStagePanningPlugin, WeaveStageResizePlugin, WeaveStageZoomPlugin, WeaveStarNode, WeaveStarToolAction, WeaveStore, WeaveTextNode, WeaveTextToolAction, WeaveUsersPointersPlugin, WeaveUsersSelectionPlugin, WeaveZoomInToolAction, WeaveZoomOutToolAction, checkIfOverContainer, clearContainerTargets, getBoundingBox, getContrastTextColor, moveNodeToContainer, resetScale, stringToColor };
|
|
27078
|
+
export { ALIGN_NODES_ALIGN_TO, ALIGN_NODES_TOOL_ACTION_NAME, ALIGN_NODES_TOOL_STATE, ARROW_TOOL_ACTION_NAME, ARROW_TOOL_STATE, BRUSH_TOOL_ACTION_NAME, BRUSH_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_LINE_DEFAULT_CONFIG, GUIDE_LINE_DRAG_SNAPPING_THRESHOLD, GUIDE_LINE_NAME, GUIDE_LINE_TRANSFORM_SNAPPING_THRESHOLD, GUIDE_ORIENTATION, IMAGE_TOOL_ACTION_NAME, IMAGE_TOOL_STATE, MOVE_TOOL_ACTION_NAME, MOVE_TOOL_STATE, NODE_SNAP, 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, STAR_TOOL_ACTION_NAME, STAR_TOOL_STATE, TEXT_LAYOUT, TEXT_TOOL_ACTION_NAME, TEXT_TOOL_STATE, WEAVE_ARROW_NODE_TYPE, WEAVE_COPY_PASTE_NODES_KEY, WEAVE_DEFAULT_USER_INFO_FUNCTION, WEAVE_ELLIPSE_NODE_TYPE, WEAVE_FRAME_NODE_DEFAULT_CONFIG, WEAVE_FRAME_NODE_DEFAULT_PROPS, WEAVE_FRAME_NODE_TYPE, WEAVE_GRID_DEFAULT_COLOR, WEAVE_GRID_DEFAULT_MAJOR_DOT_RATIO, WEAVE_GRID_DEFAULT_MAJOR_EVERY, WEAVE_GRID_DEFAULT_MAJOR_LINE_RATIO, WEAVE_GRID_DEFAULT_ORIGIN_COLOR, WEAVE_GRID_DEFAULT_RADIUS, WEAVE_GRID_DEFAULT_SIZE, WEAVE_GRID_DEFAULT_STROKE, WEAVE_GRID_DEFAULT_TYPE, WEAVE_GRID_LAYER_ID, WEAVE_GRID_TYPES, WEAVE_GROUP_NODE_TYPE, WEAVE_IMAGE_CROP_END_TYPE, WEAVE_IMAGE_NODE_TYPE, WEAVE_LAYER_NODE_TYPE, WEAVE_LINE_NODE_TYPE, WEAVE_NODES_SELECTION_KEY, WEAVE_NODES_SELECTION_LAYER_ID, WEAVE_NODES_SNAPPING_KEY, WEAVE_RECTANGLE_NODE_TYPE, WEAVE_REGULAR_POLYGON_NODE_TYPE, WEAVE_STAGE_GRID_KEY, WEAVE_STAGE_NODE_TYPE, WEAVE_STAR_NODE_TYPE, WEAVE_STROKE_NODE_TYPE, WEAVE_TEXT_NODE_TYPE, WEAVE_USERS_POINTERS_KEY, WEAVE_USERS_SELECTION_KEY, WEAVE_USER_POINTERS_DEFAULT_PROPS, WEAVE_USER_POINTER_KEY, WEAVE_USER_SELECTION_KEY, Weave, WeaveAction, WeaveAlignNodesToolAction, WeaveArrowNode, WeaveArrowToolAction, WeaveBrushToolAction, WeaveConnectedUsersPlugin, WeaveContextMenuPlugin, WeaveCopyPasteNodesPlugin, WeaveEllipseNode, WeaveEllipseToolAction, WeaveEraserToolAction, WeaveExportNodesToolAction, WeaveExportStageToolAction, WeaveFitToScreenToolAction, WeaveFitToSelectionToolAction, WeaveFrameNode, WeaveFrameToolAction, WeaveGroupNode, WeaveImageNode, WeaveImageToolAction, WeaveLayerNode, WeaveLineNode, WeaveMoveToolAction, WeaveNode, WeaveNodesSelectionPlugin, WeaveNodesSnappingPlugin, WeavePenToolAction, WeavePlugin, WeaveRectangleNode, WeaveRectangleToolAction, WeaveRegularPolygonNode, WeaveRegularPolygonToolAction, WeaveSelectionToolAction, WeaveStageDropAreaPlugin, WeaveStageGridPlugin, WeaveStageNode, WeaveStagePanningPlugin, WeaveStageResizePlugin, WeaveStageZoomPlugin, WeaveStarNode, WeaveStarToolAction, WeaveStore, WeaveStrokeNode, WeaveTextNode, WeaveTextToolAction, WeaveUsersPointersPlugin, WeaveUsersSelectionPlugin, WeaveZoomInToolAction, WeaveZoomOutToolAction, checkIfOverContainer, clearContainerTargets, getBoundingBox, getContrastTextColor, moveNodeToContainer, resetScale, stringToColor };
|
|
26746
27079
|
//# sourceMappingURL=sdk.js.map
|