watermark-js-plus 1.5.5 → 1.5.7

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * watermark-js-plus v1.5.5
2
+ * watermark-js-plus v1.5.7
3
3
  * (c) 2022-2024 Michael Sun
4
4
  * Released under the MIT License.
5
5
  */
@@ -3155,6 +3155,12 @@ if (!g.fetch) {
3155
3155
  g.Response = Response;
3156
3156
  }
3157
3157
 
3158
+ if (typeof CanvasRenderingContext2D !== 'undefined' && !CanvasRenderingContext2D.prototype.resetTransform) {
3159
+ CanvasRenderingContext2D.prototype.resetTransform = function () {
3160
+ this.setTransform(1, 0, 0, 1, 0, 0);
3161
+ };
3162
+ }
3163
+
3158
3164
  function styleInject(css, ref) {
3159
3165
  if ( ref === void 0 ) ref = {};
3160
3166
  var insertAt = ref.insertAt;
@@ -3771,7 +3777,10 @@ var WatermarkCanvas = /** @class */ (function () {
3771
3777
  throw new Error('get context error');
3772
3778
  }
3773
3779
  ctx.restore();
3780
+ ctx.resetTransform();
3774
3781
  ctx.clearRect(0, 0, canvas.width, canvas.height);
3782
+ var ratio = window.devicePixelRatio || 1;
3783
+ ctx.setTransform(ratio, 0, 0, ratio, 0, 0);
3775
3784
  };
3776
3785
  WatermarkCanvas.prototype.getCanvas = function () {
3777
3786
  return this.canvas;