@inweb/markup 27.1.3 → 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 CHANGED
@@ -12863,10 +12863,22 @@ js: import "konva/skia-backend";
12863
12863
  viewpoint.ellipses = this.getMarkupEllipses();
12864
12864
  viewpoint.images = this.getMarkupImages();
12865
12865
  viewpoint.rectangles = this.getMarkupRectangles();
12866
- viewpoint.snapshot = { data: this.combineMarkupWithDrawing() };
12867
12866
  viewpoint.custom_fields.markup_color = this.getMarkupColor();
12868
12867
  return viewpoint;
12869
12868
  }
12869
+ getSnapshot(type = "image/jpeg", quality = 0.25) {
12870
+ this.clearSelected();
12871
+ const tempCanvas = document.createElement("canvas");
12872
+ if (this._konvaStage) {
12873
+ tempCanvas.width = this._konvaStage.width();
12874
+ tempCanvas.height = this._konvaStage.height();
12875
+ const ctx = tempCanvas.getContext("2d");
12876
+ if (this._container instanceof HTMLCanvasElement)
12877
+ ctx.drawImage(this._container, 0, 0);
12878
+ ctx.drawImage(this._konvaStage.toCanvas({ pixelRatio: window.devicePixelRatio }), 0, 0);
12879
+ }
12880
+ return tempCanvas.toDataURL(type, quality);
12881
+ }
12870
12882
  enableEditMode(mode) {
12871
12883
  if (!mode || !MarkupMode2Konva[mode]) {
12872
12884
  this.clearSelected();
@@ -13303,19 +13315,6 @@ js: import "konva/skia-backend";
13303
13315
  });
13304
13316
  return clouds;
13305
13317
  }
13306
- combineMarkupWithDrawing() {
13307
- this.clearSelected();
13308
- const tempCanvas = document.createElement("canvas");
13309
- if (this._konvaStage) {
13310
- tempCanvas.width = this._konvaStage.width();
13311
- tempCanvas.height = this._konvaStage.height();
13312
- const ctx = tempCanvas.getContext("2d");
13313
- if (this._container instanceof HTMLCanvasElement)
13314
- ctx.drawImage(this._container, 0, 0);
13315
- ctx.drawImage(this._konvaStage.toCanvas({ pixelRatio: window.devicePixelRatio }), 0, 0);
13316
- }
13317
- return tempCanvas.toDataURL("image/jpeg", 0.25);
13318
- }
13319
13318
  addLine(linePoints, color, type, width, id) {
13320
13319
  if (!linePoints || linePoints.length === 0)
13321
13320
  return;