@inditextech/weave-sdk 0.36.0 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sdk.cjs +1 -2
- package/dist/sdk.d.cts.map +1 -1
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +17 -19
- package/dist/sdk.js.map +1 -1
- package/package.json +2 -2
package/dist/sdk.js
CHANGED
|
@@ -15493,7 +15493,6 @@ var require_lodash = __commonJS({ "../../node_modules/lodash/lodash.js"(exports,
|
|
|
15493
15493
|
} else root._ = _;
|
|
15494
15494
|
}).call(exports);
|
|
15495
15495
|
} });
|
|
15496
|
-
var import_lodash$1 = __toESM(require_lodash());
|
|
15497
15496
|
var import_lodash = __toESM(require_lodash(), 1);
|
|
15498
15497
|
|
|
15499
15498
|
//#endregion
|
|
@@ -15587,12 +15586,12 @@ var WeaveStore = class {
|
|
|
15587
15586
|
node: JSON.parse(JSON.stringify(nodeInfo.node))
|
|
15588
15587
|
});
|
|
15589
15588
|
}
|
|
15590
|
-
if (!this.isRoomLoaded && !(0, import_lodash
|
|
15589
|
+
if (!this.isRoomLoaded && !(0, import_lodash.isEmpty)(this.state.weave)) {
|
|
15591
15590
|
this.instance.setupRenderer();
|
|
15592
15591
|
this.isRoomLoaded = true;
|
|
15593
15592
|
this.instance.emitEvent("onRoomLoaded", this.isRoomLoaded);
|
|
15594
15593
|
}
|
|
15595
|
-
if (this.isRoomLoaded && !(0, import_lodash
|
|
15594
|
+
if (this.isRoomLoaded && !(0, import_lodash.isEmpty)(this.state.weave)) this.instance.render();
|
|
15596
15595
|
});
|
|
15597
15596
|
}
|
|
15598
15597
|
canUndoStateStep() {
|
|
@@ -16039,7 +16038,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16039
16038
|
const handleTransform = () => {
|
|
16040
16039
|
this.triggerSelectedNodesEvent();
|
|
16041
16040
|
};
|
|
16042
|
-
tr.on("transform", (0, import_lodash
|
|
16041
|
+
tr.on("transform", (0, import_lodash.throttle)(handleTransform, 50));
|
|
16043
16042
|
tr.on("transformend", () => {
|
|
16044
16043
|
this.triggerSelectedNodesEvent();
|
|
16045
16044
|
});
|
|
@@ -16079,7 +16078,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16079
16078
|
}
|
|
16080
16079
|
tr.forceUpdate();
|
|
16081
16080
|
};
|
|
16082
|
-
tr.on("dragmove", (0, import_lodash
|
|
16081
|
+
tr.on("dragmove", (0, import_lodash.throttle)(handleDragMove, 50));
|
|
16083
16082
|
tr.on("dragend", (e) => {
|
|
16084
16083
|
this.dragging = false;
|
|
16085
16084
|
e.cancelBubble = true;
|
|
@@ -16229,7 +16228,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16229
16228
|
height: Math.abs(y2 - y1)
|
|
16230
16229
|
});
|
|
16231
16230
|
};
|
|
16232
|
-
stage.on("pointermove", (0, import_lodash
|
|
16231
|
+
stage.on("pointermove", (0, import_lodash.throttle)(handleMouseMove, 50));
|
|
16233
16232
|
stage.on("pointerup", (e) => {
|
|
16234
16233
|
delete this.pointers[e.evt.pointerId];
|
|
16235
16234
|
if (!this.initialized) return;
|
|
@@ -16735,7 +16734,7 @@ var WeaveNode = class {
|
|
|
16735
16734
|
if (nodeHandler) this.instance.updateNode(nodeHandler.serialize(node$1));
|
|
16736
16735
|
}
|
|
16737
16736
|
};
|
|
16738
|
-
node.on("transform", (0, import_lodash
|
|
16737
|
+
node.on("transform", (0, import_lodash.throttle)(handleTransform, 100));
|
|
16739
16738
|
node.on("transformend", (e) => {
|
|
16740
16739
|
const node$1 = e.target;
|
|
16741
16740
|
this.instance.emitEvent("onTransform", null);
|
|
@@ -16770,7 +16769,7 @@ var WeaveNode = class {
|
|
|
16770
16769
|
if (nodeHandler) this.instance.updateNode(nodeHandler.serialize(node));
|
|
16771
16770
|
}
|
|
16772
16771
|
};
|
|
16773
|
-
node.on("dragmove", (0, import_lodash
|
|
16772
|
+
node.on("dragmove", (0, import_lodash.throttle)(handleDragMove, 100));
|
|
16774
16773
|
node.on("dragend", (e) => {
|
|
16775
16774
|
this.instance.emitEvent("onDrag", null);
|
|
16776
16775
|
if (this.isSelecting() && this.isNodeSelected(node)) {
|
|
@@ -18318,7 +18317,7 @@ var WeaveRegisterManager = class {
|
|
|
18318
18317
|
|
|
18319
18318
|
//#endregion
|
|
18320
18319
|
//#region package.json
|
|
18321
|
-
var version = "0.
|
|
18320
|
+
var version = "0.37.0";
|
|
18322
18321
|
|
|
18323
18322
|
//#endregion
|
|
18324
18323
|
//#region src/managers/setup.ts
|
|
@@ -19417,7 +19416,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
19417
19416
|
text.on("transformstart", (e) => {
|
|
19418
19417
|
this.instance.emitEvent("onTransform", e.target);
|
|
19419
19418
|
});
|
|
19420
|
-
text.on("transform", (0, import_lodash
|
|
19419
|
+
text.on("transform", (0, import_lodash.throttle)(handleTextTransform, 50));
|
|
19421
19420
|
text.on("transformend", () => {
|
|
19422
19421
|
this.instance.emitEvent("onTransform", null);
|
|
19423
19422
|
});
|
|
@@ -20613,7 +20612,6 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
20613
20612
|
const imageProps = params;
|
|
20614
20613
|
const imagePlaceholder = image.findOne(`#${imageProps.id}-placeholder`);
|
|
20615
20614
|
const internalImage = image.findOne(`#${imageProps.id}-image`);
|
|
20616
|
-
console.log("crossOrigin", this.config.crossOrigin);
|
|
20617
20615
|
const imageObj = new Image();
|
|
20618
20616
|
imageObj.crossOrigin = this.config.crossOrigin;
|
|
20619
20617
|
imageObj.onerror = (error) => {
|
|
@@ -20670,7 +20668,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
20670
20668
|
const stage = this.instance.getStage();
|
|
20671
20669
|
const image = stage.findOne(`#${imageAttrs.id}`);
|
|
20672
20670
|
const internalImage = image?.findOne(`#${imageAttrs.id}-image`);
|
|
20673
|
-
if (image && internalImage && !imageAttrs.adding && imageAttrs.cropInfo && !(0, import_lodash
|
|
20671
|
+
if (image && internalImage && !imageAttrs.adding && imageAttrs.cropInfo && !(0, import_lodash.isEqual)(imageAttrs.cropInfo, this.cachedCropInfo[imageAttrs.id ?? ""])) {
|
|
20674
20672
|
const actualScale = imageAttrs.uncroppedImage.width / imageAttrs.imageInfo.width;
|
|
20675
20673
|
internalImage.width(imageAttrs.uncroppedImage.width);
|
|
20676
20674
|
internalImage.height(imageAttrs.uncroppedImage.height);
|
|
@@ -20687,7 +20685,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
20687
20685
|
internalImage.height(imageAttrs.cropSize.height);
|
|
20688
20686
|
this.cachedCropInfo[imageAttrs.id ?? ""] = imageAttrs.cropInfo;
|
|
20689
20687
|
}
|
|
20690
|
-
if (image && internalImage && !imageAttrs.adding && !imageAttrs.cropInfo && !(0, import_lodash
|
|
20688
|
+
if (image && internalImage && !imageAttrs.adding && !imageAttrs.cropInfo && !(0, import_lodash.isEqual)(imageAttrs.cropInfo, this.cachedCropInfo[imageAttrs.id ?? ""])) {
|
|
20691
20689
|
internalImage.width(imageAttrs.uncroppedImage.width);
|
|
20692
20690
|
internalImage.height(imageAttrs.uncroppedImage.height);
|
|
20693
20691
|
internalImage.rotation(0);
|
|
@@ -21105,7 +21103,7 @@ var WeaveFrameNode = class extends WeaveNode {
|
|
|
21105
21103
|
selectorArea.on("transformend", (e) => {
|
|
21106
21104
|
this.instance.emitEvent("onTransform", e.target);
|
|
21107
21105
|
});
|
|
21108
|
-
selectorArea.on("transform", (0, import_lodash
|
|
21106
|
+
selectorArea.on("transform", (0, import_lodash.throttle)(handleSelectorAreaTransform, 50));
|
|
21109
21107
|
selectorArea.on("transformend", (e) => {
|
|
21110
21108
|
this.instance.emitEvent("onTransform", null);
|
|
21111
21109
|
const nodesSnappingPlugin = this.instance.getPlugin("nodesSnapping");
|
|
@@ -22948,7 +22946,7 @@ var require_hammer = __commonJS({ "../../node_modules/hammerjs/hammer.js"(export
|
|
|
22948
22946
|
else window$1[exportName] = Hammer;
|
|
22949
22947
|
})(window, document, "Hammer");
|
|
22950
22948
|
} });
|
|
22951
|
-
var import_hammer = __toESM(require_hammer());
|
|
22949
|
+
var import_hammer = __toESM(require_hammer(), 1);
|
|
22952
22950
|
|
|
22953
22951
|
//#endregion
|
|
22954
22952
|
//#region src/plugins/stage-zoom/stage-zoom.ts
|
|
@@ -22988,7 +22986,7 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
22988
22986
|
this.config.zoomSteps = [minimumZoom, ...this.config.zoomSteps];
|
|
22989
22987
|
}
|
|
22990
22988
|
};
|
|
22991
|
-
mainLayer?.on("draw", (0, import_lodash
|
|
22989
|
+
mainLayer?.on("draw", (0, import_lodash.throttle)(handleDraw, 50));
|
|
22992
22990
|
this.setZoom(this.config.zoomSteps[this.actualStep]);
|
|
22993
22991
|
}
|
|
22994
22992
|
setZoom(scale, centered = true, pointer) {
|
|
@@ -25593,7 +25591,7 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
25593
25591
|
if (!this.enabled || !(this.isSpaceKeyPressed || this.isMouseMiddleButtonPressed || this.moveToolActive)) return;
|
|
25594
25592
|
this.onRender();
|
|
25595
25593
|
};
|
|
25596
|
-
stage.on("pointermove", (0, import_lodash
|
|
25594
|
+
stage.on("pointermove", (0, import_lodash.throttle)(handleMouseMove, 50));
|
|
25597
25595
|
stage.on("pointermove", () => {
|
|
25598
25596
|
if (!this.enabled) return;
|
|
25599
25597
|
this.onRender();
|
|
@@ -25888,7 +25886,7 @@ var WeaveStagePanningPlugin = class extends WeavePlugin {
|
|
|
25888
25886
|
stage.y(stage.y() - deltaY);
|
|
25889
25887
|
this.instance.emitEvent("onStageMove");
|
|
25890
25888
|
};
|
|
25891
|
-
stage.on("pointermove", (0, import_lodash
|
|
25889
|
+
stage.on("pointermove", (0, import_lodash.throttle)(handleMouseMove, 50));
|
|
25892
25890
|
stage.on("pointerdown", () => {
|
|
25893
25891
|
const mousePos = stage.getPointerPosition();
|
|
25894
25892
|
previousMouseX = mousePos?.x ?? 0;
|
|
@@ -26004,7 +26002,7 @@ var WeaveConnectedUsersPlugin = class extends WeavePlugin {
|
|
|
26004
26002
|
newConnectedUsers[userInformation.name] = userInformation;
|
|
26005
26003
|
}
|
|
26006
26004
|
}
|
|
26007
|
-
if (!(0, import_lodash
|
|
26005
|
+
if (!(0, import_lodash.isEqual)(this.connectedUsers, newConnectedUsers)) this.instance.emitEvent("onConnectedUsersChange", newConnectedUsers);
|
|
26008
26006
|
this.connectedUsers = newConnectedUsers;
|
|
26009
26007
|
});
|
|
26010
26008
|
}
|