@inditextech/weave-sdk 0.76.0 → 0.76.2
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 +115 -75
- package/dist/sdk.d.cts +2 -1
- package/dist/sdk.d.cts.map +1 -1
- package/dist/sdk.d.ts +2 -1
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +115 -75
- package/dist/sdk.js.map +1 -1
- package/package.json +2 -2
package/dist/sdk.cjs
CHANGED
|
@@ -19875,7 +19875,8 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
19875
19875
|
const tr = new konva.default.Transformer({
|
|
19876
19876
|
id: "selectionTransformer",
|
|
19877
19877
|
...this.config.selection,
|
|
19878
|
-
listening: true
|
|
19878
|
+
listening: true,
|
|
19879
|
+
shouldOverdrawWholeArea: true
|
|
19879
19880
|
});
|
|
19880
19881
|
selectionLayer?.add(tr);
|
|
19881
19882
|
const trHover = new konva.default.Transformer({
|
|
@@ -19922,15 +19923,29 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
19922
19923
|
this.enable();
|
|
19923
19924
|
if (shape) {
|
|
19924
19925
|
const targetNode = this.instance.getInstanceRecursive(shape);
|
|
19926
|
+
if (targetNode && targetNode !== nodeHovered) {
|
|
19927
|
+
this.instance.getStage().handleMouseover();
|
|
19928
|
+
nodeHovered?.handleMouseout();
|
|
19929
|
+
targetNode?.handleMouseover();
|
|
19930
|
+
nodeHovered = targetNode;
|
|
19931
|
+
}
|
|
19925
19932
|
targetNode?.handleMouseover();
|
|
19926
|
-
if (targetNode) nodeHovered = targetNode;
|
|
19927
19933
|
}
|
|
19928
19934
|
});
|
|
19935
|
+
tr.on("mouseover", () => {
|
|
19936
|
+
stage.container().style.cursor = "grab";
|
|
19937
|
+
});
|
|
19929
19938
|
tr.on("mouseout", () => {
|
|
19930
19939
|
this.instance.getStage().handleMouseover();
|
|
19931
|
-
nodeHovered?.handleMouseout();
|
|
19932
19940
|
nodeHovered = void 0;
|
|
19933
19941
|
});
|
|
19942
|
+
window.addEventListener("mouseout", () => {
|
|
19943
|
+
if (nodeHovered) {
|
|
19944
|
+
nodeHovered.handleMouseout();
|
|
19945
|
+
nodeHovered = void 0;
|
|
19946
|
+
}
|
|
19947
|
+
this.instance.getStage().handleMouseover();
|
|
19948
|
+
});
|
|
19934
19949
|
const handleTransform = (e) => {
|
|
19935
19950
|
const moved = this.checkMoved(e);
|
|
19936
19951
|
if (moved) this.getContextMenuPlugin()?.cancelLongPressTimer();
|
|
@@ -20263,7 +20278,6 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
20263
20278
|
this.selecting = false;
|
|
20264
20279
|
this.stopPanLoop();
|
|
20265
20280
|
this.hideSelectorArea();
|
|
20266
|
-
this.handleClickOrTap(e);
|
|
20267
20281
|
return;
|
|
20268
20282
|
}
|
|
20269
20283
|
const isStage = e.target instanceof konva.default.Stage;
|
|
@@ -20366,6 +20380,14 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
20366
20380
|
return;
|
|
20367
20381
|
}
|
|
20368
20382
|
if (contextMenuPlugin?.isContextMenuVisible()) this.stopPanLoop();
|
|
20383
|
+
const selectedGroup = getTargetedNode(this.instance);
|
|
20384
|
+
if (!moved && selectedGroup?.getParent() instanceof konva.default.Transformer) {
|
|
20385
|
+
this.selecting = false;
|
|
20386
|
+
this.stopPanLoop();
|
|
20387
|
+
this.hideSelectorArea();
|
|
20388
|
+
this.handleClickOrTap(e);
|
|
20389
|
+
return;
|
|
20390
|
+
}
|
|
20369
20391
|
if (!this.selectionRectangle.visible()) {
|
|
20370
20392
|
this.hideSelectorArea();
|
|
20371
20393
|
return;
|
|
@@ -20717,12 +20739,12 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
|
|
|
20717
20739
|
this.createPasteCatcher();
|
|
20718
20740
|
const catcher = this.getCatcherElement();
|
|
20719
20741
|
window.addEventListener("keydown", async (e) => {
|
|
20720
|
-
if (stage.isFocused() && e.
|
|
20742
|
+
if (stage.isFocused() && e.code === "KeyC" && (e.ctrlKey || e.metaKey)) {
|
|
20721
20743
|
e.preventDefault();
|
|
20722
20744
|
await this.performCopy();
|
|
20723
20745
|
return;
|
|
20724
20746
|
}
|
|
20725
|
-
if (stage.isFocused() && e.
|
|
20747
|
+
if (stage.isFocused() && e.code === "KeyV" && (e.ctrlKey || e.metaKey)) {
|
|
20726
20748
|
this.focusPasteCatcher();
|
|
20727
20749
|
if (!this.enabled) return;
|
|
20728
20750
|
}
|
|
@@ -21295,6 +21317,9 @@ var WeaveNode = class {
|
|
|
21295
21317
|
node.handleMouseover = () => {
|
|
21296
21318
|
this.handleMouseOver(node);
|
|
21297
21319
|
};
|
|
21320
|
+
node.handleMouseout = () => {
|
|
21321
|
+
this.handleMouseout(node);
|
|
21322
|
+
};
|
|
21298
21323
|
node.on("pointerover", (e) => {
|
|
21299
21324
|
const doCancelBubble = this.handleMouseOver(e.target);
|
|
21300
21325
|
if (doCancelBubble) e.cancelBubble = true;
|
|
@@ -21309,34 +21334,39 @@ var WeaveNode = class {
|
|
|
21309
21334
|
const isTargetable = node.getAttrs().isTargetable !== false;
|
|
21310
21335
|
const isLocked = node.getAttrs().locked ?? false;
|
|
21311
21336
|
if ([MOVE_TOOL_ACTION_NAME].includes(activeAction ?? "")) return false;
|
|
21337
|
+
let showHover = false;
|
|
21312
21338
|
let cancelBubble = false;
|
|
21313
|
-
if (isNodeSelectionEnabled && this.isSelecting() && !this.isNodeSelected(
|
|
21339
|
+
if (isNodeSelectionEnabled && this.isSelecting() && !this.isNodeSelected(realNode) && !this.isPasting() && isLocked) {
|
|
21314
21340
|
const stage$1 = this.instance.getStage();
|
|
21315
21341
|
stage$1.container().style.cursor = "default";
|
|
21316
21342
|
cancelBubble = true;
|
|
21317
21343
|
}
|
|
21318
|
-
if (isNodeSelectionEnabled && this.isSelecting() && !this.isNodeSelected(
|
|
21344
|
+
if (isNodeSelectionEnabled && this.isSelecting() && !this.isNodeSelected(realNode) && !this.isPasting() && isTargetable && !isLocked && stage.mode() === WEAVE_STAGE_DEFAULT_MODE) {
|
|
21319
21345
|
const stage$1 = this.instance.getStage();
|
|
21320
|
-
|
|
21346
|
+
showHover = true;
|
|
21321
21347
|
stage$1.container().style.cursor = "pointer";
|
|
21322
21348
|
cancelBubble = true;
|
|
21323
21349
|
}
|
|
21324
|
-
if (isNodeSelectionEnabled && this.isSelecting() && this.isNodeSelected(
|
|
21350
|
+
if (isNodeSelectionEnabled && this.isSelecting() && this.isNodeSelected(realNode) && !this.isPasting() && isTargetable && !isLocked && stage.mode() === WEAVE_STAGE_DEFAULT_MODE) {
|
|
21325
21351
|
const stage$1 = this.instance.getStage();
|
|
21352
|
+
showHover = true;
|
|
21326
21353
|
stage$1.container().style.cursor = "grab";
|
|
21327
21354
|
cancelBubble = true;
|
|
21328
21355
|
}
|
|
21329
|
-
if (!isTargetable)
|
|
21330
|
-
this.hideHoverState();
|
|
21331
|
-
cancelBubble = true;
|
|
21332
|
-
}
|
|
21356
|
+
if (!isTargetable) cancelBubble = true;
|
|
21333
21357
|
if (this.isPasting()) {
|
|
21334
21358
|
const stage$1 = this.instance.getStage();
|
|
21335
21359
|
stage$1.container().style.cursor = "crosshair";
|
|
21336
21360
|
cancelBubble = true;
|
|
21337
21361
|
}
|
|
21362
|
+
if (showHover) this.setHoverState(realNode);
|
|
21363
|
+
else this.hideHoverState();
|
|
21338
21364
|
return cancelBubble;
|
|
21339
21365
|
}
|
|
21366
|
+
handleMouseout(node) {
|
|
21367
|
+
const realNode = this.instance.getInstanceRecursive(node);
|
|
21368
|
+
if (realNode) this.hideHoverState();
|
|
21369
|
+
}
|
|
21340
21370
|
create(key, props) {
|
|
21341
21371
|
return {
|
|
21342
21372
|
key,
|
|
@@ -22900,7 +22930,7 @@ var WeaveRegisterManager = class {
|
|
|
22900
22930
|
|
|
22901
22931
|
//#endregion
|
|
22902
22932
|
//#region package.json
|
|
22903
|
-
var version = "0.76.
|
|
22933
|
+
var version = "0.76.2";
|
|
22904
22934
|
|
|
22905
22935
|
//#endregion
|
|
22906
22936
|
//#region src/managers/setup.ts
|
|
@@ -23216,6 +23246,17 @@ var WeaveExportManager = class {
|
|
|
23216
23246
|
}
|
|
23217
23247
|
});
|
|
23218
23248
|
}
|
|
23249
|
+
unpremultiply(data) {
|
|
23250
|
+
for (let i = 0; i < data.length; i += 4) {
|
|
23251
|
+
const a = data[i + 3];
|
|
23252
|
+
if (a && a < 255) {
|
|
23253
|
+
const alpha = a / 255;
|
|
23254
|
+
data[i] = Math.min(255, Math.round(data[i] / alpha));
|
|
23255
|
+
data[i + 1] = Math.min(255, Math.round(data[i + 1] / alpha));
|
|
23256
|
+
data[i + 2] = Math.min(255, Math.round(data[i + 2] / alpha));
|
|
23257
|
+
}
|
|
23258
|
+
}
|
|
23259
|
+
}
|
|
23219
23260
|
async exportNodesAsBuffer(nodes, boundingNodes, options) {
|
|
23220
23261
|
const { format: format$2 = __inditextech_weave_types.WEAVE_EXPORT_FORMATS.PNG, padding = 0, pixelRatio = 1, backgroundColor = __inditextech_weave_types.WEAVE_EXPORT_BACKGROUND_COLOR } = options;
|
|
23221
23262
|
this.getNodesSelectionPlugin()?.disable();
|
|
@@ -23274,7 +23315,6 @@ var WeaveExportManager = class {
|
|
|
23274
23315
|
}
|
|
23275
23316
|
mainLayer.add(exportGroup);
|
|
23276
23317
|
const backgroundRect = background.getClientRect();
|
|
23277
|
-
stage.batchDraw();
|
|
23278
23318
|
const composites = [];
|
|
23279
23319
|
const imageWidth = Math.round(backgroundRect.width);
|
|
23280
23320
|
const imageHeight = Math.round(backgroundRect.height);
|
|
@@ -24380,7 +24420,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24380
24420
|
this.instance.emitEvent("onTransform", null);
|
|
24381
24421
|
});
|
|
24382
24422
|
if (!this.instance.getConfiguration().serverSide) window.addEventListener("keypress", (e) => {
|
|
24383
|
-
if (e.
|
|
24423
|
+
if (e.code === "Enter" && this.instance.getActiveAction() === SELECTION_TOOL_ACTION_NAME && !this.editing && e.target !== this.textArea) {
|
|
24384
24424
|
e.preventDefault();
|
|
24385
24425
|
if (this.isSelecting() && this.isNodeSelected(text)) {
|
|
24386
24426
|
const nodesSelectionPlugin = this.instance.getPlugin("nodesSelection");
|
|
@@ -24651,7 +24691,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
24651
24691
|
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));
|
|
24652
24692
|
};
|
|
24653
24693
|
const handleKeyDown = (e) => {
|
|
24654
|
-
if (this.textArea && textNode && e.
|
|
24694
|
+
if (this.textArea && textNode && e.code === "Escape") {
|
|
24655
24695
|
e.stopPropagation();
|
|
24656
24696
|
updateTextNodeSize();
|
|
24657
24697
|
textNode.text(this.textArea.value);
|
|
@@ -24963,7 +25003,7 @@ var WeaveImageCrop = class WeaveImageCrop {
|
|
|
24963
25003
|
if (!["Enter", "Escape"].includes(e.key)) return;
|
|
24964
25004
|
this.cropping = false;
|
|
24965
25005
|
this.image.setAttrs({ cropping: false });
|
|
24966
|
-
if (e.
|
|
25006
|
+
if (e.code === "Enter") this.handleClipEnd();
|
|
24967
25007
|
const stage = this.instance.getStage();
|
|
24968
25008
|
this.onClose();
|
|
24969
25009
|
const utilityLayer = this.instance.getUtilityLayer();
|
|
@@ -25155,7 +25195,6 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
25155
25195
|
this.lastTapTime = 0;
|
|
25156
25196
|
this.config = mergeExceptArrays(WEAVE_IMAGE_DEFAULT_CONFIG, config);
|
|
25157
25197
|
this.imageCrop = null;
|
|
25158
|
-
this.cachedCropInfo = {};
|
|
25159
25198
|
this.imageLoaded = false;
|
|
25160
25199
|
}
|
|
25161
25200
|
triggerCrop(imageNode) {
|
|
@@ -25194,7 +25233,6 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
25194
25233
|
if (!internalImage || !cropGroup) return;
|
|
25195
25234
|
const imageCrop = new WeaveImageCrop(this.instance, this, imageNode, internalImage, cropGroup);
|
|
25196
25235
|
imageCrop.unCrop();
|
|
25197
|
-
this.cachedCropInfo[imageNode.getAttrs().id ?? ""] = void 0;
|
|
25198
25236
|
};
|
|
25199
25237
|
loadAsyncElement(nodeId) {
|
|
25200
25238
|
this.instance.loadAsyncElement(nodeId, "image");
|
|
@@ -25225,7 +25263,6 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
25225
25263
|
const stage = this.instance.getStage();
|
|
25226
25264
|
const image$1 = stage.findOne(`#${id}`);
|
|
25227
25265
|
if (!image$1) return;
|
|
25228
|
-
this.cachedCropInfo[image$1.getAttrs().id ?? ""] = void 0;
|
|
25229
25266
|
};
|
|
25230
25267
|
image.triggerCrop = () => {
|
|
25231
25268
|
this.triggerCrop(image);
|
|
@@ -25239,7 +25276,6 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
25239
25276
|
if (!image$1) return;
|
|
25240
25277
|
const imageCrop = new WeaveImageCrop(this.instance, this, image$1, internalImage, cropGroup);
|
|
25241
25278
|
imageCrop.unCrop();
|
|
25242
|
-
this.cachedCropInfo[image$1.getAttrs().id ?? ""] = void 0;
|
|
25243
25279
|
};
|
|
25244
25280
|
const defaultTransformerProperties = this.defaultGetTransformerProperties(this.config.transform);
|
|
25245
25281
|
image.getTransformerProperties = function() {
|
|
@@ -25302,31 +25338,30 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
25302
25338
|
this.config.onDblClick?.(this, image);
|
|
25303
25339
|
};
|
|
25304
25340
|
if (this.imageSource[id]) {
|
|
25305
|
-
imagePlaceholder
|
|
25306
|
-
|
|
25307
|
-
|
|
25308
|
-
|
|
25309
|
-
});
|
|
25310
|
-
internalImage?.setAttrs({
|
|
25311
|
-
width: imageProps.width ? imageProps.width : this.imageSource[id].width,
|
|
25312
|
-
height: imageProps.height ? imageProps.height : this.imageSource[id].height,
|
|
25341
|
+
imagePlaceholder.destroy();
|
|
25342
|
+
internalImage.setAttrs({
|
|
25343
|
+
width: this.imageSource[id].width,
|
|
25344
|
+
height: this.imageSource[id].height,
|
|
25313
25345
|
image: this.imageSource[id],
|
|
25314
25346
|
visible: true
|
|
25315
25347
|
});
|
|
25316
25348
|
this.imageLoaded = true;
|
|
25317
|
-
image.setAttr("width",
|
|
25318
|
-
image.setAttr("height",
|
|
25319
|
-
image.setAttr("cropInfo", void 0);
|
|
25320
|
-
image.setAttr("uncroppedImage", {
|
|
25321
|
-
width:
|
|
25322
|
-
height:
|
|
25349
|
+
image.setAttr("width", this.imageSource[id].width);
|
|
25350
|
+
image.setAttr("height", this.imageSource[id].height);
|
|
25351
|
+
image.setAttr("cropInfo", props.cropInfo ?? void 0);
|
|
25352
|
+
image.setAttr("uncroppedImage", props.uncroppedImage ?? {
|
|
25353
|
+
width: this.imageSource[id].width,
|
|
25354
|
+
height: this.imageSource[id].height
|
|
25323
25355
|
});
|
|
25324
25356
|
image.setAttr("imageInfo", {
|
|
25325
25357
|
width: this.imageSource[id].width,
|
|
25326
25358
|
height: this.imageSource[id].height
|
|
25327
25359
|
});
|
|
25328
25360
|
this.instance.updateNode(this.serialize(image));
|
|
25329
|
-
} else
|
|
25361
|
+
} else {
|
|
25362
|
+
this.updatePlaceholderSize(image, imagePlaceholder);
|
|
25363
|
+
this.loadImage(imageProps, image);
|
|
25364
|
+
}
|
|
25330
25365
|
image.setAttr("imageURL", imageProps.imageURL);
|
|
25331
25366
|
return image;
|
|
25332
25367
|
}
|
|
@@ -25486,12 +25521,25 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
25486
25521
|
}
|
|
25487
25522
|
});
|
|
25488
25523
|
}
|
|
25524
|
+
updatePlaceholderSize(image, imagePlaceholder) {
|
|
25525
|
+
const imageAttrs = image.getAttrs();
|
|
25526
|
+
if (!imageAttrs.adding && imageAttrs.cropInfo) {
|
|
25527
|
+
const actualScale = imageAttrs.uncroppedImage.width / imageAttrs.imageInfo.width;
|
|
25528
|
+
const cropScale = imageAttrs.cropInfo ? imageAttrs.cropInfo.scaleX : actualScale;
|
|
25529
|
+
imagePlaceholder.width(imageAttrs.cropSize.width * (actualScale / cropScale));
|
|
25530
|
+
imagePlaceholder.height(imageAttrs.cropSize.height * (actualScale / cropScale));
|
|
25531
|
+
}
|
|
25532
|
+
if (!imageAttrs.adding && !imageAttrs.cropInfo) {
|
|
25533
|
+
imagePlaceholder.width(imageAttrs.uncroppedImage.width);
|
|
25534
|
+
imagePlaceholder.height(imageAttrs.uncroppedImage.height);
|
|
25535
|
+
}
|
|
25536
|
+
}
|
|
25489
25537
|
updateImageCrop(nextProps) {
|
|
25490
25538
|
const imageAttrs = nextProps;
|
|
25491
25539
|
const stage = this.instance.getStage();
|
|
25492
25540
|
const image = stage.findOne(`#${imageAttrs.id}`);
|
|
25493
25541
|
const internalImage = image?.findOne(`#${imageAttrs.id}-image`);
|
|
25494
|
-
if (image && internalImage && !imageAttrs.adding && imageAttrs.cropInfo
|
|
25542
|
+
if (image && internalImage && !imageAttrs.adding && imageAttrs.cropInfo) {
|
|
25495
25543
|
const actualScale = imageAttrs.uncroppedImage.width / imageAttrs.imageInfo.width;
|
|
25496
25544
|
const cropScale = imageAttrs.cropInfo ? imageAttrs.cropInfo.scaleX : actualScale;
|
|
25497
25545
|
internalImage.width(imageAttrs.uncroppedImage.width);
|
|
@@ -25507,9 +25555,8 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
25507
25555
|
});
|
|
25508
25556
|
internalImage.width(imageAttrs.cropSize.width * (actualScale / cropScale));
|
|
25509
25557
|
internalImage.height(imageAttrs.cropSize.height * (actualScale / cropScale));
|
|
25510
|
-
this.cachedCropInfo[imageAttrs.id ?? ""] = imageAttrs.cropInfo;
|
|
25511
25558
|
}
|
|
25512
|
-
if (image && internalImage && !imageAttrs.adding && !imageAttrs.cropInfo
|
|
25559
|
+
if (image && internalImage && !imageAttrs.adding && !imageAttrs.cropInfo) {
|
|
25513
25560
|
internalImage.width(imageAttrs.uncroppedImage.width);
|
|
25514
25561
|
internalImage.height(imageAttrs.uncroppedImage.height);
|
|
25515
25562
|
internalImage.rotation(0);
|
|
@@ -25518,7 +25565,6 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
25518
25565
|
internalImage.crop(void 0);
|
|
25519
25566
|
internalImage.width(imageAttrs.uncroppedImage.width);
|
|
25520
25567
|
internalImage.height(imageAttrs.uncroppedImage.height);
|
|
25521
|
-
this.cachedCropInfo[imageAttrs.id ?? ""] = void 0;
|
|
25522
25568
|
}
|
|
25523
25569
|
}
|
|
25524
25570
|
getImageSource(imageId) {
|
|
@@ -26051,7 +26097,7 @@ var WeaveFrameNode = class extends WeaveNode {
|
|
|
26051
26097
|
});
|
|
26052
26098
|
}
|
|
26053
26099
|
const nodesSelectionPlugin = this.instance.getPlugin("nodesSelection");
|
|
26054
|
-
if (nodesSelectionPlugin) nodesSelectionPlugin.getTransformer()
|
|
26100
|
+
if (nodesSelectionPlugin) nodesSelectionPlugin.getTransformer()?.forceUpdate();
|
|
26055
26101
|
}
|
|
26056
26102
|
serialize(instance) {
|
|
26057
26103
|
const stage = this.instance.getStage();
|
|
@@ -27369,12 +27415,6 @@ var WeaveVideoNode = class extends WeaveNode {
|
|
|
27369
27415
|
videoProgress?.hide();
|
|
27370
27416
|
}
|
|
27371
27417
|
};
|
|
27372
|
-
videoGroup.on("mouseover", () => {
|
|
27373
|
-
videoGroup.handleMouseover();
|
|
27374
|
-
});
|
|
27375
|
-
videoGroup.on("mouseout", () => {
|
|
27376
|
-
videoGroup.handleMouseout();
|
|
27377
|
-
});
|
|
27378
27418
|
videoGroup.dblClick = () => {
|
|
27379
27419
|
if (this.config.style.playPauseOnDblClick && this.videoState[id].loaded && !this.videoState[id].playing) {
|
|
27380
27420
|
this.play(id);
|
|
@@ -28168,7 +28208,7 @@ var WeaveMoveToolAction = class extends WeaveAction {
|
|
|
28168
28208
|
setupEvents() {
|
|
28169
28209
|
const stage = this.instance.getStage();
|
|
28170
28210
|
window.addEventListener("keydown", (e) => {
|
|
28171
|
-
if (e.
|
|
28211
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === MOVE_TOOL_ACTION_NAME) {
|
|
28172
28212
|
this.cancelAction();
|
|
28173
28213
|
return;
|
|
28174
28214
|
}
|
|
@@ -28323,7 +28363,7 @@ var WeaveEraserToolAction = class extends WeaveAction {
|
|
|
28323
28363
|
}
|
|
28324
28364
|
});
|
|
28325
28365
|
window.addEventListener("keydown", (e) => {
|
|
28326
|
-
if (e.
|
|
28366
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === ERASER_TOOL_ACTION_NAME) {
|
|
28327
28367
|
this.cancelAction();
|
|
28328
28368
|
return;
|
|
28329
28369
|
}
|
|
@@ -28421,11 +28461,11 @@ var WeaveRectangleToolAction = class extends WeaveAction {
|
|
|
28421
28461
|
setupEvents() {
|
|
28422
28462
|
const stage = this.instance.getStage();
|
|
28423
28463
|
window.addEventListener("keydown", (e) => {
|
|
28424
|
-
if (e.
|
|
28464
|
+
if (e.code === "Enter" && this.instance.getActiveAction() === RECTANGLE_TOOL_ACTION_NAME) {
|
|
28425
28465
|
this.cancelAction();
|
|
28426
28466
|
return;
|
|
28427
28467
|
}
|
|
28428
|
-
if (e.
|
|
28468
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === RECTANGLE_TOOL_ACTION_NAME) {
|
|
28429
28469
|
this.cancelAction();
|
|
28430
28470
|
return;
|
|
28431
28471
|
}
|
|
@@ -28630,11 +28670,11 @@ var WeaveEllipseToolAction = class extends WeaveAction {
|
|
|
28630
28670
|
setupEvents() {
|
|
28631
28671
|
const stage = this.instance.getStage();
|
|
28632
28672
|
window.addEventListener("keydown", (e) => {
|
|
28633
|
-
if (e.
|
|
28673
|
+
if (e.code === "Enter" && this.instance.getActiveAction() === ELLIPSE_TOOL_ACTION_NAME) {
|
|
28634
28674
|
this.cancelAction();
|
|
28635
28675
|
return;
|
|
28636
28676
|
}
|
|
28637
|
-
if (e.
|
|
28677
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === ELLIPSE_TOOL_ACTION_NAME) {
|
|
28638
28678
|
this.cancelAction();
|
|
28639
28679
|
return;
|
|
28640
28680
|
}
|
|
@@ -28846,11 +28886,11 @@ var WeavePenToolAction = class extends WeaveAction {
|
|
|
28846
28886
|
setupEvents() {
|
|
28847
28887
|
const stage = this.instance.getStage();
|
|
28848
28888
|
window.addEventListener("keydown", (e) => {
|
|
28849
|
-
if (e.
|
|
28889
|
+
if (e.code === "Enter" && this.instance.getActiveAction() === PEN_TOOL_ACTION_NAME) {
|
|
28850
28890
|
this.cancelAction();
|
|
28851
28891
|
return;
|
|
28852
28892
|
}
|
|
28853
|
-
if (e.
|
|
28893
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === PEN_TOOL_ACTION_NAME) {
|
|
28854
28894
|
this.cancelAction();
|
|
28855
28895
|
return;
|
|
28856
28896
|
}
|
|
@@ -29098,11 +29138,11 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
29098
29138
|
setupEvents() {
|
|
29099
29139
|
const stage = this.instance.getStage();
|
|
29100
29140
|
window.addEventListener("keydown", (e) => {
|
|
29101
|
-
if (e.
|
|
29141
|
+
if (e.code === "Enter" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) {
|
|
29102
29142
|
this.cancelAction();
|
|
29103
29143
|
return;
|
|
29104
29144
|
}
|
|
29105
|
-
if (e.
|
|
29145
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === BRUSH_TOOL_ACTION_NAME) {
|
|
29106
29146
|
this.cancelAction();
|
|
29107
29147
|
return;
|
|
29108
29148
|
}
|
|
@@ -29327,7 +29367,7 @@ var WeaveTextToolAction = class extends WeaveAction {
|
|
|
29327
29367
|
setupEvents() {
|
|
29328
29368
|
const stage = this.instance.getStage();
|
|
29329
29369
|
window.addEventListener("keydown", (e) => {
|
|
29330
|
-
if (e.
|
|
29370
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === TEXT_TOOL_ACTION_NAME) {
|
|
29331
29371
|
this.cancelAction();
|
|
29332
29372
|
return;
|
|
29333
29373
|
}
|
|
@@ -29479,7 +29519,7 @@ var WeaveImageToolAction = class extends WeaveAction {
|
|
|
29479
29519
|
setupEvents() {
|
|
29480
29520
|
const stage = this.instance.getStage();
|
|
29481
29521
|
window.addEventListener("keydown", (e) => {
|
|
29482
|
-
if (e.
|
|
29522
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === IMAGE_TOOL_ACTION_NAME) {
|
|
29483
29523
|
this.cancelAction();
|
|
29484
29524
|
return;
|
|
29485
29525
|
}
|
|
@@ -29741,11 +29781,11 @@ var WeaveStarToolAction = class extends WeaveAction {
|
|
|
29741
29781
|
setupEvents() {
|
|
29742
29782
|
const stage = this.instance.getStage();
|
|
29743
29783
|
window.addEventListener("keydown", (e) => {
|
|
29744
|
-
if (e.
|
|
29784
|
+
if (e.code === "Enter" && this.instance.getActiveAction() === STAR_TOOL_ACTION_NAME) {
|
|
29745
29785
|
this.cancelAction();
|
|
29746
29786
|
return;
|
|
29747
29787
|
}
|
|
29748
|
-
if (e.
|
|
29788
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === STAR_TOOL_ACTION_NAME) {
|
|
29749
29789
|
this.cancelAction();
|
|
29750
29790
|
return;
|
|
29751
29791
|
}
|
|
@@ -29963,11 +30003,11 @@ var WeaveArrowToolAction = class extends WeaveAction {
|
|
|
29963
30003
|
setupEvents() {
|
|
29964
30004
|
const stage = this.instance.getStage();
|
|
29965
30005
|
window.addEventListener("keydown", (e) => {
|
|
29966
|
-
if (e.
|
|
30006
|
+
if (e.code === "Enter" && this.instance.getActiveAction() === ARROW_TOOL_ACTION_NAME) {
|
|
29967
30007
|
this.cancelAction();
|
|
29968
30008
|
return;
|
|
29969
30009
|
}
|
|
29970
|
-
if (e.
|
|
30010
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === ARROW_TOOL_ACTION_NAME) {
|
|
29971
30011
|
this.cancelAction();
|
|
29972
30012
|
return;
|
|
29973
30013
|
}
|
|
@@ -30214,11 +30254,11 @@ var WeaveRegularPolygonToolAction = class extends WeaveAction {
|
|
|
30214
30254
|
setupEvents() {
|
|
30215
30255
|
const stage = this.instance.getStage();
|
|
30216
30256
|
window.addEventListener("keydown", (e) => {
|
|
30217
|
-
if (e.
|
|
30257
|
+
if (e.code === "Enter" && this.instance.getActiveAction() === REGULAR_POLYGON_TOOL_ACTION_NAME) {
|
|
30218
30258
|
this.cancelAction();
|
|
30219
30259
|
return;
|
|
30220
30260
|
}
|
|
30221
|
-
if (e.
|
|
30261
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === REGULAR_POLYGON_TOOL_ACTION_NAME) {
|
|
30222
30262
|
this.cancelAction();
|
|
30223
30263
|
return;
|
|
30224
30264
|
}
|
|
@@ -30415,7 +30455,7 @@ var WeaveFrameToolAction = class extends WeaveAction {
|
|
|
30415
30455
|
setupEvents() {
|
|
30416
30456
|
const stage = this.instance.getStage();
|
|
30417
30457
|
window.addEventListener("keydown", (e) => {
|
|
30418
|
-
if (e.
|
|
30458
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === FRAME_TOOL_ACTION_NAME) {
|
|
30419
30459
|
this.cancelAction();
|
|
30420
30460
|
return;
|
|
30421
30461
|
}
|
|
@@ -30972,11 +31012,11 @@ var WeaveCommentToolAction = class extends WeaveAction {
|
|
|
30972
31012
|
window.addEventListener("keydown", (e) => {
|
|
30973
31013
|
if (this.instance.getActiveAction() !== WEAVE_COMMENT_TOOL_ACTION_NAME) return;
|
|
30974
31014
|
if (commentNodeHandler?.isCommentViewing()) return;
|
|
30975
|
-
if (e.
|
|
31015
|
+
if (e.code === "Escape" && this.state == WEAVE_COMMENT_TOOL_STATE.ADDING) {
|
|
30976
31016
|
this.cancelAction();
|
|
30977
31017
|
return;
|
|
30978
31018
|
}
|
|
30979
|
-
if (e.
|
|
31019
|
+
if (e.code === "Escape" && this.state === WEAVE_COMMENT_TOOL_STATE.CREATING_COMMENT) this.setState(WEAVE_COMMENT_TOOL_STATE.ADDING);
|
|
30980
31020
|
});
|
|
30981
31021
|
stage.on("pointermove", (e) => {
|
|
30982
31022
|
if (this.state === WEAVE_COMMENT_TOOL_STATE.IDLE) return;
|
|
@@ -31170,7 +31210,7 @@ var WeaveVideoToolAction = class extends WeaveAction {
|
|
|
31170
31210
|
setupEvents() {
|
|
31171
31211
|
const stage = this.instance.getStage();
|
|
31172
31212
|
window.addEventListener("keydown", (e) => {
|
|
31173
|
-
if (e.
|
|
31213
|
+
if (e.code === "Escape" && this.instance.getActiveAction() === VIDEO_TOOL_ACTION_NAME) {
|
|
31174
31214
|
this.cancelAction();
|
|
31175
31215
|
return;
|
|
31176
31216
|
}
|
|
@@ -33538,10 +33578,10 @@ var WeaveStageKeyboardMovePlugin = class extends WeavePlugin {
|
|
|
33538
33578
|
}
|
|
33539
33579
|
onInit() {
|
|
33540
33580
|
window.addEventListener("keydown", (e) => {
|
|
33541
|
-
if (e.
|
|
33542
|
-
if (e.
|
|
33543
|
-
if (e.
|
|
33544
|
-
if (e.
|
|
33581
|
+
if (e.code === "ArrowUp" && e.shiftKey) this.handleNodesMovement("up");
|
|
33582
|
+
if (e.code === "ArrowLeft" && e.shiftKey) this.handleNodesMovement("left");
|
|
33583
|
+
if (e.code === "ArrowRight" && e.shiftKey) this.handleNodesMovement("right");
|
|
33584
|
+
if (e.code === "ArrowDown" && e.shiftKey) this.handleNodesMovement("down");
|
|
33545
33585
|
});
|
|
33546
33586
|
}
|
|
33547
33587
|
enable() {
|
package/dist/sdk.d.cts
CHANGED
|
@@ -865,6 +865,7 @@ declare abstract class WeaveNode implements WeaveNodeBase {
|
|
|
865
865
|
protected hideHoverState(): void;
|
|
866
866
|
setupDefaultNodeEvents(node: Konva.Node): void;
|
|
867
867
|
handleMouseOver(node: Konva.Node): boolean;
|
|
868
|
+
handleMouseout(node: Konva.Node): void;
|
|
868
869
|
create(key: string, props: WeaveElementAttributes): WeaveStateElement;
|
|
869
870
|
onAdd(nodeInstance: WeaveElementInstance): void;
|
|
870
871
|
abstract onRender(props: WeaveElementAttributes): WeaveElementInstance;
|
|
@@ -1477,7 +1478,6 @@ declare class WeaveImageNode extends WeaveNode {
|
|
|
1477
1478
|
protected lastTapTime: number;
|
|
1478
1479
|
protected nodeType: string;
|
|
1479
1480
|
private imageCrop;
|
|
1480
|
-
private cachedCropInfo;
|
|
1481
1481
|
private imageLoaded;
|
|
1482
1482
|
constructor(params?: WeaveImageNodeParams);
|
|
1483
1483
|
triggerCrop(imageNode: Konva.Group): void;
|
|
@@ -1495,6 +1495,7 @@ declare class WeaveImageNode extends WeaveNode {
|
|
|
1495
1495
|
onError: (error: string | Event) => void;
|
|
1496
1496
|
}): void;
|
|
1497
1497
|
private loadImage;
|
|
1498
|
+
updatePlaceholderSize(image: Konva.Group, imagePlaceholder: Konva.Rect): void;
|
|
1498
1499
|
updateImageCrop(nextProps: WeaveElementAttributes): void;
|
|
1499
1500
|
getImageSource(imageId: string): HTMLImageElement | undefined;
|
|
1500
1501
|
scaleReset(node: Konva.Group): void;
|