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