@inditextech/weave-sdk 2.21.0 → 2.22.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.d.ts +22 -14
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +98 -56
- package/dist/sdk.js.map +1 -1
- package/dist/sdk.node.d.ts +26 -18
- package/dist/sdk.node.d.ts.map +1 -1
- package/dist/sdk.node.js +98 -56
- package/dist/sdk.node.js.map +1 -1
- package/package.json +2 -2
package/dist/sdk.node.js
CHANGED
|
@@ -17910,7 +17910,10 @@ const getPositionRelativeToContainerOnPosition = (instance) => {
|
|
|
17910
17910
|
let position = instance.getStage().getRelativePointerPosition();
|
|
17911
17911
|
if (!position) return position;
|
|
17912
17912
|
const container = containerOverCursor(instance, [], position);
|
|
17913
|
-
if (container)
|
|
17913
|
+
if (container) if (container.getAttrs().containerId) {
|
|
17914
|
+
const containerNode = container.findOne(`#${container.getAttrs().containerId}`);
|
|
17915
|
+
if (containerNode) position = containerNode?.getRelativePointerPosition();
|
|
17916
|
+
} else position = container?.getRelativePointerPosition();
|
|
17914
17917
|
if (!position) return position;
|
|
17915
17918
|
return position;
|
|
17916
17919
|
};
|
|
@@ -19162,7 +19165,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
19162
19165
|
const dy = e.evt.clientY - this.tapStart.y;
|
|
19163
19166
|
const dist = Math.hypot(dx, dy);
|
|
19164
19167
|
const DOUBLE_TAP_DISTANCE = 10;
|
|
19165
|
-
const DOUBLE_TAP_TIME =
|
|
19168
|
+
const DOUBLE_TAP_TIME = 400;
|
|
19166
19169
|
this.isDoubleTap = false;
|
|
19167
19170
|
if (this.taps >= 1 && now$2 - this.lastTapTime < DOUBLE_TAP_TIME && dist < DOUBLE_TAP_DISTANCE) {
|
|
19168
19171
|
this.taps = 0;
|
|
@@ -19438,8 +19441,11 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
19438
19441
|
let nodeTargeted = selectedGroup && !(selectedGroup.getAttrs().active ?? false) ? selectedGroup : e.target;
|
|
19439
19442
|
if (nodeTargeted.getParent() instanceof Konva.Transformer) {
|
|
19440
19443
|
const mousePos = stage.getPointerPosition();
|
|
19441
|
-
const intersections = stage.getAllIntersections(mousePos
|
|
19442
|
-
|
|
19444
|
+
const intersections = stage.getAllIntersections(mousePos ?? {
|
|
19445
|
+
x: 0,
|
|
19446
|
+
y: 0
|
|
19447
|
+
});
|
|
19448
|
+
const nodesIntersected = intersections.filter((ele) => ele.getAttrs().nodeType !== void 0);
|
|
19443
19449
|
let targetNode = null;
|
|
19444
19450
|
if (nodesIntersected.length > 0) targetNode = this.instance.getInstanceRecursive(nodesIntersected[nodesIntersected.length - 1]);
|
|
19445
19451
|
if (targetNode && targetNode.getAttrs().nodeType) nodeTargeted = targetNode;
|
|
@@ -22170,7 +22176,7 @@ var WeaveRegisterManager = class {
|
|
|
22170
22176
|
|
|
22171
22177
|
//#endregion
|
|
22172
22178
|
//#region package.json
|
|
22173
|
-
var version = "2.
|
|
22179
|
+
var version = "2.22.0";
|
|
22174
22180
|
|
|
22175
22181
|
//#endregion
|
|
22176
22182
|
//#region src/managers/setup.ts
|
|
@@ -23845,6 +23851,7 @@ var WeaveStageNode = class extends WeaveNode {
|
|
|
23845
23851
|
onUpdate() {}
|
|
23846
23852
|
setupEvents() {
|
|
23847
23853
|
if (this.globalEventsInitialized) return;
|
|
23854
|
+
if (this.instance.isServerSide()) return;
|
|
23848
23855
|
window.addEventListener("keydown", (e) => {
|
|
23849
23856
|
if (e.ctrlKey || e.metaKey) {
|
|
23850
23857
|
this.isCmdCtrlPressed = true;
|
|
@@ -24495,6 +24502,10 @@ var WeaveLineNode = class extends WeaveNode {
|
|
|
24495
24502
|
//#endregion
|
|
24496
24503
|
//#region src/nodes/text/constants.ts
|
|
24497
24504
|
const WEAVE_TEXT_NODE_TYPE = "text";
|
|
24505
|
+
const WEAVE_TEXT_NODE_DEFAULT_CONFIG = {
|
|
24506
|
+
transform: { ...WEAVE_NODES_SELECTION_DEFAULT_CONFIG.selection },
|
|
24507
|
+
outline: { enabled: false }
|
|
24508
|
+
};
|
|
24498
24509
|
|
|
24499
24510
|
//#endregion
|
|
24500
24511
|
//#region src/actions/text-tool/constants.ts
|
|
@@ -24521,7 +24532,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24521
24532
|
constructor(params) {
|
|
24522
24533
|
super();
|
|
24523
24534
|
const { config } = params ?? {};
|
|
24524
|
-
this.config = {
|
|
24535
|
+
this.config = (0, import_lodash.merge)({}, WEAVE_TEXT_NODE_DEFAULT_CONFIG, config);
|
|
24525
24536
|
this.keyPressHandler = void 0;
|
|
24526
24537
|
this.editing = false;
|
|
24527
24538
|
this.textArea = null;
|
|
@@ -24556,7 +24567,14 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24556
24567
|
onRender(props) {
|
|
24557
24568
|
const text = new Konva.Text({
|
|
24558
24569
|
...props,
|
|
24559
|
-
name: "node"
|
|
24570
|
+
name: "node",
|
|
24571
|
+
...!this.config.outline.enabled && { strokeEnabled: false },
|
|
24572
|
+
...this.config.outline.enabled && {
|
|
24573
|
+
strokeEnabled: true,
|
|
24574
|
+
stroke: this.config.outline.color,
|
|
24575
|
+
strokeWidth: this.config.outline.width,
|
|
24576
|
+
fillAfterStrokeEnabled: true
|
|
24577
|
+
}
|
|
24560
24578
|
});
|
|
24561
24579
|
this.setupDefaultNodeAugmentation(text);
|
|
24562
24580
|
const defaultTransformerProperties = this.defaultGetTransformerProperties(this.config.transform);
|
|
@@ -24643,7 +24661,16 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24643
24661
|
const actualLineHeight = nodeInstance.getAttrs().lineHeight;
|
|
24644
24662
|
let updateNeeded = false;
|
|
24645
24663
|
if (actualFontFamily !== nextProps.fontFamily || actualFontSize !== nextProps.fontSize || actualFontStyle !== nextProps.fontStyle || actualFontVariant !== nextProps.fontVariant || actualTextDecoration !== nextProps.textDecoration || actualLineHeight !== nextProps.lineHeight) updateNeeded = true;
|
|
24646
|
-
nodeInstance.setAttrs({
|
|
24664
|
+
nodeInstance.setAttrs({
|
|
24665
|
+
...nextProps,
|
|
24666
|
+
...!this.config.outline.enabled && { strokeEnabled: false },
|
|
24667
|
+
...this.config.outline.enabled && {
|
|
24668
|
+
strokeEnabled: true,
|
|
24669
|
+
stroke: this.config.outline.color,
|
|
24670
|
+
strokeWidth: this.config.outline.width,
|
|
24671
|
+
fillAfterStrokeEnabled: true
|
|
24672
|
+
}
|
|
24673
|
+
});
|
|
24647
24674
|
let width = nextProps.width;
|
|
24648
24675
|
let height = nextProps.height;
|
|
24649
24676
|
if (nextProps.layout === TEXT_LAYOUT.AUTO_ALL) {
|
|
@@ -25649,7 +25676,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
25649
25676
|
triggerCrop(imageNode, options) {
|
|
25650
25677
|
const stage = this.instance.getStage();
|
|
25651
25678
|
if (imageNode.getAttrs().cropping ?? false) return;
|
|
25652
|
-
if (!(this.isSelecting() && this.isNodeSelected(imageNode))
|
|
25679
|
+
if (!(this.isSelecting() && this.isNodeSelected(imageNode))) return;
|
|
25653
25680
|
const lockAcquired = this.instance.setMutexLock({
|
|
25654
25681
|
nodeIds: [imageNode.id()],
|
|
25655
25682
|
operation: "image-crop"
|
|
@@ -25804,17 +25831,23 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
25804
25831
|
image: imageSource,
|
|
25805
25832
|
visible: true
|
|
25806
25833
|
});
|
|
25834
|
+
let sourceImageWidth = this.imageSource[id].width;
|
|
25835
|
+
let sourceImageHeight = this.imageSource[id].height;
|
|
25836
|
+
if (image.getAttrs().imageInfo) {
|
|
25837
|
+
sourceImageWidth = image.getAttrs().imageInfo.width;
|
|
25838
|
+
sourceImageHeight = image.getAttrs().imageInfo.height;
|
|
25839
|
+
}
|
|
25807
25840
|
image.setAttr("imageInfo", {
|
|
25808
|
-
width:
|
|
25809
|
-
height:
|
|
25841
|
+
width: sourceImageWidth,
|
|
25842
|
+
height: sourceImageHeight
|
|
25810
25843
|
});
|
|
25811
25844
|
internalImage.setAttr("imageInfo", {
|
|
25812
|
-
width:
|
|
25813
|
-
height:
|
|
25845
|
+
width: sourceImageWidth,
|
|
25846
|
+
height: sourceImageHeight
|
|
25814
25847
|
});
|
|
25815
25848
|
if (!image.getAttrs().uncroppedImage) image.setAttr("uncroppedImage", {
|
|
25816
|
-
width:
|
|
25817
|
-
height:
|
|
25849
|
+
width: sourceImageWidth,
|
|
25850
|
+
height: sourceImageHeight
|
|
25818
25851
|
});
|
|
25819
25852
|
this.imageState[id] = {
|
|
25820
25853
|
loaded: true,
|
|
@@ -26130,8 +26163,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26130
26163
|
}
|
|
26131
26164
|
this.cacheNode(nodeInstance);
|
|
26132
26165
|
}
|
|
26133
|
-
preloadImage(imageId, imageURL, {
|
|
26134
|
-
const realImageURL = this.config.urlTransformer?.(imageURL ?? "", node) ?? imageURL;
|
|
26166
|
+
preloadImage(imageId, imageURL, { onLoad, onError }) {
|
|
26135
26167
|
this.imageSource[imageId] = Konva.Util.createImageElement();
|
|
26136
26168
|
this.imageSource[imageId].crossOrigin = this.config.crossOrigin;
|
|
26137
26169
|
this.imageSource[imageId].onerror = (error) => {
|
|
@@ -26155,7 +26187,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26155
26187
|
error: false
|
|
26156
26188
|
};
|
|
26157
26189
|
try {
|
|
26158
|
-
if (
|
|
26190
|
+
if (imageURL) this.imageSource[imageId].src = imageURL;
|
|
26159
26191
|
} catch (ex) {
|
|
26160
26192
|
console.error(ex);
|
|
26161
26193
|
}
|
|
@@ -26168,7 +26200,6 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26168
26200
|
const realImageURL = this.config.urlTransformer?.(imageProps.imageURL ?? "", image) ?? imageProps.imageURL;
|
|
26169
26201
|
this.loadAsyncElement(id);
|
|
26170
26202
|
this.preloadImage(id, realImageURL ?? "", {
|
|
26171
|
-
node: image,
|
|
26172
26203
|
onLoad: () => {
|
|
26173
26204
|
if (image && imagePlaceholder && internalImage) {
|
|
26174
26205
|
image.setAttrs({
|
|
@@ -26183,14 +26214,20 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26183
26214
|
image: imageSource,
|
|
26184
26215
|
visible: true
|
|
26185
26216
|
});
|
|
26217
|
+
let sourceImageWidth = this.imageSource[id].width;
|
|
26218
|
+
let sourceImageHeight = this.imageSource[id].height;
|
|
26219
|
+
if (image.getAttrs().imageInfo) {
|
|
26220
|
+
sourceImageWidth = image.getAttrs().imageInfo.width;
|
|
26221
|
+
sourceImageHeight = image.getAttrs().imageInfo.height;
|
|
26222
|
+
}
|
|
26186
26223
|
internalImage.setAttr("imageInfo", {
|
|
26187
|
-
width:
|
|
26188
|
-
height:
|
|
26224
|
+
width: sourceImageWidth,
|
|
26225
|
+
height: sourceImageHeight
|
|
26189
26226
|
});
|
|
26190
26227
|
internalImage.zIndex(0);
|
|
26191
26228
|
image.setAttr("imageInfo", {
|
|
26192
|
-
width:
|
|
26193
|
-
height:
|
|
26229
|
+
width: sourceImageWidth,
|
|
26230
|
+
height: sourceImageHeight
|
|
26194
26231
|
});
|
|
26195
26232
|
const imageRect = image.getClientRect({ relativeTo: this.instance.getStage() });
|
|
26196
26233
|
if (!imageProps.cropInfo && !imageProps.uncroppedImage) image.setAttr("uncroppedImage", {
|
|
@@ -26251,6 +26288,9 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26251
26288
|
const internalImage = image?.findOne(`#${imageAttrs.id}-image`);
|
|
26252
26289
|
if (!this.imageState[imageAttrs.id ?? ""]?.loaded) return;
|
|
26253
26290
|
if (image && internalImage && !imageAttrs.adding && imageAttrs.cropInfo && imageAttrs.uncroppedImage) {
|
|
26291
|
+
const originalImageInfo = imageAttrs.imageInfo;
|
|
26292
|
+
const actualImageInfo = this.imageSource[imageAttrs.id ?? ""];
|
|
26293
|
+
const originalActualDiffScale = originalImageInfo ? actualImageInfo.width / originalImageInfo.width : 1;
|
|
26254
26294
|
const actualScale = imageAttrs.uncroppedImage.width / imageAttrs.imageInfo.width;
|
|
26255
26295
|
const cropScale = imageAttrs.cropInfo ? imageAttrs.cropInfo.scaleX : actualScale;
|
|
26256
26296
|
internalImage.width(imageAttrs.uncroppedImage.width);
|
|
@@ -26259,10 +26299,10 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
26259
26299
|
internalImage.scaleX(1);
|
|
26260
26300
|
internalImage.scaleY(1);
|
|
26261
26301
|
internalImage.crop({
|
|
26262
|
-
x: imageAttrs.cropInfo.x / cropScale,
|
|
26263
|
-
y: imageAttrs.cropInfo.y / cropScale,
|
|
26264
|
-
width: imageAttrs.cropInfo.width / cropScale,
|
|
26265
|
-
height: imageAttrs.cropInfo.height / cropScale
|
|
26302
|
+
x: imageAttrs.cropInfo.x / cropScale * originalActualDiffScale,
|
|
26303
|
+
y: imageAttrs.cropInfo.y / cropScale * originalActualDiffScale,
|
|
26304
|
+
width: imageAttrs.cropInfo.width / cropScale * originalActualDiffScale,
|
|
26305
|
+
height: imageAttrs.cropInfo.height / cropScale * originalActualDiffScale
|
|
26266
26306
|
});
|
|
26267
26307
|
internalImage.width(imageAttrs.cropSize.width * (actualScale / cropScale));
|
|
26268
26308
|
internalImage.height(imageAttrs.cropSize.height * (actualScale / cropScale));
|
|
@@ -34085,6 +34125,7 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
34085
34125
|
...clonedLine.getAttrs(),
|
|
34086
34126
|
hitStrokeWidth: 16
|
|
34087
34127
|
});
|
|
34128
|
+
delete finalArrow.props.dragBoundFunc;
|
|
34088
34129
|
this.instance.addNode(finalArrow, this.container?.getAttrs().id);
|
|
34089
34130
|
this.instance.emitEvent("onAddedArrow");
|
|
34090
34131
|
}
|
|
@@ -34162,8 +34203,8 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
34162
34203
|
this.state = WEAVE_STROKE_TOOL_STATE.IDLE;
|
|
34163
34204
|
this.arrowId = null;
|
|
34164
34205
|
this.shiftPressed = false;
|
|
34165
|
-
this.
|
|
34166
|
-
this.
|
|
34206
|
+
this.tempLineId = null;
|
|
34207
|
+
this.tempLineNode = null;
|
|
34167
34208
|
this.container = void 0;
|
|
34168
34209
|
this.snappedAngle = null;
|
|
34169
34210
|
this.measureContainer = void 0;
|
|
@@ -34225,8 +34266,8 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
34225
34266
|
this.state = WEAVE_STROKE_TOOL_STATE.ADDING;
|
|
34226
34267
|
return;
|
|
34227
34268
|
}
|
|
34228
|
-
if (!this.
|
|
34229
|
-
if (this.
|
|
34269
|
+
if (!this.tempLineNode && this.state === WEAVE_STROKE_TOOL_STATE.ADDING) this.handleAdding();
|
|
34270
|
+
if (this.tempLineNode && this.state === WEAVE_STROKE_TOOL_STATE.ADDING) this.state = WEAVE_STROKE_TOOL_STATE.DEFINING_SIZE;
|
|
34230
34271
|
});
|
|
34231
34272
|
stage.on("pointermove", () => {
|
|
34232
34273
|
if (this.state === WEAVE_STROKE_TOOL_STATE.IDLE) return;
|
|
@@ -34260,10 +34301,10 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
34260
34301
|
this.container = container;
|
|
34261
34302
|
this.measureContainer = measureContainer;
|
|
34262
34303
|
this.arrowId = v4_default();
|
|
34263
|
-
this.
|
|
34304
|
+
this.tempLineId = v4_default();
|
|
34264
34305
|
const nodeHandler = this.instance.getNodeHandler(WEAVE_STROKE_SINGLE_NODE_TYPE);
|
|
34265
|
-
if (!this.
|
|
34266
|
-
this.
|
|
34306
|
+
if (!this.tempLineNode && nodeHandler) {
|
|
34307
|
+
this.tempLineNode = nodeHandler.onRender({
|
|
34267
34308
|
...this.props,
|
|
34268
34309
|
x: this.clickPoint?.x ?? 0,
|
|
34269
34310
|
y: this.clickPoint?.y ?? 0,
|
|
@@ -34275,12 +34316,12 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
34275
34316
|
1
|
|
34276
34317
|
]
|
|
34277
34318
|
});
|
|
34278
|
-
this.measureContainer?.add(this.
|
|
34319
|
+
this.measureContainer?.add(this.tempLineNode);
|
|
34279
34320
|
this.setState(WEAVE_STROKE_TOOL_STATE.DEFINING_SIZE);
|
|
34280
34321
|
}
|
|
34281
34322
|
}
|
|
34282
34323
|
defineFinalPoint() {
|
|
34283
|
-
if (!this.
|
|
34324
|
+
if (!this.tempLineNode || !this.measureContainer) return {
|
|
34284
34325
|
x: 0,
|
|
34285
34326
|
y: 0
|
|
34286
34327
|
};
|
|
@@ -34290,9 +34331,9 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
34290
34331
|
y: 0
|
|
34291
34332
|
};
|
|
34292
34333
|
if (this.shiftPressed) {
|
|
34293
|
-
const linePoints = this.
|
|
34294
|
-
let dx = mousePoint.x - (this.
|
|
34295
|
-
let dy = mousePoint.y - (this.
|
|
34334
|
+
const linePoints = this.tempLineNode.getAttrs().linePoints;
|
|
34335
|
+
let dx = mousePoint.x - (this.tempLineNode.x() + linePoints[0]);
|
|
34336
|
+
let dy = mousePoint.y - (this.tempLineNode.y() + linePoints[1]);
|
|
34296
34337
|
const angle = Math.atan2(dy, dx);
|
|
34297
34338
|
const angleDeg = angle * 180 / Math.PI;
|
|
34298
34339
|
const snapped = this.snapper.apply(angleDeg);
|
|
@@ -34303,21 +34344,21 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
34303
34344
|
pos.x = linePoints[0] + dx;
|
|
34304
34345
|
pos.y = linePoints[1] + dy;
|
|
34305
34346
|
} else {
|
|
34306
|
-
pos.x = mousePoint.x - this.
|
|
34307
|
-
pos.y = mousePoint.y - this.
|
|
34347
|
+
pos.x = mousePoint.x - this.tempLineNode.x();
|
|
34348
|
+
pos.y = mousePoint.y - this.tempLineNode.y();
|
|
34308
34349
|
}
|
|
34309
34350
|
return pos;
|
|
34310
34351
|
}
|
|
34311
34352
|
handleSettingSize() {
|
|
34312
|
-
if (this.arrowId && this.
|
|
34353
|
+
if (this.arrowId && this.tempLineNode && this.measureContainer) this.cancelAction();
|
|
34313
34354
|
}
|
|
34314
34355
|
handleMovement() {
|
|
34315
34356
|
if (this.state !== WEAVE_STROKE_TOOL_STATE.DEFINING_SIZE) return;
|
|
34316
34357
|
const nodeHandler = this.instance.getNodeHandler(WEAVE_STROKE_SINGLE_NODE_TYPE);
|
|
34317
|
-
if (this.
|
|
34358
|
+
if (this.tempLineNode && this.measureContainer && nodeHandler) {
|
|
34318
34359
|
const pos = this.defineFinalPoint();
|
|
34319
|
-
const linePoints = this.
|
|
34320
|
-
this.
|
|
34360
|
+
const linePoints = this.tempLineNode.getAttrs().linePoints;
|
|
34361
|
+
this.tempLineNode.setAttrs({
|
|
34321
34362
|
...this.props,
|
|
34322
34363
|
linePoints: [
|
|
34323
34364
|
linePoints[0],
|
|
@@ -34326,7 +34367,7 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
34326
34367
|
pos.y
|
|
34327
34368
|
]
|
|
34328
34369
|
});
|
|
34329
|
-
nodeHandler.updateLine(this.
|
|
34370
|
+
nodeHandler.updateLine(this.tempLineNode);
|
|
34330
34371
|
}
|
|
34331
34372
|
}
|
|
34332
34373
|
trigger(cancelAction) {
|
|
@@ -34343,19 +34384,20 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
34343
34384
|
}
|
|
34344
34385
|
cleanup() {
|
|
34345
34386
|
const stage = this.instance.getStage();
|
|
34346
|
-
this.
|
|
34387
|
+
this.tempLineNode?.destroy();
|
|
34347
34388
|
let nodeCreated = false;
|
|
34348
|
-
if (this.arrowId && this.
|
|
34389
|
+
if (this.arrowId && this.tempLineNode?.getAttrs().linePoints.length === 4 && !this.tempLineNode?.getAttrs().linePoints.every((coord) => coord === 0)) {
|
|
34349
34390
|
const nodeHandler = this.instance.getNodeHandler(WEAVE_STROKE_SINGLE_NODE_TYPE);
|
|
34350
34391
|
if (nodeHandler) {
|
|
34351
|
-
const
|
|
34352
|
-
this.
|
|
34353
|
-
const
|
|
34392
|
+
const clonedLine = this.tempLineNode.clone();
|
|
34393
|
+
this.tempLineNode.destroy();
|
|
34394
|
+
const finalLine = nodeHandler.create(this.arrowId, {
|
|
34354
34395
|
...this.props,
|
|
34355
|
-
...
|
|
34396
|
+
...clonedLine.getAttrs(),
|
|
34356
34397
|
hitStrokeWidth: 16
|
|
34357
34398
|
});
|
|
34358
|
-
|
|
34399
|
+
delete finalLine.props.dragBoundFunc;
|
|
34400
|
+
this.instance.addNode(finalLine, this.container?.getAttrs().id);
|
|
34359
34401
|
this.instance.emitEvent("onAddedStroke", { actionName: this.instance.getActiveAction() ?? WEAVE_STROKE_TOOL_ACTION_NAME });
|
|
34360
34402
|
nodeCreated = true;
|
|
34361
34403
|
}
|
|
@@ -34369,8 +34411,8 @@ var WeaveStrokeToolAction = class extends WeaveAction {
|
|
|
34369
34411
|
stage.container().style.cursor = "default";
|
|
34370
34412
|
this.initialCursor = null;
|
|
34371
34413
|
this.arrowId = null;
|
|
34372
|
-
this.
|
|
34373
|
-
this.
|
|
34414
|
+
this.tempLineId = null;
|
|
34415
|
+
this.tempLineNode = null;
|
|
34374
34416
|
this.container = void 0;
|
|
34375
34417
|
this.measureContainer = void 0;
|
|
34376
34418
|
this.clickPoint = null;
|
|
@@ -38778,5 +38820,5 @@ const setupCanvasBackend = async () => {
|
|
|
38778
38820
|
};
|
|
38779
38821
|
|
|
38780
38822
|
//#endregion
|
|
38781
|
-
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_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, IMAGE_TOOL_ACTION_NAME, IMAGE_TOOL_STATE, 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_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_COLOR, WEAVE_GRID_DEFAULT_DOT_MAX_DOTS_PER_AXIS, 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_ANCHOR_POSITION, WEAVE_IMAGE_CROP_END_TYPE, WEAVE_IMAGE_DEFAULT_CONFIG, WEAVE_IMAGE_NODE_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_GRID_PLUGIN_KEY, 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_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_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, WeaveLayerNode, WeaveLineNode, WeaveLineToolAction, WeaveMeasureNode, WeaveMeasureToolAction, WeaveMoveToolAction, WeaveNode, WeaveNodesDistanceSnappingPlugin, WeaveNodesEdgeSnappingPlugin, WeaveNodesMultiSelectionFeedbackPlugin, WeaveNodesSelectionPlugin, WeavePenToolAction, WeavePlugin, WeaveRectangleNode, WeaveRectangleToolAction, WeaveRegularPolygonNode, WeaveRegularPolygonToolAction, 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, getBoundingBox, getExportBoundingBox, getPositionRelativeToContainerOnPosition, getSelectedNodesMetadata, getStageClickPoint, getTargetAndSkipNodes, getTargetedNode, getTopmostShadowHost, getVisibleNodes, getVisibleNodesInViewport, hasFrames, hasImages, intersectArrays, isIOS, isInShadowDOM, isNodeInSelection, isServer, memoize, mergeExceptArrays, moveNodeToContainer, resetScale, setupCanvasBackend, setupSkiaBackend };
|
|
38823
|
+
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_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, IMAGE_TOOL_ACTION_NAME, IMAGE_TOOL_STATE, 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_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_COLOR, WEAVE_GRID_DEFAULT_DOT_MAX_DOTS_PER_AXIS, 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_ANCHOR_POSITION, WEAVE_IMAGE_CROP_END_TYPE, WEAVE_IMAGE_DEFAULT_CONFIG, WEAVE_IMAGE_NODE_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_GRID_PLUGIN_KEY, 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_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, WeaveLayerNode, WeaveLineNode, WeaveLineToolAction, WeaveMeasureNode, WeaveMeasureToolAction, WeaveMoveToolAction, WeaveNode, WeaveNodesDistanceSnappingPlugin, WeaveNodesEdgeSnappingPlugin, WeaveNodesMultiSelectionFeedbackPlugin, WeaveNodesSelectionPlugin, WeavePenToolAction, WeavePlugin, WeaveRectangleNode, WeaveRectangleToolAction, WeaveRegularPolygonNode, WeaveRegularPolygonToolAction, 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, getBoundingBox, getExportBoundingBox, getPositionRelativeToContainerOnPosition, getSelectedNodesMetadata, getStageClickPoint, getTargetAndSkipNodes, getTargetedNode, getTopmostShadowHost, getVisibleNodes, getVisibleNodesInViewport, hasFrames, hasImages, intersectArrays, isIOS, isInShadowDOM, isNodeInSelection, isServer, memoize, mergeExceptArrays, moveNodeToContainer, resetScale, setupCanvasBackend, setupSkiaBackend };
|
|
38782
38824
|
//# sourceMappingURL=sdk.node.js.map
|