@inditextech/weave-sdk 0.76.1 → 0.76.3
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 +88 -63
- package/dist/sdk.d.cts +1 -1
- package/dist/sdk.d.cts.map +1 -1
- package/dist/sdk.d.ts +1 -1
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +88 -63
- package/dist/sdk.js.map +1 -1
- package/package.json +2 -2
package/dist/sdk.js
CHANGED
|
@@ -17342,7 +17342,6 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
17342
17342
|
this.selecting = false;
|
|
17343
17343
|
this.stopPanLoop();
|
|
17344
17344
|
this.hideSelectorArea();
|
|
17345
|
-
this.handleClickOrTap(e);
|
|
17346
17345
|
return;
|
|
17347
17346
|
}
|
|
17348
17347
|
const isStage = e.target instanceof Konva.Stage;
|
|
@@ -17445,6 +17444,14 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
17445
17444
|
return;
|
|
17446
17445
|
}
|
|
17447
17446
|
if (contextMenuPlugin?.isContextMenuVisible()) this.stopPanLoop();
|
|
17447
|
+
const selectedGroup = getTargetedNode(this.instance);
|
|
17448
|
+
if (!moved && selectedGroup?.getParent() instanceof Konva.Transformer) {
|
|
17449
|
+
this.selecting = false;
|
|
17450
|
+
this.stopPanLoop();
|
|
17451
|
+
this.hideSelectorArea();
|
|
17452
|
+
this.handleClickOrTap(e);
|
|
17453
|
+
return;
|
|
17454
|
+
}
|
|
17448
17455
|
if (!this.selectionRectangle.visible()) {
|
|
17449
17456
|
this.hideSelectorArea();
|
|
17450
17457
|
return;
|
|
@@ -17796,12 +17803,12 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
|
|
|
17796
17803
|
this.createPasteCatcher();
|
|
17797
17804
|
const catcher = this.getCatcherElement();
|
|
17798
17805
|
window.addEventListener("keydown", async (e) => {
|
|
17799
|
-
if (stage.isFocused() && e.
|
|
17806
|
+
if (stage.isFocused() && e.code === "KeyC" && (e.ctrlKey || e.metaKey)) {
|
|
17800
17807
|
e.preventDefault();
|
|
17801
17808
|
await this.performCopy();
|
|
17802
17809
|
return;
|
|
17803
17810
|
}
|
|
17804
|
-
if (stage.isFocused() && e.
|
|
17811
|
+
if (stage.isFocused() && e.code === "KeyV" && (e.ctrlKey || e.metaKey)) {
|
|
17805
17812
|
this.focusPasteCatcher();
|
|
17806
17813
|
if (!this.enabled) return;
|
|
17807
17814
|
}
|
|
@@ -18387,24 +18394,26 @@ var WeaveNode = class {
|
|
|
18387
18394
|
const stage = this.instance.getStage();
|
|
18388
18395
|
const activeAction = this.instance.getActiveAction();
|
|
18389
18396
|
const isNodeSelectionEnabled = this.getSelectionPlugin()?.isEnabled();
|
|
18397
|
+
const realNode = this.instance.getInstanceRecursive(node);
|
|
18390
18398
|
const isTargetable = node.getAttrs().isTargetable !== false;
|
|
18391
18399
|
const isLocked = node.getAttrs().locked ?? false;
|
|
18392
18400
|
if ([MOVE_TOOL_ACTION_NAME].includes(activeAction ?? "")) return false;
|
|
18393
18401
|
let showHover = false;
|
|
18394
18402
|
let cancelBubble = false;
|
|
18395
|
-
if (isNodeSelectionEnabled && this.isSelecting() && !this.isNodeSelected(
|
|
18403
|
+
if (isNodeSelectionEnabled && this.isSelecting() && !this.isNodeSelected(realNode) && !this.isPasting() && isLocked) {
|
|
18396
18404
|
const stage$1 = this.instance.getStage();
|
|
18397
18405
|
stage$1.container().style.cursor = "default";
|
|
18398
18406
|
cancelBubble = true;
|
|
18399
18407
|
}
|
|
18400
|
-
if (isNodeSelectionEnabled && this.isSelecting() && !this.isNodeSelected(
|
|
18408
|
+
if (isNodeSelectionEnabled && this.isSelecting() && !this.isNodeSelected(realNode) && !this.isPasting() && isTargetable && !isLocked && stage.mode() === WEAVE_STAGE_DEFAULT_MODE) {
|
|
18401
18409
|
const stage$1 = this.instance.getStage();
|
|
18402
18410
|
showHover = true;
|
|
18403
18411
|
stage$1.container().style.cursor = "pointer";
|
|
18404
18412
|
cancelBubble = true;
|
|
18405
18413
|
}
|
|
18406
|
-
if (isNodeSelectionEnabled && this.isSelecting() && this.isNodeSelected(
|
|
18414
|
+
if (isNodeSelectionEnabled && this.isSelecting() && this.isNodeSelected(realNode) && !this.isPasting() && isTargetable && !isLocked && stage.mode() === WEAVE_STAGE_DEFAULT_MODE) {
|
|
18407
18415
|
const stage$1 = this.instance.getStage();
|
|
18416
|
+
showHover = true;
|
|
18408
18417
|
stage$1.container().style.cursor = "grab";
|
|
18409
18418
|
cancelBubble = true;
|
|
18410
18419
|
}
|
|
@@ -18414,7 +18423,7 @@ var WeaveNode = class {
|
|
|
18414
18423
|
stage$1.container().style.cursor = "crosshair";
|
|
18415
18424
|
cancelBubble = true;
|
|
18416
18425
|
}
|
|
18417
|
-
if (showHover) this.setHoverState(
|
|
18426
|
+
if (showHover) this.setHoverState(realNode);
|
|
18418
18427
|
else this.hideHoverState();
|
|
18419
18428
|
return cancelBubble;
|
|
18420
18429
|
}
|
|
@@ -19985,7 +19994,7 @@ var WeaveRegisterManager = class {
|
|
|
19985
19994
|
|
|
19986
19995
|
//#endregion
|
|
19987
19996
|
//#region package.json
|
|
19988
|
-
var version = "0.76.
|
|
19997
|
+
var version = "0.76.3";
|
|
19989
19998
|
|
|
19990
19999
|
//#endregion
|
|
19991
20000
|
//#region src/managers/setup.ts
|
|
@@ -20301,6 +20310,17 @@ var WeaveExportManager = class {
|
|
|
20301
20310
|
}
|
|
20302
20311
|
});
|
|
20303
20312
|
}
|
|
20313
|
+
unpremultiply(data) {
|
|
20314
|
+
for (let i = 0; i < data.length; i += 4) {
|
|
20315
|
+
const a = data[i + 3];
|
|
20316
|
+
if (a && a < 255) {
|
|
20317
|
+
const alpha = a / 255;
|
|
20318
|
+
data[i] = Math.min(255, Math.round(data[i] / alpha));
|
|
20319
|
+
data[i + 1] = Math.min(255, Math.round(data[i + 1] / alpha));
|
|
20320
|
+
data[i + 2] = Math.min(255, Math.round(data[i + 2] / alpha));
|
|
20321
|
+
}
|
|
20322
|
+
}
|
|
20323
|
+
}
|
|
20304
20324
|
async exportNodesAsBuffer(nodes, boundingNodes, options) {
|
|
20305
20325
|
const { format: format$2 = WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
|
|
20306
20326
|
this.getNodesSelectionPlugin()?.disable();
|
|
@@ -20359,7 +20379,6 @@ var WeaveExportManager = class {
|
|
|
20359
20379
|
}
|
|
20360
20380
|
mainLayer.add(exportGroup);
|
|
20361
20381
|
const backgroundRect = background.getClientRect();
|
|
20362
|
-
stage.batchDraw();
|
|
20363
20382
|
const composites = [];
|
|
20364
20383
|
const imageWidth = Math.round(backgroundRect.width);
|
|
20365
20384
|
const imageHeight = Math.round(backgroundRect.height);
|
|
@@ -21465,7 +21484,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
21465
21484
|
this.instance.emitEvent("onTransform", null);
|
|
21466
21485
|
});
|
|
21467
21486
|
if (!this.instance.getConfiguration().serverSide) window.addEventListener("keypress", (e) => {
|
|
21468
|
-
if (e.
|
|
21487
|
+
if (e.code === "Enter" && this.instance.getActiveAction() === SELECTION_TOOL_ACTION_NAME && !this.editing && e.target !== this.textArea) {
|
|
21469
21488
|
e.preventDefault();
|
|
21470
21489
|
if (this.isSelecting() && this.isNodeSelected(text)) {
|
|
21471
21490
|
const nodesSelectionPlugin = this.instance.getPlugin("nodesSelection");
|
|
@@ -21589,7 +21608,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
21589
21608
|
height = height + textSize.height * (textNode.lineHeight() ?? 1);
|
|
21590
21609
|
}
|
|
21591
21610
|
return {
|
|
21592
|
-
width,
|
|
21611
|
+
width: width * 1.01,
|
|
21593
21612
|
height
|
|
21594
21613
|
};
|
|
21595
21614
|
}
|
|
@@ -21736,7 +21755,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
21736
21755
|
if (!textNode.getAttrs().layout || textNode.getAttrs().layout === TEXT_LAYOUT.AUTO_HEIGHT || textNode.getAttrs().layout === TEXT_LAYOUT.AUTO_ALL) textNode.height(this.textArea.scrollHeight * (1 / textNode.getAbsoluteScale().x));
|
|
21737
21756
|
};
|
|
21738
21757
|
const handleKeyDown = (e) => {
|
|
21739
|
-
if (this.textArea && textNode && e.
|
|
21758
|
+
if (this.textArea && textNode && e.code === "Escape") {
|
|
21740
21759
|
e.stopPropagation();
|
|
21741
21760
|
updateTextNodeSize();
|
|
21742
21761
|
textNode.text(this.textArea.value);
|
|
@@ -22048,7 +22067,7 @@ var WeaveImageCrop = class WeaveImageCrop {
|
|
|
22048
22067
|
if (!["Enter", "Escape"].includes(e.key)) return;
|
|
22049
22068
|
this.cropping = false;
|
|
22050
22069
|
this.image.setAttrs({ cropping: false });
|
|
22051
|
-
if (e.
|
|
22070
|
+
if (e.code === "Enter") this.handleClipEnd();
|
|
22052
22071
|
const stage = this.instance.getStage();
|
|
22053
22072
|
this.onClose();
|
|
22054
22073
|
const utilityLayer = this.instance.getUtilityLayer();
|
|
@@ -22240,7 +22259,6 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
22240
22259
|
this.lastTapTime = 0;
|
|
22241
22260
|
this.config = mergeExceptArrays(WEAVE_IMAGE_DEFAULT_CONFIG, config);
|
|
22242
22261
|
this.imageCrop = null;
|
|
22243
|
-
this.cachedCropInfo = {};
|
|
22244
22262
|
this.imageLoaded = false;
|
|
22245
22263
|
}
|
|
22246
22264
|
triggerCrop(imageNode) {
|
|
@@ -22279,7 +22297,6 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
22279
22297
|
if (!internalImage || !cropGroup) return;
|
|
22280
22298
|
const imageCrop = new WeaveImageCrop(this.instance, this, imageNode, internalImage, cropGroup);
|
|
22281
22299
|
imageCrop.unCrop();
|
|
22282
|
-
this.cachedCropInfo[imageNode.getAttrs().id ?? ""] = void 0;
|
|
22283
22300
|
};
|
|
22284
22301
|
loadAsyncElement(nodeId) {
|
|
22285
22302
|
this.instance.loadAsyncElement(nodeId, "image");
|
|
@@ -22310,7 +22327,6 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
22310
22327
|
const stage = this.instance.getStage();
|
|
22311
22328
|
const image$1 = stage.findOne(`#${id}`);
|
|
22312
22329
|
if (!image$1) return;
|
|
22313
|
-
this.cachedCropInfo[image$1.getAttrs().id ?? ""] = void 0;
|
|
22314
22330
|
};
|
|
22315
22331
|
image.triggerCrop = () => {
|
|
22316
22332
|
this.triggerCrop(image);
|
|
@@ -22324,7 +22340,6 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
22324
22340
|
if (!image$1) return;
|
|
22325
22341
|
const imageCrop = new WeaveImageCrop(this.instance, this, image$1, internalImage, cropGroup);
|
|
22326
22342
|
imageCrop.unCrop();
|
|
22327
|
-
this.cachedCropInfo[image$1.getAttrs().id ?? ""] = void 0;
|
|
22328
22343
|
};
|
|
22329
22344
|
const defaultTransformerProperties = this.defaultGetTransformerProperties(this.config.transform);
|
|
22330
22345
|
image.getTransformerProperties = function() {
|
|
@@ -22387,31 +22402,30 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
22387
22402
|
this.config.onDblClick?.(this, image);
|
|
22388
22403
|
};
|
|
22389
22404
|
if (this.imageSource[id]) {
|
|
22390
|
-
imagePlaceholder
|
|
22391
|
-
|
|
22392
|
-
|
|
22393
|
-
|
|
22394
|
-
});
|
|
22395
|
-
internalImage?.setAttrs({
|
|
22396
|
-
width: imageProps.width ? imageProps.width : this.imageSource[id].width,
|
|
22397
|
-
height: imageProps.height ? imageProps.height : this.imageSource[id].height,
|
|
22405
|
+
imagePlaceholder.destroy();
|
|
22406
|
+
internalImage.setAttrs({
|
|
22407
|
+
width: this.imageSource[id].width,
|
|
22408
|
+
height: this.imageSource[id].height,
|
|
22398
22409
|
image: this.imageSource[id],
|
|
22399
22410
|
visible: true
|
|
22400
22411
|
});
|
|
22401
22412
|
this.imageLoaded = true;
|
|
22402
|
-
image.setAttr("width",
|
|
22403
|
-
image.setAttr("height",
|
|
22404
|
-
image.setAttr("cropInfo", void 0);
|
|
22405
|
-
image.setAttr("uncroppedImage", {
|
|
22406
|
-
width:
|
|
22407
|
-
height:
|
|
22413
|
+
image.setAttr("width", this.imageSource[id].width);
|
|
22414
|
+
image.setAttr("height", this.imageSource[id].height);
|
|
22415
|
+
image.setAttr("cropInfo", props.cropInfo ?? void 0);
|
|
22416
|
+
image.setAttr("uncroppedImage", props.uncroppedImage ?? {
|
|
22417
|
+
width: this.imageSource[id].width,
|
|
22418
|
+
height: this.imageSource[id].height
|
|
22408
22419
|
});
|
|
22409
22420
|
image.setAttr("imageInfo", {
|
|
22410
22421
|
width: this.imageSource[id].width,
|
|
22411
22422
|
height: this.imageSource[id].height
|
|
22412
22423
|
});
|
|
22413
22424
|
this.instance.updateNode(this.serialize(image));
|
|
22414
|
-
} else
|
|
22425
|
+
} else {
|
|
22426
|
+
this.updatePlaceholderSize(image, imagePlaceholder);
|
|
22427
|
+
this.loadImage(imageProps, image);
|
|
22428
|
+
}
|
|
22415
22429
|
image.setAttr("imageURL", imageProps.imageURL);
|
|
22416
22430
|
return image;
|
|
22417
22431
|
}
|
|
@@ -22571,12 +22585,25 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
22571
22585
|
}
|
|
22572
22586
|
});
|
|
22573
22587
|
}
|
|
22588
|
+
updatePlaceholderSize(image, imagePlaceholder) {
|
|
22589
|
+
const imageAttrs = image.getAttrs();
|
|
22590
|
+
if (!imageAttrs.adding && imageAttrs.cropInfo) {
|
|
22591
|
+
const actualScale = imageAttrs.uncroppedImage.width / imageAttrs.imageInfo.width;
|
|
22592
|
+
const cropScale = imageAttrs.cropInfo ? imageAttrs.cropInfo.scaleX : actualScale;
|
|
22593
|
+
imagePlaceholder.width(imageAttrs.cropSize.width * (actualScale / cropScale));
|
|
22594
|
+
imagePlaceholder.height(imageAttrs.cropSize.height * (actualScale / cropScale));
|
|
22595
|
+
}
|
|
22596
|
+
if (!imageAttrs.adding && !imageAttrs.cropInfo) {
|
|
22597
|
+
imagePlaceholder.width(imageAttrs.uncroppedImage.width);
|
|
22598
|
+
imagePlaceholder.height(imageAttrs.uncroppedImage.height);
|
|
22599
|
+
}
|
|
22600
|
+
}
|
|
22574
22601
|
updateImageCrop(nextProps) {
|
|
22575
22602
|
const imageAttrs = nextProps;
|
|
22576
22603
|
const stage = this.instance.getStage();
|
|
22577
22604
|
const image = stage.findOne(`#${imageAttrs.id}`);
|
|
22578
22605
|
const internalImage = image?.findOne(`#${imageAttrs.id}-image`);
|
|
22579
|
-
if (image && internalImage && !imageAttrs.adding && imageAttrs.cropInfo
|
|
22606
|
+
if (image && internalImage && !imageAttrs.adding && imageAttrs.cropInfo) {
|
|
22580
22607
|
const actualScale = imageAttrs.uncroppedImage.width / imageAttrs.imageInfo.width;
|
|
22581
22608
|
const cropScale = imageAttrs.cropInfo ? imageAttrs.cropInfo.scaleX : actualScale;
|
|
22582
22609
|
internalImage.width(imageAttrs.uncroppedImage.width);
|
|
@@ -22592,9 +22619,8 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
22592
22619
|
});
|
|
22593
22620
|
internalImage.width(imageAttrs.cropSize.width * (actualScale / cropScale));
|
|
22594
22621
|
internalImage.height(imageAttrs.cropSize.height * (actualScale / cropScale));
|
|
22595
|
-
this.cachedCropInfo[imageAttrs.id ?? ""] = imageAttrs.cropInfo;
|
|
22596
22622
|
}
|
|
22597
|
-
if (image && internalImage && !imageAttrs.adding && !imageAttrs.cropInfo
|
|
22623
|
+
if (image && internalImage && !imageAttrs.adding && !imageAttrs.cropInfo) {
|
|
22598
22624
|
internalImage.width(imageAttrs.uncroppedImage.width);
|
|
22599
22625
|
internalImage.height(imageAttrs.uncroppedImage.height);
|
|
22600
22626
|
internalImage.rotation(0);
|
|
@@ -22603,7 +22629,6 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
22603
22629
|
internalImage.crop(void 0);
|
|
22604
22630
|
internalImage.width(imageAttrs.uncroppedImage.width);
|
|
22605
22631
|
internalImage.height(imageAttrs.uncroppedImage.height);
|
|
22606
|
-
this.cachedCropInfo[imageAttrs.id ?? ""] = void 0;
|
|
22607
22632
|
}
|
|
22608
22633
|
}
|
|
22609
22634
|
getImageSource(imageId) {
|
|
@@ -23136,7 +23161,7 @@ var WeaveFrameNode = class extends WeaveNode {
|
|
|
23136
23161
|
});
|
|
23137
23162
|
}
|
|
23138
23163
|
const nodesSelectionPlugin = this.instance.getPlugin("nodesSelection");
|
|
23139
|
-
if (nodesSelectionPlugin) nodesSelectionPlugin.getTransformer()
|
|
23164
|
+
if (nodesSelectionPlugin) nodesSelectionPlugin.getTransformer()?.forceUpdate();
|
|
23140
23165
|
}
|
|
23141
23166
|
serialize(instance) {
|
|
23142
23167
|
const stage = this.instance.getStage();
|
|
@@ -25247,7 +25272,7 @@ var WeaveMoveToolAction = class extends WeaveAction {
|
|
|
25247
25272
|
setupEvents() {
|
|
25248
25273
|
const stage = this.instance.getStage();
|
|
25249
25274
|
window.addEventListener("keydown", (e) => {
|
|
25250
|
-
if (e.
|
|
25275
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === MOVE_TOOL_ACTION_NAME) {
|
|
25251
25276
|
this.cancelAction();
|
|
25252
25277
|
return;
|
|
25253
25278
|
}
|
|
@@ -25402,7 +25427,7 @@ var WeaveEraserToolAction = class extends WeaveAction {
|
|
|
25402
25427
|
}
|
|
25403
25428
|
});
|
|
25404
25429
|
window.addEventListener("keydown", (e) => {
|
|
25405
|
-
if (e.
|
|
25430
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === ERASER_TOOL_ACTION_NAME) {
|
|
25406
25431
|
this.cancelAction();
|
|
25407
25432
|
return;
|
|
25408
25433
|
}
|
|
@@ -25500,11 +25525,11 @@ var WeaveRectangleToolAction = class extends WeaveAction {
|
|
|
25500
25525
|
setupEvents() {
|
|
25501
25526
|
const stage = this.instance.getStage();
|
|
25502
25527
|
window.addEventListener("keydown", (e) => {
|
|
25503
|
-
if (e.
|
|
25528
|
+
if (e.code === "Enter" && this.instance.getActiveAction() === RECTANGLE_TOOL_ACTION_NAME) {
|
|
25504
25529
|
this.cancelAction();
|
|
25505
25530
|
return;
|
|
25506
25531
|
}
|
|
25507
|
-
if (e.
|
|
25532
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === RECTANGLE_TOOL_ACTION_NAME) {
|
|
25508
25533
|
this.cancelAction();
|
|
25509
25534
|
return;
|
|
25510
25535
|
}
|
|
@@ -25709,11 +25734,11 @@ var WeaveEllipseToolAction = class extends WeaveAction {
|
|
|
25709
25734
|
setupEvents() {
|
|
25710
25735
|
const stage = this.instance.getStage();
|
|
25711
25736
|
window.addEventListener("keydown", (e) => {
|
|
25712
|
-
if (e.
|
|
25737
|
+
if (e.code === "Enter" && this.instance.getActiveAction() === ELLIPSE_TOOL_ACTION_NAME) {
|
|
25713
25738
|
this.cancelAction();
|
|
25714
25739
|
return;
|
|
25715
25740
|
}
|
|
25716
|
-
if (e.
|
|
25741
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === ELLIPSE_TOOL_ACTION_NAME) {
|
|
25717
25742
|
this.cancelAction();
|
|
25718
25743
|
return;
|
|
25719
25744
|
}
|
|
@@ -25925,11 +25950,11 @@ var WeavePenToolAction = class extends WeaveAction {
|
|
|
25925
25950
|
setupEvents() {
|
|
25926
25951
|
const stage = this.instance.getStage();
|
|
25927
25952
|
window.addEventListener("keydown", (e) => {
|
|
25928
|
-
if (e.
|
|
25953
|
+
if (e.code === "Enter" && this.instance.getActiveAction() === PEN_TOOL_ACTION_NAME) {
|
|
25929
25954
|
this.cancelAction();
|
|
25930
25955
|
return;
|
|
25931
25956
|
}
|
|
25932
|
-
if (e.
|
|
25957
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === PEN_TOOL_ACTION_NAME) {
|
|
25933
25958
|
this.cancelAction();
|
|
25934
25959
|
return;
|
|
25935
25960
|
}
|
|
@@ -26177,11 +26202,11 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
26177
26202
|
setupEvents() {
|
|
26178
26203
|
const stage = this.instance.getStage();
|
|
26179
26204
|
window.addEventListener("keydown", (e) => {
|
|
26180
|
-
if (e.
|
|
26205
|
+
if (e.code === "Enter" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) {
|
|
26181
26206
|
this.cancelAction();
|
|
26182
26207
|
return;
|
|
26183
26208
|
}
|
|
26184
|
-
if (e.
|
|
26209
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) {
|
|
26185
26210
|
this.cancelAction();
|
|
26186
26211
|
return;
|
|
26187
26212
|
}
|
|
@@ -26406,7 +26431,7 @@ var WeaveTextToolAction = class extends WeaveAction {
|
|
|
26406
26431
|
setupEvents() {
|
|
26407
26432
|
const stage = this.instance.getStage();
|
|
26408
26433
|
window.addEventListener("keydown", (e) => {
|
|
26409
|
-
if (e.
|
|
26434
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === TEXT_TOOL_ACTION_NAME) {
|
|
26410
26435
|
this.cancelAction();
|
|
26411
26436
|
return;
|
|
26412
26437
|
}
|
|
@@ -26558,7 +26583,7 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
26558
26583
|
setupEvents() {
|
|
26559
26584
|
const stage = this.instance.getStage();
|
|
26560
26585
|
window.addEventListener("keydown", (e) => {
|
|
26561
|
-
if (e.
|
|
26586
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === IMAGE_TOOL_ACTION_NAME) {
|
|
26562
26587
|
this.cancelAction();
|
|
26563
26588
|
return;
|
|
26564
26589
|
}
|
|
@@ -26820,11 +26845,11 @@ var WeaveStarToolAction = class extends WeaveAction {
|
|
|
26820
26845
|
setupEvents() {
|
|
26821
26846
|
const stage = this.instance.getStage();
|
|
26822
26847
|
window.addEventListener("keydown", (e) => {
|
|
26823
|
-
if (e.
|
|
26848
|
+
if (e.code === "Enter" && this.instance.getActiveAction() === STAR_TOOL_ACTION_NAME) {
|
|
26824
26849
|
this.cancelAction();
|
|
26825
26850
|
return;
|
|
26826
26851
|
}
|
|
26827
|
-
if (e.
|
|
26852
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === STAR_TOOL_ACTION_NAME) {
|
|
26828
26853
|
this.cancelAction();
|
|
26829
26854
|
return;
|
|
26830
26855
|
}
|
|
@@ -27042,11 +27067,11 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
27042
27067
|
setupEvents() {
|
|
27043
27068
|
const stage = this.instance.getStage();
|
|
27044
27069
|
window.addEventListener("keydown", (e) => {
|
|
27045
|
-
if (e.
|
|
27070
|
+
if (e.code === "Enter" && this.instance.getActiveAction() === ARROW_TOOL_ACTION_NAME) {
|
|
27046
27071
|
this.cancelAction();
|
|
27047
27072
|
return;
|
|
27048
27073
|
}
|
|
27049
|
-
if (e.
|
|
27074
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === ARROW_TOOL_ACTION_NAME) {
|
|
27050
27075
|
this.cancelAction();
|
|
27051
27076
|
return;
|
|
27052
27077
|
}
|
|
@@ -27293,11 +27318,11 @@ var WeaveRegularPolygonToolAction = class extends WeaveAction {
|
|
|
27293
27318
|
setupEvents() {
|
|
27294
27319
|
const stage = this.instance.getStage();
|
|
27295
27320
|
window.addEventListener("keydown", (e) => {
|
|
27296
|
-
if (e.
|
|
27321
|
+
if (e.code === "Enter" && this.instance.getActiveAction() === REGULAR_POLYGON_TOOL_ACTION_NAME) {
|
|
27297
27322
|
this.cancelAction();
|
|
27298
27323
|
return;
|
|
27299
27324
|
}
|
|
27300
|
-
if (e.
|
|
27325
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === REGULAR_POLYGON_TOOL_ACTION_NAME) {
|
|
27301
27326
|
this.cancelAction();
|
|
27302
27327
|
return;
|
|
27303
27328
|
}
|
|
@@ -27494,7 +27519,7 @@ var WeaveFrameToolAction = class extends WeaveAction {
|
|
|
27494
27519
|
setupEvents() {
|
|
27495
27520
|
const stage = this.instance.getStage();
|
|
27496
27521
|
window.addEventListener("keydown", (e) => {
|
|
27497
|
-
if (e.
|
|
27522
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === FRAME_TOOL_ACTION_NAME) {
|
|
27498
27523
|
this.cancelAction();
|
|
27499
27524
|
return;
|
|
27500
27525
|
}
|
|
@@ -28051,11 +28076,11 @@ var WeaveCommentToolAction = class extends WeaveAction {
|
|
|
28051
28076
|
window.addEventListener("keydown", (e) => {
|
|
28052
28077
|
if (this.instance.getActiveAction() !== WEAVE_COMMENT_TOOL_ACTION_NAME) return;
|
|
28053
28078
|
if (commentNodeHandler?.isCommentViewing()) return;
|
|
28054
|
-
if (e.
|
|
28079
|
+
if (e.code === "Escape" && this.state == WEAVE_COMMENT_TOOL_STATE.ADDING) {
|
|
28055
28080
|
this.cancelAction();
|
|
28056
28081
|
return;
|
|
28057
28082
|
}
|
|
28058
|
-
if (e.
|
|
28083
|
+
if (e.code === "Escape" && this.state === WEAVE_COMMENT_TOOL_STATE.CREATING_COMMENT) this.setState(WEAVE_COMMENT_TOOL_STATE.ADDING);
|
|
28059
28084
|
});
|
|
28060
28085
|
stage.on("pointermove", (e) => {
|
|
28061
28086
|
if (this.state === WEAVE_COMMENT_TOOL_STATE.IDLE) return;
|
|
@@ -28249,7 +28274,7 @@ var WeaveVideoToolAction = class extends WeaveAction {
|
|
|
28249
28274
|
setupEvents() {
|
|
28250
28275
|
const stage = this.instance.getStage();
|
|
28251
28276
|
window.addEventListener("keydown", (e) => {
|
|
28252
|
-
if (e.
|
|
28277
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === VIDEO_TOOL_ACTION_NAME) {
|
|
28253
28278
|
this.cancelAction();
|
|
28254
28279
|
return;
|
|
28255
28280
|
}
|
|
@@ -30617,10 +30642,10 @@ var WeaveStageKeyboardMovePlugin = class extends WeavePlugin {
|
|
|
30617
30642
|
}
|
|
30618
30643
|
onInit() {
|
|
30619
30644
|
window.addEventListener("keydown", (e) => {
|
|
30620
|
-
if (e.
|
|
30621
|
-
if (e.
|
|
30622
|
-
if (e.
|
|
30623
|
-
if (e.
|
|
30645
|
+
if (e.code === "ArrowUp" && e.shiftKey) this.handleNodesMovement("up");
|
|
30646
|
+
if (e.code === "ArrowLeft" && e.shiftKey) this.handleNodesMovement("left");
|
|
30647
|
+
if (e.code === "ArrowRight" && e.shiftKey) this.handleNodesMovement("right");
|
|
30648
|
+
if (e.code === "ArrowDown" && e.shiftKey) this.handleNodesMovement("down");
|
|
30624
30649
|
});
|
|
30625
30650
|
}
|
|
30626
30651
|
enable() {
|