@inditextech/weave-sdk 5.0.0-SNAPSHOT.338.1 → 5.0.0-SNAPSHOT.342.1
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.js +177 -294
- package/dist/sdk.node.js +177 -294
- package/dist/sdk.node.stats.html +1 -1
- package/dist/sdk.stats.html +1 -1
- package/dist/types.d.ts +16 -16
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +177 -294
- package/dist/types.js.map +1 -1
- package/dist/types.stats.html +1 -1
- package/package.json +2 -2
package/dist/sdk.js
CHANGED
|
@@ -9442,7 +9442,7 @@ var WeaveRegisterManager = class {
|
|
|
9442
9442
|
|
|
9443
9443
|
//#endregion
|
|
9444
9444
|
//#region package.json
|
|
9445
|
-
var version = "5.0.0-SNAPSHOT.
|
|
9445
|
+
var version = "5.0.0-SNAPSHOT.342.1";
|
|
9446
9446
|
|
|
9447
9447
|
//#endregion
|
|
9448
9448
|
//#region src/managers/setup.ts
|
|
@@ -9802,54 +9802,80 @@ var WeaveExportManager = class {
|
|
|
9802
9802
|
outH
|
|
9803
9803
|
};
|
|
9804
9804
|
}
|
|
9805
|
+
cloneStageForExport() {
|
|
9806
|
+
const originalStage = this.instance.getStage();
|
|
9807
|
+
const stage = originalStage.clone();
|
|
9808
|
+
const mainLayer = stage.findOne("#mainLayer");
|
|
9809
|
+
if (!mainLayer) throw new Error("Main layer not found");
|
|
9810
|
+
const selectionLayer = stage.findOne(`#${WEAVE_NODES_SELECTION_LAYER_ID}`);
|
|
9811
|
+
selectionLayer?.destroy();
|
|
9812
|
+
const gridLayer = stage.findOne(`#${WEAVE_GRID_LAYER_ID}`);
|
|
9813
|
+
gridLayer?.destroy();
|
|
9814
|
+
const scaleX = originalStage.scaleX();
|
|
9815
|
+
const scaleY = originalStage.scaleY();
|
|
9816
|
+
return {
|
|
9817
|
+
stage,
|
|
9818
|
+
mainLayer,
|
|
9819
|
+
originalScale: {
|
|
9820
|
+
scaleX,
|
|
9821
|
+
scaleY
|
|
9822
|
+
}
|
|
9823
|
+
};
|
|
9824
|
+
}
|
|
9825
|
+
setupForExport({ nodes, bounds, stage, mainLayer, scaleX, scaleY, options, exportArea }) {
|
|
9826
|
+
const { padding = 0, pixelRatio = 1, backgroundColor = WEAVE_EXPORT_BACKGROUND_COLOR } = options;
|
|
9827
|
+
const unscaledBounds = {
|
|
9828
|
+
x: bounds.x / scaleX,
|
|
9829
|
+
y: bounds.y / scaleY,
|
|
9830
|
+
width: bounds.width / scaleX,
|
|
9831
|
+
height: bounds.height / scaleY
|
|
9832
|
+
};
|
|
9833
|
+
const background = new Konva.Rect({
|
|
9834
|
+
x: unscaledBounds.x - padding,
|
|
9835
|
+
y: unscaledBounds.y - padding,
|
|
9836
|
+
width: unscaledBounds.width + 2 * padding,
|
|
9837
|
+
height: unscaledBounds.height + 2 * padding,
|
|
9838
|
+
strokeWidth: 0,
|
|
9839
|
+
fill: backgroundColor
|
|
9840
|
+
});
|
|
9841
|
+
const exportGroup = new Konva.Group();
|
|
9842
|
+
if (!exportArea) {
|
|
9843
|
+
exportGroup.add(background);
|
|
9844
|
+
for (const node of nodes) {
|
|
9845
|
+
const clonedNode = node.clone({ id: v4_default() });
|
|
9846
|
+
const absPos = node.getAbsolutePosition();
|
|
9847
|
+
clonedNode.absolutePosition({
|
|
9848
|
+
x: absPos.x / scaleX,
|
|
9849
|
+
y: absPos.y / scaleY
|
|
9850
|
+
});
|
|
9851
|
+
exportGroup.add(clonedNode);
|
|
9852
|
+
}
|
|
9853
|
+
mainLayer.add(exportGroup);
|
|
9854
|
+
} else mainLayer.add(background);
|
|
9855
|
+
const backgroundRect = background.getClientRect();
|
|
9856
|
+
stage.batchDraw();
|
|
9857
|
+
const { pixelRatio: finalPixelRatio } = this.fitKonvaPixelRatio(Math.round(backgroundRect.width), Math.round(backgroundRect.height), pixelRatio);
|
|
9858
|
+
return {
|
|
9859
|
+
exportGroup,
|
|
9860
|
+
pixelRatio: finalPixelRatio,
|
|
9861
|
+
backgroundRect
|
|
9862
|
+
};
|
|
9863
|
+
}
|
|
9805
9864
|
exportNodesAsImage(nodes, boundingNodes, options) {
|
|
9806
9865
|
return new Promise((resolve) => {
|
|
9807
|
-
const { format = WEAVE_EXPORT_FORMATS.PNG
|
|
9808
|
-
const
|
|
9809
|
-
const stage = originalStage.clone();
|
|
9810
|
-
const mainLayer = stage.findOne("#mainLayer");
|
|
9811
|
-
if (!mainLayer) throw new Error("Main layer not found");
|
|
9812
|
-
const selectionLayer = stage.findOne(`#${WEAVE_NODES_SELECTION_LAYER_ID}`);
|
|
9813
|
-
selectionLayer?.destroy();
|
|
9814
|
-
const gridLayer = stage.findOne(`#${WEAVE_GRID_LAYER_ID}`);
|
|
9815
|
-
gridLayer?.destroy();
|
|
9816
|
-
stage.scale({
|
|
9817
|
-
x: 1,
|
|
9818
|
-
y: 1
|
|
9819
|
-
});
|
|
9866
|
+
const { format = WEAVE_EXPORT_FORMATS.PNG } = options;
|
|
9867
|
+
const { stage, mainLayer, originalScale: { scaleX, scaleY } } = this.cloneStageForExport();
|
|
9820
9868
|
if (mainLayer) {
|
|
9821
|
-
const
|
|
9822
|
-
|
|
9823
|
-
|
|
9824
|
-
|
|
9825
|
-
|
|
9826
|
-
|
|
9827
|
-
|
|
9828
|
-
|
|
9829
|
-
|
|
9830
|
-
const exportGroup = new Konva.Group();
|
|
9831
|
-
const background = new Konva.Rect({
|
|
9832
|
-
x: unscaledBounds.x - padding,
|
|
9833
|
-
y: unscaledBounds.y - padding,
|
|
9834
|
-
width: unscaledBounds.width + 2 * padding,
|
|
9835
|
-
height: unscaledBounds.height + 2 * padding,
|
|
9836
|
-
strokeWidth: 0,
|
|
9837
|
-
fill: backgroundColor
|
|
9869
|
+
const { pixelRatio: finalPixelRatio, backgroundRect, exportGroup } = this.setupForExport({
|
|
9870
|
+
nodes,
|
|
9871
|
+
bounds: getExportBoundingBox(boundingNodes(nodes)),
|
|
9872
|
+
stage,
|
|
9873
|
+
mainLayer,
|
|
9874
|
+
scaleX,
|
|
9875
|
+
scaleY,
|
|
9876
|
+
options,
|
|
9877
|
+
exportArea: false
|
|
9838
9878
|
});
|
|
9839
|
-
exportGroup.add(background);
|
|
9840
|
-
for (const node of nodes) {
|
|
9841
|
-
const clonedNode = node.clone({ id: v4_default() });
|
|
9842
|
-
const absPos = node.getAbsolutePosition();
|
|
9843
|
-
clonedNode.absolutePosition({
|
|
9844
|
-
x: absPos.x / scaleX,
|
|
9845
|
-
y: absPos.y / scaleY
|
|
9846
|
-
});
|
|
9847
|
-
exportGroup.add(clonedNode);
|
|
9848
|
-
}
|
|
9849
|
-
mainLayer.add(exportGroup);
|
|
9850
|
-
const backgroundRect = background.getClientRect();
|
|
9851
|
-
stage.batchDraw();
|
|
9852
|
-
const { pixelRatio: finalPixelRatio } = this.fitKonvaPixelRatio(Math.round(backgroundRect.width), Math.round(backgroundRect.height), pixelRatio);
|
|
9853
9879
|
exportGroup.toImage({
|
|
9854
9880
|
x: Math.round(backgroundRect.x),
|
|
9855
9881
|
y: Math.round(backgroundRect.y),
|
|
@@ -9869,48 +9895,19 @@ var WeaveExportManager = class {
|
|
|
9869
9895
|
}
|
|
9870
9896
|
exportNodesAsBlob(nodes, boundingNodes, options) {
|
|
9871
9897
|
return new Promise((resolve) => {
|
|
9872
|
-
const { format = WEAVE_EXPORT_FORMATS.PNG
|
|
9873
|
-
const
|
|
9874
|
-
const stage = originalStage.clone();
|
|
9875
|
-
const mainLayer = stage.findOne("#mainLayer");
|
|
9876
|
-
if (!mainLayer) throw new Error("Main layer not found");
|
|
9877
|
-
const selectionLayer = stage.findOne(`#${WEAVE_NODES_SELECTION_LAYER_ID}`);
|
|
9878
|
-
selectionLayer?.destroy();
|
|
9879
|
-
const gridLayer = stage.findOne(`#${WEAVE_GRID_LAYER_ID}`);
|
|
9880
|
-
gridLayer?.destroy();
|
|
9898
|
+
const { format = WEAVE_EXPORT_FORMATS.PNG } = options;
|
|
9899
|
+
const { stage, mainLayer, originalScale: { scaleX, scaleY } } = this.cloneStageForExport();
|
|
9881
9900
|
if (mainLayer) {
|
|
9882
|
-
const
|
|
9883
|
-
|
|
9884
|
-
|
|
9885
|
-
|
|
9886
|
-
|
|
9887
|
-
|
|
9888
|
-
|
|
9889
|
-
|
|
9890
|
-
|
|
9891
|
-
const exportGroup = new Konva.Group();
|
|
9892
|
-
const background = new Konva.Rect({
|
|
9893
|
-
x: unscaledBounds.x - padding,
|
|
9894
|
-
y: unscaledBounds.y - padding,
|
|
9895
|
-
width: unscaledBounds.width + 2 * padding,
|
|
9896
|
-
height: unscaledBounds.height + 2 * padding,
|
|
9897
|
-
strokeWidth: 0,
|
|
9898
|
-
fill: backgroundColor
|
|
9901
|
+
const { pixelRatio: finalPixelRatio, backgroundRect, exportGroup } = this.setupForExport({
|
|
9902
|
+
nodes,
|
|
9903
|
+
bounds: getExportBoundingBox(boundingNodes(nodes)),
|
|
9904
|
+
stage,
|
|
9905
|
+
mainLayer,
|
|
9906
|
+
scaleX,
|
|
9907
|
+
scaleY,
|
|
9908
|
+
options,
|
|
9909
|
+
exportArea: false
|
|
9899
9910
|
});
|
|
9900
|
-
exportGroup.add(background);
|
|
9901
|
-
for (const node of nodes) {
|
|
9902
|
-
const clonedNode = node.clone({ id: v4_default() });
|
|
9903
|
-
const absPos = node.getAbsolutePosition();
|
|
9904
|
-
clonedNode.absolutePosition({
|
|
9905
|
-
x: absPos.x / scaleX,
|
|
9906
|
-
y: absPos.y / scaleY
|
|
9907
|
-
});
|
|
9908
|
-
exportGroup.add(clonedNode);
|
|
9909
|
-
}
|
|
9910
|
-
mainLayer.add(exportGroup);
|
|
9911
|
-
const backgroundRect = background.getClientRect();
|
|
9912
|
-
stage.batchDraw();
|
|
9913
|
-
const { pixelRatio: finalPixelRatio } = this.fitKonvaPixelRatio(Math.round(backgroundRect.width), Math.round(backgroundRect.height), pixelRatio);
|
|
9914
9911
|
exportGroup.toBlob({
|
|
9915
9912
|
x: Math.round(backgroundRect.x),
|
|
9916
9913
|
y: Math.round(backgroundRect.y),
|
|
@@ -9934,52 +9931,19 @@ var WeaveExportManager = class {
|
|
|
9934
9931
|
}
|
|
9935
9932
|
exportNodesAsCanvas(nodes, boundingNodes, options) {
|
|
9936
9933
|
return new Promise((resolve) => {
|
|
9937
|
-
const { format = WEAVE_EXPORT_FORMATS.PNG
|
|
9938
|
-
const
|
|
9939
|
-
const stage = originalStage.clone();
|
|
9940
|
-
const mainLayer = stage.findOne("#mainLayer");
|
|
9941
|
-
if (!mainLayer) throw new Error("Main layer not found");
|
|
9942
|
-
const selectionLayer = stage.findOne(`#${WEAVE_NODES_SELECTION_LAYER_ID}`);
|
|
9943
|
-
selectionLayer?.destroy();
|
|
9944
|
-
const gridLayer = stage.findOne(`#${WEAVE_GRID_LAYER_ID}`);
|
|
9945
|
-
gridLayer?.destroy();
|
|
9946
|
-
stage.scale({
|
|
9947
|
-
x: 1,
|
|
9948
|
-
y: 1
|
|
9949
|
-
});
|
|
9934
|
+
const { format = WEAVE_EXPORT_FORMATS.PNG } = options;
|
|
9935
|
+
const { stage, mainLayer, originalScale: { scaleX, scaleY } } = this.cloneStageForExport();
|
|
9950
9936
|
if (mainLayer) {
|
|
9951
|
-
const
|
|
9952
|
-
|
|
9953
|
-
|
|
9954
|
-
|
|
9955
|
-
|
|
9956
|
-
|
|
9957
|
-
|
|
9958
|
-
|
|
9959
|
-
|
|
9960
|
-
const exportGroup = new Konva.Group();
|
|
9961
|
-
const background = new Konva.Rect({
|
|
9962
|
-
x: unscaledBounds.x - padding,
|
|
9963
|
-
y: unscaledBounds.y - padding,
|
|
9964
|
-
width: unscaledBounds.width + 2 * padding,
|
|
9965
|
-
height: unscaledBounds.height + 2 * padding,
|
|
9966
|
-
strokeWidth: 0,
|
|
9967
|
-
fill: backgroundColor
|
|
9937
|
+
const { pixelRatio: finalPixelRatio, backgroundRect, exportGroup } = this.setupForExport({
|
|
9938
|
+
nodes,
|
|
9939
|
+
bounds: getExportBoundingBox(boundingNodes(nodes)),
|
|
9940
|
+
stage,
|
|
9941
|
+
mainLayer,
|
|
9942
|
+
scaleX,
|
|
9943
|
+
scaleY,
|
|
9944
|
+
options,
|
|
9945
|
+
exportArea: false
|
|
9968
9946
|
});
|
|
9969
|
-
exportGroup.add(background);
|
|
9970
|
-
for (const node of nodes) {
|
|
9971
|
-
const clonedNode = node.clone({ id: v4_default() });
|
|
9972
|
-
const absPos = node.getAbsolutePosition();
|
|
9973
|
-
clonedNode.absolutePosition({
|
|
9974
|
-
x: absPos.x / scaleX,
|
|
9975
|
-
y: absPos.y / scaleY
|
|
9976
|
-
});
|
|
9977
|
-
exportGroup.add(clonedNode);
|
|
9978
|
-
}
|
|
9979
|
-
mainLayer.add(exportGroup);
|
|
9980
|
-
const backgroundRect = background.getClientRect();
|
|
9981
|
-
stage.batchDraw();
|
|
9982
|
-
const { pixelRatio: finalPixelRatio } = this.fitKonvaPixelRatio(Math.round(backgroundRect.width), Math.round(backgroundRect.height), pixelRatio);
|
|
9983
9947
|
exportGroup.toCanvas({
|
|
9984
9948
|
x: Math.round(backgroundRect.x),
|
|
9985
9949
|
y: Math.round(backgroundRect.y),
|
|
@@ -9999,180 +9963,99 @@ var WeaveExportManager = class {
|
|
|
9999
9963
|
}
|
|
10000
9964
|
exportAreaAsImage(area, options) {
|
|
10001
9965
|
return new Promise((resolve) => {
|
|
10002
|
-
const { format = WEAVE_EXPORT_FORMATS.PNG
|
|
10003
|
-
const
|
|
10004
|
-
|
|
10005
|
-
|
|
10006
|
-
|
|
10007
|
-
|
|
10008
|
-
|
|
10009
|
-
|
|
10010
|
-
|
|
10011
|
-
|
|
10012
|
-
|
|
10013
|
-
|
|
10014
|
-
|
|
10015
|
-
|
|
10016
|
-
|
|
10017
|
-
|
|
10018
|
-
|
|
10019
|
-
|
|
10020
|
-
|
|
10021
|
-
|
|
10022
|
-
|
|
10023
|
-
|
|
10024
|
-
|
|
10025
|
-
|
|
10026
|
-
|
|
10027
|
-
|
|
10028
|
-
|
|
10029
|
-
y: bounds.y - padding,
|
|
10030
|
-
width: bounds.width + 2 * padding,
|
|
10031
|
-
height: bounds.height + 2 * padding,
|
|
10032
|
-
strokeWidth: 0,
|
|
10033
|
-
fill: backgroundColor
|
|
10034
|
-
});
|
|
10035
|
-
mainLayer.add(background);
|
|
10036
|
-
background.moveToBottom();
|
|
10037
|
-
stage.batchDraw();
|
|
10038
|
-
stage.toImage({
|
|
10039
|
-
x: area.x,
|
|
10040
|
-
y: area.y,
|
|
10041
|
-
width: area.width,
|
|
10042
|
-
height: area.height,
|
|
10043
|
-
mimeType: format,
|
|
10044
|
-
pixelRatio,
|
|
10045
|
-
quality: options.quality ?? 1,
|
|
10046
|
-
callback: (img) => {
|
|
10047
|
-
background.destroy();
|
|
10048
|
-
stage.position(originalPosition);
|
|
10049
|
-
stage.scale(originalScale);
|
|
10050
|
-
stage.batchDraw();
|
|
10051
|
-
if (nodesSelectionPluginPrev) this.getNodesSelectionPlugin()?.enable();
|
|
10052
|
-
if (nodesStageGridPluginPrev) this.getStageGridPlugin()?.enable();
|
|
10053
|
-
resolve(img);
|
|
10054
|
-
}
|
|
10055
|
-
});
|
|
9966
|
+
const { format = WEAVE_EXPORT_FORMATS.PNG } = options;
|
|
9967
|
+
const { stage, mainLayer, originalScale: { scaleX, scaleY } } = this.cloneStageForExport();
|
|
9968
|
+
if (mainLayer) {
|
|
9969
|
+
const { pixelRatio: finalPixelRatio } = this.setupForExport({
|
|
9970
|
+
nodes: [],
|
|
9971
|
+
bounds: area,
|
|
9972
|
+
stage,
|
|
9973
|
+
mainLayer,
|
|
9974
|
+
scaleX,
|
|
9975
|
+
scaleY,
|
|
9976
|
+
options,
|
|
9977
|
+
exportArea: true
|
|
9978
|
+
});
|
|
9979
|
+
stage.toImage({
|
|
9980
|
+
x: area.x,
|
|
9981
|
+
y: area.y,
|
|
9982
|
+
width: area.width,
|
|
9983
|
+
height: area.height,
|
|
9984
|
+
mimeType: format,
|
|
9985
|
+
pixelRatio: finalPixelRatio,
|
|
9986
|
+
quality: options.quality ?? 1,
|
|
9987
|
+
callback: (img) => {
|
|
9988
|
+
stage.destroy();
|
|
9989
|
+
resolve(img);
|
|
9990
|
+
}
|
|
9991
|
+
});
|
|
9992
|
+
}
|
|
10056
9993
|
});
|
|
10057
9994
|
}
|
|
10058
9995
|
exportAreaAsBlob(area, options) {
|
|
10059
9996
|
return new Promise((resolve) => {
|
|
10060
|
-
const { format = WEAVE_EXPORT_FORMATS.PNG
|
|
10061
|
-
const
|
|
10062
|
-
|
|
10063
|
-
|
|
10064
|
-
|
|
10065
|
-
|
|
10066
|
-
|
|
10067
|
-
|
|
10068
|
-
|
|
10069
|
-
|
|
10070
|
-
|
|
10071
|
-
|
|
10072
|
-
|
|
10073
|
-
|
|
10074
|
-
|
|
10075
|
-
|
|
10076
|
-
|
|
10077
|
-
|
|
10078
|
-
|
|
10079
|
-
|
|
10080
|
-
|
|
10081
|
-
|
|
10082
|
-
|
|
10083
|
-
|
|
10084
|
-
|
|
10085
|
-
|
|
10086
|
-
|
|
10087
|
-
|
|
10088
|
-
width: bounds.width + 2 * padding,
|
|
10089
|
-
height: bounds.height + 2 * padding,
|
|
10090
|
-
strokeWidth: 0,
|
|
10091
|
-
fill: backgroundColor
|
|
10092
|
-
});
|
|
10093
|
-
mainLayer.add(background);
|
|
10094
|
-
background.moveToBottom();
|
|
10095
|
-
stage.batchDraw();
|
|
10096
|
-
stage.toBlob({
|
|
10097
|
-
x: area.x,
|
|
10098
|
-
y: area.y,
|
|
10099
|
-
width: area.width,
|
|
10100
|
-
height: area.height,
|
|
10101
|
-
mimeType: format,
|
|
10102
|
-
pixelRatio,
|
|
10103
|
-
quality: options.quality ?? 1,
|
|
10104
|
-
callback: (blob) => {
|
|
10105
|
-
background.destroy();
|
|
10106
|
-
stage.position(originalPosition);
|
|
10107
|
-
stage.scale(originalScale);
|
|
10108
|
-
stage.batchDraw();
|
|
10109
|
-
if (nodesSelectionPluginPrev) this.getNodesSelectionPlugin()?.enable();
|
|
10110
|
-
if (nodesStageGridPluginPrev) this.getStageGridPlugin()?.enable();
|
|
10111
|
-
if (!blob) {
|
|
10112
|
-
(0, import_reject.default)(new Error("Failed to generate image blob"));
|
|
10113
|
-
return;
|
|
9997
|
+
const { format = WEAVE_EXPORT_FORMATS.PNG } = options;
|
|
9998
|
+
const { stage, mainLayer, originalScale: { scaleX, scaleY } } = this.cloneStageForExport();
|
|
9999
|
+
if (mainLayer) {
|
|
10000
|
+
const { pixelRatio: finalPixelRatio } = this.setupForExport({
|
|
10001
|
+
nodes: [],
|
|
10002
|
+
bounds: area,
|
|
10003
|
+
stage,
|
|
10004
|
+
mainLayer,
|
|
10005
|
+
scaleX,
|
|
10006
|
+
scaleY,
|
|
10007
|
+
options,
|
|
10008
|
+
exportArea: true
|
|
10009
|
+
});
|
|
10010
|
+
stage.toBlob({
|
|
10011
|
+
x: area.x,
|
|
10012
|
+
y: area.y,
|
|
10013
|
+
width: area.width,
|
|
10014
|
+
height: area.height,
|
|
10015
|
+
mimeType: format,
|
|
10016
|
+
pixelRatio: finalPixelRatio,
|
|
10017
|
+
quality: options.quality ?? 1,
|
|
10018
|
+
callback: (blob) => {
|
|
10019
|
+
stage.destroy();
|
|
10020
|
+
if (!blob) {
|
|
10021
|
+
(0, import_reject.default)(new Error("Failed to generate image blob"));
|
|
10022
|
+
return;
|
|
10023
|
+
}
|
|
10024
|
+
resolve(blob);
|
|
10114
10025
|
}
|
|
10115
|
-
|
|
10116
|
-
|
|
10117
|
-
});
|
|
10026
|
+
});
|
|
10027
|
+
}
|
|
10118
10028
|
});
|
|
10119
10029
|
}
|
|
10120
10030
|
exportAreaAsCanvas(area, options) {
|
|
10121
10031
|
return new Promise((resolve) => {
|
|
10122
|
-
const { format = WEAVE_EXPORT_FORMATS.PNG
|
|
10123
|
-
const
|
|
10124
|
-
|
|
10125
|
-
|
|
10126
|
-
|
|
10127
|
-
|
|
10128
|
-
|
|
10129
|
-
|
|
10130
|
-
|
|
10131
|
-
|
|
10132
|
-
|
|
10133
|
-
|
|
10134
|
-
|
|
10135
|
-
|
|
10136
|
-
|
|
10137
|
-
|
|
10138
|
-
|
|
10139
|
-
|
|
10140
|
-
|
|
10141
|
-
|
|
10142
|
-
|
|
10143
|
-
|
|
10144
|
-
|
|
10145
|
-
|
|
10146
|
-
|
|
10147
|
-
|
|
10148
|
-
|
|
10149
|
-
y: bounds.y - padding,
|
|
10150
|
-
width: bounds.width + 2 * padding,
|
|
10151
|
-
height: bounds.height + 2 * padding,
|
|
10152
|
-
strokeWidth: 0,
|
|
10153
|
-
fill: backgroundColor
|
|
10154
|
-
});
|
|
10155
|
-
mainLayer.add(background);
|
|
10156
|
-
background.moveToBottom();
|
|
10157
|
-
stage.batchDraw();
|
|
10158
|
-
stage.toCanvas({
|
|
10159
|
-
x: area.x,
|
|
10160
|
-
y: area.y,
|
|
10161
|
-
width: area.width,
|
|
10162
|
-
height: area.height,
|
|
10163
|
-
mimeType: format,
|
|
10164
|
-
pixelRatio,
|
|
10165
|
-
quality: options.quality ?? 1,
|
|
10166
|
-
callback: (canvas) => {
|
|
10167
|
-
background.destroy();
|
|
10168
|
-
stage.position(originalPosition);
|
|
10169
|
-
stage.scale(originalScale);
|
|
10170
|
-
stage.batchDraw();
|
|
10171
|
-
if (nodesSelectionPluginPrev) this.getNodesSelectionPlugin()?.enable();
|
|
10172
|
-
if (nodesStageGridPluginPrev) this.getStageGridPlugin()?.enable();
|
|
10173
|
-
resolve(canvas);
|
|
10174
|
-
}
|
|
10175
|
-
});
|
|
10032
|
+
const { format = WEAVE_EXPORT_FORMATS.PNG } = options;
|
|
10033
|
+
const { stage, mainLayer, originalScale: { scaleX, scaleY } } = this.cloneStageForExport();
|
|
10034
|
+
if (mainLayer) {
|
|
10035
|
+
const { pixelRatio: finalPixelRatio } = this.setupForExport({
|
|
10036
|
+
nodes: [],
|
|
10037
|
+
bounds: area,
|
|
10038
|
+
stage,
|
|
10039
|
+
mainLayer,
|
|
10040
|
+
scaleX,
|
|
10041
|
+
scaleY,
|
|
10042
|
+
options,
|
|
10043
|
+
exportArea: true
|
|
10044
|
+
});
|
|
10045
|
+
stage.toCanvas({
|
|
10046
|
+
x: area.x,
|
|
10047
|
+
y: area.y,
|
|
10048
|
+
width: area.width,
|
|
10049
|
+
height: area.height,
|
|
10050
|
+
mimeType: format,
|
|
10051
|
+
pixelRatio: finalPixelRatio,
|
|
10052
|
+
quality: options.quality ?? 1,
|
|
10053
|
+
callback: (canvas) => {
|
|
10054
|
+
stage.destroy();
|
|
10055
|
+
resolve(canvas);
|
|
10056
|
+
}
|
|
10057
|
+
});
|
|
10058
|
+
}
|
|
10176
10059
|
});
|
|
10177
10060
|
}
|
|
10178
10061
|
async exportNodesServerSide(nodes, boundingNodes, options) {
|