@inweb/markup 27.1.2 → 27.1.4
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/markup.js +13 -14
- package/dist/markup.js.map +1 -1
- package/dist/markup.min.js +1 -1
- package/dist/markup.module.js +13 -14
- package/dist/markup.module.js.map +1 -1
- package/lib/markup/IMarkup.d.ts +15 -1
- package/lib/markup/Konva/KonvaMarkup.d.ts +1 -1
- package/package.json +3 -3
- package/src/markup/IMarkup.ts +16 -1
- package/src/markup/Konva/KonvaMarkup.ts +16 -17
package/dist/markup.module.js
CHANGED
|
@@ -1520,10 +1520,22 @@ class KonvaMarkup {
|
|
|
1520
1520
|
viewpoint.ellipses = this.getMarkupEllipses();
|
|
1521
1521
|
viewpoint.images = this.getMarkupImages();
|
|
1522
1522
|
viewpoint.rectangles = this.getMarkupRectangles();
|
|
1523
|
-
viewpoint.snapshot = { data: this.combineMarkupWithDrawing() };
|
|
1524
1523
|
viewpoint.custom_fields.markup_color = this.getMarkupColor();
|
|
1525
1524
|
return viewpoint;
|
|
1526
1525
|
}
|
|
1526
|
+
getSnapshot(type = "image/jpeg", quality = 0.25) {
|
|
1527
|
+
this.clearSelected();
|
|
1528
|
+
const tempCanvas = document.createElement("canvas");
|
|
1529
|
+
if (this._konvaStage) {
|
|
1530
|
+
tempCanvas.width = this._konvaStage.width();
|
|
1531
|
+
tempCanvas.height = this._konvaStage.height();
|
|
1532
|
+
const ctx = tempCanvas.getContext("2d");
|
|
1533
|
+
if (this._container instanceof HTMLCanvasElement)
|
|
1534
|
+
ctx.drawImage(this._container, 0, 0);
|
|
1535
|
+
ctx.drawImage(this._konvaStage.toCanvas({ pixelRatio: window.devicePixelRatio }), 0, 0);
|
|
1536
|
+
}
|
|
1537
|
+
return tempCanvas.toDataURL(type, quality);
|
|
1538
|
+
}
|
|
1527
1539
|
enableEditMode(mode) {
|
|
1528
1540
|
if (!mode || !MarkupMode2Konva[mode]) {
|
|
1529
1541
|
this.clearSelected();
|
|
@@ -1960,19 +1972,6 @@ class KonvaMarkup {
|
|
|
1960
1972
|
});
|
|
1961
1973
|
return clouds;
|
|
1962
1974
|
}
|
|
1963
|
-
combineMarkupWithDrawing() {
|
|
1964
|
-
this.clearSelected();
|
|
1965
|
-
const tempCanvas = document.createElement("canvas");
|
|
1966
|
-
if (this._konvaStage) {
|
|
1967
|
-
tempCanvas.width = this._konvaStage.width();
|
|
1968
|
-
tempCanvas.height = this._konvaStage.height();
|
|
1969
|
-
const ctx = tempCanvas.getContext("2d");
|
|
1970
|
-
if (this._container instanceof HTMLCanvasElement)
|
|
1971
|
-
ctx.drawImage(this._container, 0, 0);
|
|
1972
|
-
ctx.drawImage(this._konvaStage.toCanvas({ pixelRatio: window.devicePixelRatio }), 0, 0);
|
|
1973
|
-
}
|
|
1974
|
-
return tempCanvas.toDataURL("image/jpeg", 0.25);
|
|
1975
|
-
}
|
|
1976
1975
|
addLine(linePoints, color, type, width, id) {
|
|
1977
1976
|
if (!linePoints || linePoints.length === 0)
|
|
1978
1977
|
return;
|