watermark-js-plus 1.5.8 → 1.6.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/ie/index.cjs.js +107 -78
- package/dist/ie/index.cjs.js.map +1 -1
- package/dist/ie/index.cjs.min.js +1 -1
- package/dist/ie/index.esm.js +107 -78
- package/dist/ie/index.esm.js.map +1 -1
- package/dist/ie/index.esm.min.js +1 -1
- package/dist/ie/index.iife.js +107 -78
- package/dist/ie/index.iife.js.map +1 -1
- package/dist/ie/index.iife.min.js +1 -1
- package/dist/ie/index.umd.js +107 -78
- package/dist/ie/index.umd.js.map +1 -1
- package/dist/ie/index.umd.min.js +1 -1
- package/dist/index.cjs.js +105 -76
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.esm.js +105 -76
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.iife.js +105 -76
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.umd.js +105 -76
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/types/{src/types → types}/index.d.ts +1 -0
- package/dist/{ie/types/src → types}/utils/index.d.ts +1 -0
- package/package.json +45 -32
- package/dist/ie/types/src/types/index.d.ts +0 -128
- package/dist/ie/types/tests/core/blind.test.d.ts +0 -1
- package/dist/ie/types/tests/core/image.test.d.ts +0 -1
- package/dist/ie/types/tests/core/watermark.test.d.ts +0 -1
- package/dist/ie/types/tests/utils/index.d.ts +0 -2
- package/dist/ie/types/tests/utils/index.test.d.ts +0 -1
- package/dist/types/src/core/blind.d.ts +0 -19
- package/dist/types/src/core/canvas.d.ts +0 -51
- package/dist/types/src/core/image.d.ts +0 -22
- package/dist/types/src/core/layout/grid.d.ts +0 -14
- package/dist/types/src/core/layout/index.d.ts +0 -4
- package/dist/types/src/core/watermark.d.ts +0 -48
- package/dist/types/src/index.d.ts +0 -5
- package/dist/types/src/index.ie.d.ts +0 -7
- package/dist/types/src/style/index.d.ts +0 -1
- package/dist/types/src/utils/index.d.ts +0 -14
- package/dist/types/src/utils/initialization.d.ts +0 -19
- package/dist/types/src/utils/protection.d.ts +0 -2
- package/dist/types/tests/core/blind.test.d.ts +0 -1
- package/dist/types/tests/core/image.test.d.ts +0 -1
- package/dist/types/tests/core/watermark.test.d.ts +0 -1
- package/dist/types/tests/utils/index.d.ts +0 -2
- package/dist/types/tests/utils/index.test.d.ts +0 -1
- /package/dist/{ie/types/src → types}/core/blind.d.ts +0 -0
- /package/dist/{ie/types/src → types}/core/canvas.d.ts +0 -0
- /package/dist/{ie/types/src → types}/core/image.d.ts +0 -0
- /package/dist/{ie/types/src → types}/core/layout/grid.d.ts +0 -0
- /package/dist/{ie/types/src → types}/core/layout/index.d.ts +0 -0
- /package/dist/{ie/types/src → types}/core/watermark.d.ts +0 -0
- /package/dist/{ie/types/src → types}/index.d.ts +0 -0
- /package/dist/{ie/types/src → types}/index.ie.d.ts +0 -0
- /package/dist/{ie/types/src → types}/style/index.d.ts +0 -0
- /package/dist/{ie/types/src → types}/utils/initialization.d.ts +0 -0
- /package/dist/types/{src/utils → utils}/polyfill.d.ts +0 -0
- /package/dist/{ie/types/src → types}/utils/protection.d.ts +0 -0
package/dist/index.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* watermark-js-plus v1.
|
|
2
|
+
* watermark-js-plus v1.6.0
|
|
3
3
|
* (c) 2022-2024 Michael Sun
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
var css_248z = "@keyframes watermark{0%{background-position:0 0}25%{background-position:100% 100%}50%{background-position:
|
|
39
|
+
var css_248z = "@keyframes watermark{0%{background-position:0 0}25%{background-position:100% 100%}50%{background-position:100% 0}75%{background-position:0 100%}to{background-position:0 0}}@keyframes watermark-horizontal{0%{background-position-x:0}to{background-position-x:100%}}@keyframes watermark-vertical{0%{background-position-y:0}to{background-position-y:100%}}";
|
|
40
40
|
styleInject(css_248z);
|
|
41
41
|
|
|
42
42
|
/******************************************************************************
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
54
54
|
PERFORMANCE OF THIS SOFTWARE.
|
|
55
55
|
***************************************************************************** */
|
|
56
|
-
/* global Reflect, Promise */
|
|
56
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
57
57
|
|
|
58
58
|
var extendStatics = function(d, b) {
|
|
59
59
|
extendStatics = Object.setPrototypeOf ||
|
|
@@ -92,8 +92,8 @@
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
function __generator(thisArg, body) {
|
|
95
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
96
|
-
return g =
|
|
95
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
96
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
97
97
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
98
98
|
function step(op) {
|
|
99
99
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -117,7 +117,12 @@
|
|
|
117
117
|
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
118
118
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
119
119
|
}
|
|
120
|
-
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
123
|
+
var e = new Error(message);
|
|
124
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
125
|
+
};
|
|
121
126
|
|
|
122
127
|
var convertImage = function (canvas) {
|
|
123
128
|
return canvas.toDataURL('image/png', 1);
|
|
@@ -168,7 +173,7 @@
|
|
|
168
173
|
switch (_b.label) {
|
|
169
174
|
case 0:
|
|
170
175
|
svgElement = createSVGElement('svg', {
|
|
171
|
-
xmlns: 'http://www.w3.org/2000/svg'
|
|
176
|
+
xmlns: 'http://www.w3.org/2000/svg',
|
|
172
177
|
});
|
|
173
178
|
bodyElement = document.createElement('div');
|
|
174
179
|
bodyElement.setAttribute('xmlns', 'http://www.w3.org/1999/xhtml');
|
|
@@ -190,14 +195,14 @@
|
|
|
190
195
|
svgElement.setAttribute('height', height.toString());
|
|
191
196
|
foreignObjectElement = createSVGElement('foreignObject', {
|
|
192
197
|
width: width.toString(),
|
|
193
|
-
height: height.toString()
|
|
198
|
+
height: height.toString(),
|
|
194
199
|
});
|
|
195
200
|
foreignObjectElement.appendChild(bodyElement);
|
|
196
201
|
svgElement.appendChild(foreignObjectElement);
|
|
197
202
|
return [2 /*return*/, {
|
|
198
203
|
element: svgElement,
|
|
199
204
|
width: width,
|
|
200
|
-
height: height
|
|
205
|
+
height: height,
|
|
201
206
|
}];
|
|
202
207
|
}
|
|
203
208
|
});
|
|
@@ -265,7 +270,8 @@
|
|
|
265
270
|
var convertSVGToImage = function (svg) {
|
|
266
271
|
var richContent = svg.outerHTML
|
|
267
272
|
.replace(/<(img|br|input|hr|embed)(.*?)>/g, '<$1$2/>')
|
|
268
|
-
.replace(/\n/g, '')
|
|
273
|
+
.replace(/\n/g, '')
|
|
274
|
+
.replace(/\t/g, '')
|
|
269
275
|
.replace(/#/g, '%23');
|
|
270
276
|
return "data:image/svg+xml;charset=utf-8,".concat(richContent);
|
|
271
277
|
};
|
|
@@ -281,7 +287,7 @@
|
|
|
281
287
|
if (width === void 0) { width = undefined; }
|
|
282
288
|
if (height === void 0) { height = undefined; }
|
|
283
289
|
var image = new Image();
|
|
284
|
-
image.setAttribute('crossOrigin', '
|
|
290
|
+
image.setAttribute('crossOrigin', 'anonymous');
|
|
285
291
|
!isUndefined(width) && (image.width = width);
|
|
286
292
|
!isUndefined(height) && (image.height = height);
|
|
287
293
|
image.src = url;
|
|
@@ -294,6 +300,25 @@
|
|
|
294
300
|
var generateMatrix = function (rows, columns, value) {
|
|
295
301
|
return Array.from({ length: rows }, function () { return new Array(columns).fill(value); });
|
|
296
302
|
};
|
|
303
|
+
var generateAnimationStyle = function (movable, backgroundRepeat) {
|
|
304
|
+
if (!movable) {
|
|
305
|
+
return '';
|
|
306
|
+
}
|
|
307
|
+
var horizontalDuration = Math.random() * (8 - 2) + 2;
|
|
308
|
+
var verticalDuration = Math.random() * (4 - 2) + 2;
|
|
309
|
+
switch (backgroundRepeat) {
|
|
310
|
+
case 'repeat':
|
|
311
|
+
return 'animation: 200s linear 0s infinite alternate watermark !important;';
|
|
312
|
+
case 'repeat-x':
|
|
313
|
+
return "animation: ".concat(horizontalDuration, "s ease-in 0s infinite alternate watermark-vertical !important;'");
|
|
314
|
+
case 'repeat-y':
|
|
315
|
+
return "animation: ".concat(verticalDuration, "s ease-out 0s infinite alternate watermark-horizontal !important;'");
|
|
316
|
+
case 'no-repeat':
|
|
317
|
+
return "animation: ".concat(horizontalDuration, "s ease-in 0s infinite alternate watermark-horizontal, ").concat(verticalDuration, "s ease-out 0s infinite alternate watermark-vertical !important;");
|
|
318
|
+
default:
|
|
319
|
+
return '';
|
|
320
|
+
}
|
|
321
|
+
};
|
|
297
322
|
|
|
298
323
|
var initialOptions = {
|
|
299
324
|
width: 300,
|
|
@@ -329,7 +354,7 @@
|
|
|
329
354
|
onSuccess: function () { },
|
|
330
355
|
onBeforeDestroy: function () { },
|
|
331
356
|
onDestroyed: function () { },
|
|
332
|
-
onObserveError: function () { }
|
|
357
|
+
onObserveError: function () { },
|
|
333
358
|
};
|
|
334
359
|
var generateRecommendOptions = function (canvas, options, args) {
|
|
335
360
|
var ctx = canvas.getContext('2d');
|
|
@@ -342,7 +367,7 @@
|
|
|
342
367
|
ctx.letterSpacing = options.letterSpacing;
|
|
343
368
|
ctx.wordSpacing = options.wordSpacing;
|
|
344
369
|
if (options === null || options === void 0 ? void 0 : options.rotate) {
|
|
345
|
-
options.rotate = (360 - options.rotate % 360) * (Math.PI / 180);
|
|
370
|
+
options.rotate = (360 - (options.rotate % 360)) * (Math.PI / 180);
|
|
346
371
|
}
|
|
347
372
|
if (isUndefined(args.textRowMaxWidth)) {
|
|
348
373
|
options.textRowMaxWidth = options.width;
|
|
@@ -351,21 +376,21 @@
|
|
|
351
376
|
image: {
|
|
352
377
|
rect: {
|
|
353
378
|
width: options.imageWidth,
|
|
354
|
-
height: options.imageHeight
|
|
379
|
+
height: options.imageHeight,
|
|
355
380
|
},
|
|
356
381
|
position: {
|
|
357
382
|
x: 0,
|
|
358
|
-
y: 0
|
|
359
|
-
}
|
|
383
|
+
y: 0,
|
|
384
|
+
},
|
|
360
385
|
},
|
|
361
386
|
textLine: {
|
|
362
387
|
data: [],
|
|
363
|
-
yOffsetValue: 0
|
|
388
|
+
yOffsetValue: 0,
|
|
364
389
|
},
|
|
365
390
|
advancedStyleParams: {
|
|
366
391
|
linear: {
|
|
367
392
|
x0: 0,
|
|
368
|
-
x1: 0
|
|
393
|
+
x1: 0,
|
|
369
394
|
},
|
|
370
395
|
radial: {
|
|
371
396
|
x0: 0,
|
|
@@ -373,15 +398,15 @@
|
|
|
373
398
|
r0: 0,
|
|
374
399
|
x1: 0,
|
|
375
400
|
y1: 0,
|
|
376
|
-
r1: 0
|
|
401
|
+
r1: 0,
|
|
377
402
|
},
|
|
378
403
|
conic: {
|
|
379
404
|
x: 0,
|
|
380
405
|
y: 0,
|
|
381
|
-
startAngle: 0
|
|
406
|
+
startAngle: 0,
|
|
382
407
|
},
|
|
383
|
-
pattern: {}
|
|
384
|
-
}
|
|
408
|
+
pattern: {},
|
|
409
|
+
},
|
|
385
410
|
};
|
|
386
411
|
switch (options.contentType) {
|
|
387
412
|
case 'text':
|
|
@@ -431,14 +456,14 @@
|
|
|
431
456
|
result.advancedStyleParams.linear.x0 = -options.width / 2;
|
|
432
457
|
result.advancedStyleParams.linear.x1 = options.width / 2;
|
|
433
458
|
// result.advancedStyleParams.radial.x0 = 0
|
|
434
|
-
result.advancedStyleParams.radial.y0 = result.textLine.data.length * options.lineHeight / 2;
|
|
459
|
+
result.advancedStyleParams.radial.y0 = (result.textLine.data.length * options.lineHeight) / 2;
|
|
435
460
|
// result.advancedStyleParams.radial.r0 = 0
|
|
436
461
|
// result.advancedStyleParams.radial.x1 = 0
|
|
437
462
|
// result.advancedStyleParams.radial.y1 = 0
|
|
438
|
-
result.advancedStyleParams.radial.y1 = result.textLine.data.length * options.lineHeight / 2;
|
|
463
|
+
result.advancedStyleParams.radial.y1 = (result.textLine.data.length * options.lineHeight) / 2;
|
|
439
464
|
// result.advancedStyleParams.radial.r1 = options.width / 2
|
|
440
465
|
// result.advancedStyleParams.conic.x = 0
|
|
441
|
-
result.advancedStyleParams.conic.y = result.textLine.data.length * options.lineHeight / 2;
|
|
466
|
+
result.advancedStyleParams.conic.y = (result.textLine.data.length * options.lineHeight) / 2;
|
|
442
467
|
break;
|
|
443
468
|
case 'top-start':
|
|
444
469
|
translateX = 0;
|
|
@@ -448,13 +473,13 @@
|
|
|
448
473
|
result.advancedStyleParams.linear.x0 = 0;
|
|
449
474
|
result.advancedStyleParams.linear.x1 = options.width;
|
|
450
475
|
result.advancedStyleParams.radial.x0 = options.width / 2;
|
|
451
|
-
result.advancedStyleParams.radial.y0 = result.textLine.data.length * options.lineHeight / 2;
|
|
476
|
+
result.advancedStyleParams.radial.y0 = (result.textLine.data.length * options.lineHeight) / 2;
|
|
452
477
|
// result.advancedStyleParams.radial.r0 = 0
|
|
453
478
|
result.advancedStyleParams.radial.x1 = options.width / 2;
|
|
454
|
-
result.advancedStyleParams.radial.y1 = result.textLine.data.length * options.lineHeight / 2;
|
|
479
|
+
result.advancedStyleParams.radial.y1 = (result.textLine.data.length * options.lineHeight) / 2;
|
|
455
480
|
// result.advancedStyleParams.radial.r1 = options.width / 2
|
|
456
481
|
result.advancedStyleParams.conic.x = options.width / 2;
|
|
457
|
-
result.advancedStyleParams.conic.y = result.textLine.data.length * options.lineHeight / 2;
|
|
482
|
+
result.advancedStyleParams.conic.y = (result.textLine.data.length * options.lineHeight) / 2;
|
|
458
483
|
break;
|
|
459
484
|
case 'top-end':
|
|
460
485
|
translateX = options.width;
|
|
@@ -464,13 +489,13 @@
|
|
|
464
489
|
result.advancedStyleParams.linear.x0 = 0;
|
|
465
490
|
result.advancedStyleParams.linear.x1 = -options.width;
|
|
466
491
|
result.advancedStyleParams.radial.x0 = -options.width / 2;
|
|
467
|
-
result.advancedStyleParams.radial.y0 = result.textLine.data.length * options.lineHeight / 2;
|
|
492
|
+
result.advancedStyleParams.radial.y0 = (result.textLine.data.length * options.lineHeight) / 2;
|
|
468
493
|
// result.advancedStyleParams.radial.r0 = 0
|
|
469
494
|
result.advancedStyleParams.radial.x1 = -options.width / 2;
|
|
470
|
-
result.advancedStyleParams.radial.y1 = result.textLine.data.length * options.lineHeight / 2;
|
|
495
|
+
result.advancedStyleParams.radial.y1 = (result.textLine.data.length * options.lineHeight) / 2;
|
|
471
496
|
// result.advancedStyleParams.radial.r1 = options.width / 2
|
|
472
497
|
result.advancedStyleParams.conic.x = -options.width / 2;
|
|
473
|
-
result.advancedStyleParams.conic.y = result.textLine.data.length * options.lineHeight / 2;
|
|
498
|
+
result.advancedStyleParams.conic.y = (result.textLine.data.length * options.lineHeight) / 2;
|
|
474
499
|
break;
|
|
475
500
|
case 'bottom':
|
|
476
501
|
translateX = options.width / 2;
|
|
@@ -480,13 +505,13 @@
|
|
|
480
505
|
result.advancedStyleParams.linear.x0 = -options.width / 2;
|
|
481
506
|
result.advancedStyleParams.linear.x1 = options.width / 2;
|
|
482
507
|
// result.advancedStyleParams.radial.x0 = 0
|
|
483
|
-
result.advancedStyleParams.radial.y0 = -result.textLine.data.length * options.lineHeight / 2;
|
|
508
|
+
result.advancedStyleParams.radial.y0 = (-result.textLine.data.length * options.lineHeight) / 2;
|
|
484
509
|
// result.advancedStyleParams.radial.r0 = 0
|
|
485
510
|
// result.advancedStyleParams.radial.x1 = 0
|
|
486
|
-
result.advancedStyleParams.radial.y1 = -result.textLine.data.length * options.lineHeight / 2;
|
|
511
|
+
result.advancedStyleParams.radial.y1 = (-result.textLine.data.length * options.lineHeight) / 2;
|
|
487
512
|
// result.advancedStyleParams.radial.r1 = options.width / 2
|
|
488
513
|
result.advancedStyleParams.conic.x = 0;
|
|
489
|
-
result.advancedStyleParams.conic.y = -result.textLine.data.length * options.lineHeight / 2;
|
|
514
|
+
result.advancedStyleParams.conic.y = (-result.textLine.data.length * options.lineHeight) / 2;
|
|
490
515
|
break;
|
|
491
516
|
case 'bottom-start':
|
|
492
517
|
translateX = 0;
|
|
@@ -496,13 +521,13 @@
|
|
|
496
521
|
result.advancedStyleParams.linear.x0 = 0;
|
|
497
522
|
result.advancedStyleParams.linear.x1 = options.width;
|
|
498
523
|
result.advancedStyleParams.radial.x0 = options.width / 2;
|
|
499
|
-
result.advancedStyleParams.radial.y0 = -result.textLine.data.length * options.lineHeight / 2;
|
|
524
|
+
result.advancedStyleParams.radial.y0 = (-result.textLine.data.length * options.lineHeight) / 2;
|
|
500
525
|
// result.advancedStyleParams.radial.r0 = 0
|
|
501
526
|
result.advancedStyleParams.radial.x1 = options.width / 2;
|
|
502
|
-
result.advancedStyleParams.radial.y1 = -result.textLine.data.length * options.lineHeight / 2;
|
|
527
|
+
result.advancedStyleParams.radial.y1 = (-result.textLine.data.length * options.lineHeight) / 2;
|
|
503
528
|
// result.advancedStyleParams.radial.r1 = options.width / 2
|
|
504
529
|
result.advancedStyleParams.conic.x = options.width / 2;
|
|
505
|
-
result.advancedStyleParams.conic.y = -result.textLine.data.length * options.lineHeight / 2;
|
|
530
|
+
result.advancedStyleParams.conic.y = (-result.textLine.data.length * options.lineHeight) / 2;
|
|
506
531
|
break;
|
|
507
532
|
case 'bottom-end':
|
|
508
533
|
translateX = options.width;
|
|
@@ -512,13 +537,13 @@
|
|
|
512
537
|
result.advancedStyleParams.linear.x0 = 0;
|
|
513
538
|
result.advancedStyleParams.linear.x1 = -options.width;
|
|
514
539
|
result.advancedStyleParams.radial.x0 = -options.width / 2;
|
|
515
|
-
result.advancedStyleParams.radial.y0 = -result.textLine.data.length * options.lineHeight / 2;
|
|
540
|
+
result.advancedStyleParams.radial.y0 = (-result.textLine.data.length * options.lineHeight) / 2;
|
|
516
541
|
// result.advancedStyleParams.radial.r0 = 0
|
|
517
542
|
result.advancedStyleParams.radial.x1 = -options.width / 2;
|
|
518
|
-
result.advancedStyleParams.radial.y1 = -result.textLine.data.length * options.lineHeight / 2;
|
|
543
|
+
result.advancedStyleParams.radial.y1 = (-result.textLine.data.length * options.lineHeight) / 2;
|
|
519
544
|
// result.advancedStyleParams.radial.r1 = options.width / 2
|
|
520
545
|
result.advancedStyleParams.conic.x = -options.width / 2;
|
|
521
|
-
result.advancedStyleParams.conic.y = -result.textLine.data.length * options.lineHeight / 2;
|
|
546
|
+
result.advancedStyleParams.conic.y = (-result.textLine.data.length * options.lineHeight) / 2;
|
|
522
547
|
break;
|
|
523
548
|
case 'left':
|
|
524
549
|
translateX = 0;
|
|
@@ -560,12 +585,13 @@
|
|
|
560
585
|
if (['text', 'multi-line-text'].includes(options.contentType)) {
|
|
561
586
|
switch (options.textBaseline) {
|
|
562
587
|
case 'middle':
|
|
563
|
-
result.textLine.yOffsetValue = (result.textLine.data.length - 1) * options.lineHeight / 2;
|
|
588
|
+
result.textLine.yOffsetValue = ((result.textLine.data.length - 1) * options.lineHeight) / 2;
|
|
564
589
|
break;
|
|
565
590
|
case 'bottom':
|
|
566
591
|
case 'alphabetic':
|
|
567
592
|
case 'ideographic':
|
|
568
|
-
result.textLine.yOffsetValue =
|
|
593
|
+
result.textLine.yOffsetValue =
|
|
594
|
+
(result.textLine.data.length - 1) * options.lineHeight + (options.lineHeight - parseInt(options.fontSize)) / 2;
|
|
569
595
|
break;
|
|
570
596
|
case 'top':
|
|
571
597
|
case 'hanging':
|
|
@@ -583,11 +609,11 @@
|
|
|
583
609
|
if (need) {
|
|
584
610
|
Object.defineProperty(window, 'MutationObserver', {
|
|
585
611
|
writable: false,
|
|
586
|
-
configurable: false
|
|
612
|
+
configurable: false,
|
|
587
613
|
});
|
|
588
614
|
Object.defineProperty(window, 'requestAnimationFrame', {
|
|
589
615
|
writable: false,
|
|
590
|
-
configurable: false
|
|
616
|
+
configurable: false,
|
|
591
617
|
});
|
|
592
618
|
}
|
|
593
619
|
});
|
|
@@ -716,7 +742,7 @@
|
|
|
716
742
|
};
|
|
717
743
|
WatermarkCanvas.prototype.createLinearGradient = function (ctx) {
|
|
718
744
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
719
|
-
var gradient = ctx.createLinearGradient(getValue((_c = (_b = (_a = this.options.advancedStyle) === null || _a === void 0 ? void 0 : _a.params) === null || _b === void 0 ? void 0 : _b.linear) === null || _c === void 0 ? void 0 : _c.x0, this.recommendOptions.advancedStyleParams.linear.x0), getValue((_f = (_e = (_d = this.options.advancedStyle) === null || _d === void 0 ? void 0 : _d.params) === null || _e === void 0 ? void 0 : _e.linear) === null || _f === void 0 ? void 0 : _f.y0, 0), getValue((_j = (_h = (_g = this.options.advancedStyle) === null || _g === void 0 ? void 0 : _g.params) === null || _h === void 0 ? void 0 : _h.linear) === null || _j === void 0 ? void 0 : _j.x1, this.recommendOptions.advancedStyleParams.linear.x1), getValue((_m = (_l = (_k = this.options.advancedStyle) === null || _k === void 0 ? void 0 : _k.params) === null || _l === void 0 ? void 0 : _l.linear) === null || _m === void 0 ? void 0 : _m.y1, 0));
|
|
745
|
+
var gradient = ctx.createLinearGradient((getValue((_c = (_b = (_a = this.options.advancedStyle) === null || _a === void 0 ? void 0 : _a.params) === null || _b === void 0 ? void 0 : _b.linear) === null || _c === void 0 ? void 0 : _c.x0, this.recommendOptions.advancedStyleParams.linear.x0)), getValue((_f = (_e = (_d = this.options.advancedStyle) === null || _d === void 0 ? void 0 : _d.params) === null || _e === void 0 ? void 0 : _e.linear) === null || _f === void 0 ? void 0 : _f.y0, 0), (getValue((_j = (_h = (_g = this.options.advancedStyle) === null || _g === void 0 ? void 0 : _g.params) === null || _h === void 0 ? void 0 : _h.linear) === null || _j === void 0 ? void 0 : _j.x1, this.recommendOptions.advancedStyleParams.linear.x1)), getValue((_m = (_l = (_k = this.options.advancedStyle) === null || _k === void 0 ? void 0 : _k.params) === null || _l === void 0 ? void 0 : _l.linear) === null || _m === void 0 ? void 0 : _m.y1, 0));
|
|
720
746
|
(_q = (_p = (_o = this.options) === null || _o === void 0 ? void 0 : _o.advancedStyle) === null || _p === void 0 ? void 0 : _p.colorStops) === null || _q === void 0 ? void 0 : _q.forEach(function (item) {
|
|
721
747
|
gradient.addColorStop(item.offset, item.color);
|
|
722
748
|
});
|
|
@@ -724,7 +750,7 @@
|
|
|
724
750
|
};
|
|
725
751
|
WatermarkCanvas.prototype.createConicGradient = function (ctx) {
|
|
726
752
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
727
|
-
var gradient = ctx.createConicGradient(getValue((_d = (_c = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.advancedStyle) === null || _b === void 0 ? void 0 : _b.params) === null || _c === void 0 ? void 0 : _c.conic) === null || _d === void 0 ? void 0 : _d.startAngle, 0), getValue((_h = (_g = (_f = (_e = this.options) === null || _e === void 0 ? void 0 : _e.advancedStyle) === null || _f === void 0 ? void 0 : _f.params) === null || _g === void 0 ? void 0 : _g.conic) === null || _h === void 0 ? void 0 : _h.x, this.recommendOptions.advancedStyleParams.conic.x), getValue((_m = (_l = (_k = (_j = this.options) === null || _j === void 0 ? void 0 : _j.advancedStyle) === null || _k === void 0 ? void 0 : _k.params) === null || _l === void 0 ? void 0 : _l.conic) === null || _m === void 0 ? void 0 : _m.y, this.recommendOptions.advancedStyleParams.conic.y));
|
|
753
|
+
var gradient = ctx.createConicGradient(getValue((_d = (_c = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.advancedStyle) === null || _b === void 0 ? void 0 : _b.params) === null || _c === void 0 ? void 0 : _c.conic) === null || _d === void 0 ? void 0 : _d.startAngle, 0), (getValue((_h = (_g = (_f = (_e = this.options) === null || _e === void 0 ? void 0 : _e.advancedStyle) === null || _f === void 0 ? void 0 : _f.params) === null || _g === void 0 ? void 0 : _g.conic) === null || _h === void 0 ? void 0 : _h.x, this.recommendOptions.advancedStyleParams.conic.x)), (getValue((_m = (_l = (_k = (_j = this.options) === null || _j === void 0 ? void 0 : _j.advancedStyle) === null || _k === void 0 ? void 0 : _k.params) === null || _l === void 0 ? void 0 : _l.conic) === null || _m === void 0 ? void 0 : _m.y, this.recommendOptions.advancedStyleParams.conic.y)));
|
|
728
754
|
(_q = (_p = (_o = this.options) === null || _o === void 0 ? void 0 : _o.advancedStyle) === null || _p === void 0 ? void 0 : _p.colorStops) === null || _q === void 0 ? void 0 : _q.forEach(function (item) {
|
|
729
755
|
gradient.addColorStop(item.offset, item.color);
|
|
730
756
|
});
|
|
@@ -732,7 +758,7 @@
|
|
|
732
758
|
};
|
|
733
759
|
WatermarkCanvas.prototype.createRadialGradient = function (ctx) {
|
|
734
760
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
|
|
735
|
-
var gradient = ctx.createRadialGradient(getValue((_d = (_c = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.advancedStyle) === null || _b === void 0 ? void 0 : _b.params) === null || _c === void 0 ? void 0 : _c.radial) === null || _d === void 0 ? void 0 : _d.x0, this.recommendOptions.advancedStyleParams.radial.x0), getValue((_h = (_g = (_f = (_e = this.options) === null || _e === void 0 ? void 0 : _e.advancedStyle) === null || _f === void 0 ? void 0 : _f.params) === null || _g === void 0 ? void 0 : _g.radial) === null || _h === void 0 ? void 0 : _h.y0, this.recommendOptions.advancedStyleParams.radial.y0), getValue((_m = (_l = (_k = (_j = this.options) === null || _j === void 0 ? void 0 : _j.advancedStyle) === null || _k === void 0 ? void 0 : _k.params) === null || _l === void 0 ? void 0 : _l.radial) === null || _m === void 0 ? void 0 : _m.r0, this.recommendOptions.advancedStyleParams.radial.r0), getValue((_r = (_q = (_p = (_o = this.options) === null || _o === void 0 ? void 0 : _o.advancedStyle) === null || _p === void 0 ? void 0 : _p.params) === null || _q === void 0 ? void 0 : _q.radial) === null || _r === void 0 ? void 0 : _r.x1, this.recommendOptions.advancedStyleParams.radial.x1), getValue((_v = (_u = (_t = (_s = this.options) === null || _s === void 0 ? void 0 : _s.advancedStyle) === null || _t === void 0 ? void 0 : _t.params) === null || _u === void 0 ? void 0 : _u.radial) === null || _v === void 0 ? void 0 : _v.y1, this.recommendOptions.advancedStyleParams.radial.y1), getValue((_z = (_y = (_x = (_w = this.options) === null || _w === void 0 ? void 0 : _w.advancedStyle) === null || _x === void 0 ? void 0 : _x.params) === null || _y === void 0 ? void 0 : _y.radial) === null || _z === void 0 ? void 0 : _z.r1, this.recommendOptions.advancedStyleParams.radial.r1));
|
|
761
|
+
var gradient = ctx.createRadialGradient((getValue((_d = (_c = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.advancedStyle) === null || _b === void 0 ? void 0 : _b.params) === null || _c === void 0 ? void 0 : _c.radial) === null || _d === void 0 ? void 0 : _d.x0, this.recommendOptions.advancedStyleParams.radial.x0)), (getValue((_h = (_g = (_f = (_e = this.options) === null || _e === void 0 ? void 0 : _e.advancedStyle) === null || _f === void 0 ? void 0 : _f.params) === null || _g === void 0 ? void 0 : _g.radial) === null || _h === void 0 ? void 0 : _h.y0, this.recommendOptions.advancedStyleParams.radial.y0)), (getValue((_m = (_l = (_k = (_j = this.options) === null || _j === void 0 ? void 0 : _j.advancedStyle) === null || _k === void 0 ? void 0 : _k.params) === null || _l === void 0 ? void 0 : _l.radial) === null || _m === void 0 ? void 0 : _m.r0, this.recommendOptions.advancedStyleParams.radial.r0)), (getValue((_r = (_q = (_p = (_o = this.options) === null || _o === void 0 ? void 0 : _o.advancedStyle) === null || _p === void 0 ? void 0 : _p.params) === null || _q === void 0 ? void 0 : _q.radial) === null || _r === void 0 ? void 0 : _r.x1, this.recommendOptions.advancedStyleParams.radial.x1)), (getValue((_v = (_u = (_t = (_s = this.options) === null || _s === void 0 ? void 0 : _s.advancedStyle) === null || _t === void 0 ? void 0 : _t.params) === null || _u === void 0 ? void 0 : _u.radial) === null || _v === void 0 ? void 0 : _v.y1, this.recommendOptions.advancedStyleParams.radial.y1)), (getValue((_z = (_y = (_x = (_w = this.options) === null || _w === void 0 ? void 0 : _w.advancedStyle) === null || _x === void 0 ? void 0 : _x.params) === null || _y === void 0 ? void 0 : _y.radial) === null || _z === void 0 ? void 0 : _z.r1, this.recommendOptions.advancedStyleParams.radial.r1)));
|
|
736
762
|
(_2 = (_1 = (_0 = this.options) === null || _0 === void 0 ? void 0 : _0.advancedStyle) === null || _1 === void 0 ? void 0 : _1.colorStops) === null || _2 === void 0 ? void 0 : _2.forEach(function (item) {
|
|
737
763
|
gradient.addColorStop(item.offset, item.color);
|
|
738
764
|
});
|
|
@@ -740,7 +766,7 @@
|
|
|
740
766
|
};
|
|
741
767
|
WatermarkCanvas.prototype.createPattern = function (ctx) {
|
|
742
768
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
743
|
-
return ctx.createPattern((_d = (_c = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.advancedStyle) === null || _b === void 0 ? void 0 : _b.params) === null || _c === void 0 ? void 0 : _c.pattern) === null || _d === void 0 ? void 0 : _d.image, ((_h = (_g = (_f = (_e = this.options) === null || _e === void 0 ? void 0 : _e.advancedStyle) === null || _f === void 0 ? void 0 : _f.params) === null || _g === void 0 ? void 0 : _g.pattern) === null || _h === void 0 ? void 0 : _h.repetition) || '');
|
|
769
|
+
return ctx.createPattern(((_d = (_c = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.advancedStyle) === null || _b === void 0 ? void 0 : _b.params) === null || _c === void 0 ? void 0 : _c.pattern) === null || _d === void 0 ? void 0 : _d.image), ((_h = (_g = (_f = (_e = this.options) === null || _e === void 0 ? void 0 : _e.advancedStyle) === null || _f === void 0 ? void 0 : _f.params) === null || _g === void 0 ? void 0 : _g.pattern) === null || _h === void 0 ? void 0 : _h.repetition) || '');
|
|
744
770
|
};
|
|
745
771
|
WatermarkCanvas.prototype.setText = function (ctx, params) {
|
|
746
772
|
var methodName = 'fillText';
|
|
@@ -754,7 +780,7 @@
|
|
|
754
780
|
text: this.options.content,
|
|
755
781
|
x: 0,
|
|
756
782
|
y: 0 - this.recommendOptions.textLine.yOffsetValue,
|
|
757
|
-
maxWidth: this.options.textRowMaxWidth || this.options.width
|
|
783
|
+
maxWidth: this.options.textRowMaxWidth || this.options.width,
|
|
758
784
|
});
|
|
759
785
|
resolve(ctx.canvas);
|
|
760
786
|
};
|
|
@@ -788,7 +814,12 @@
|
|
|
788
814
|
var lines = this.recommendOptions.textLine.data;
|
|
789
815
|
var yOffsetValue = this.recommendOptions.textLine.yOffsetValue;
|
|
790
816
|
lines.forEach(function (text, index) {
|
|
791
|
-
_this.setText(ctx, {
|
|
817
|
+
_this.setText(ctx, {
|
|
818
|
+
text: text,
|
|
819
|
+
x: 0,
|
|
820
|
+
y: _this.options.lineHeight * index - yOffsetValue,
|
|
821
|
+
maxWidth: _this.options.textRowMaxWidth || _this.options.width,
|
|
822
|
+
});
|
|
792
823
|
});
|
|
793
824
|
resolve(ctx.canvas);
|
|
794
825
|
};
|
|
@@ -815,10 +846,10 @@
|
|
|
815
846
|
var rect = { width: this.options.imageWidth || 0, height: this.options.imageHeight || 0 };
|
|
816
847
|
switch (true) {
|
|
817
848
|
case rect.width !== 0 && rect.height === 0:
|
|
818
|
-
rect.height = rect.width * image.height / image.width;
|
|
849
|
+
rect.height = (rect.width * image.height) / image.width;
|
|
819
850
|
break;
|
|
820
851
|
case rect.width === 0 && rect.height !== 0:
|
|
821
|
-
rect.width = rect.height * image.width / image.height;
|
|
852
|
+
rect.width = (rect.height * image.width) / image.height;
|
|
822
853
|
break;
|
|
823
854
|
case rect.width === 0 && rect.height === 0:
|
|
824
855
|
rect.width = image.width;
|
|
@@ -831,7 +862,7 @@
|
|
|
831
862
|
var _a, _b;
|
|
832
863
|
var result = {
|
|
833
864
|
x: -imageWidth / 2,
|
|
834
|
-
y: -imageHeight / 2
|
|
865
|
+
y: -imageHeight / 2,
|
|
835
866
|
};
|
|
836
867
|
switch (this.options.translatePlacement) {
|
|
837
868
|
case 'top':
|
|
@@ -888,7 +919,7 @@
|
|
|
888
919
|
}
|
|
889
920
|
GridLayout.prototype.draw = function () {
|
|
890
921
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
891
|
-
var layoutCanvas = WatermarkCanvas.createCanvas(((_a = this.options.gridLayoutOptions) === null || _a === void 0 ? void 0 : _a.width) ||
|
|
922
|
+
var layoutCanvas = WatermarkCanvas.createCanvas(((_a = this.options.gridLayoutOptions) === null || _a === void 0 ? void 0 : _a.width) || this.partialWidth * this.cols + this.gap[0] * this.cols, ((_b = this.options.gridLayoutOptions) === null || _b === void 0 ? void 0 : _b.height) || this.partialHeight * this.rows + this.gap[1] * this.rows);
|
|
892
923
|
var layoutContext = layoutCanvas.getContext('2d');
|
|
893
924
|
if ((_c = this.options.gridLayoutOptions) === null || _c === void 0 ? void 0 : _c.backgroundImage) {
|
|
894
925
|
layoutContext === null || layoutContext === void 0 ? void 0 : layoutContext.drawImage((_d = this.options.gridLayoutOptions) === null || _d === void 0 ? void 0 : _d.backgroundImage, 0, 0, (_e = this.options.gridLayoutOptions) === null || _e === void 0 ? void 0 : _e.width, (_f = this.options.gridLayoutOptions) === null || _f === void 0 ? void 0 : _f.height);
|
|
@@ -917,21 +948,14 @@
|
|
|
917
948
|
var generateBackgroundSize = function (options) {
|
|
918
949
|
var _a, _b, _c;
|
|
919
950
|
switch (options.layout) {
|
|
920
|
-
case 'grid':
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
options.width * cols + gap[0] * cols,
|
|
927
|
-
options.height * rows + gap[1] * rows
|
|
928
|
-
];
|
|
929
|
-
}
|
|
951
|
+
case 'grid': {
|
|
952
|
+
var cols = ((_a = options.gridLayoutOptions) === null || _a === void 0 ? void 0 : _a.cols) || 1;
|
|
953
|
+
var rows = ((_b = options.gridLayoutOptions) === null || _b === void 0 ? void 0 : _b.rows) || 1;
|
|
954
|
+
var gap = ((_c = options.gridLayoutOptions) === null || _c === void 0 ? void 0 : _c.gap) || [0, 0];
|
|
955
|
+
return [options.width * cols + gap[0] * cols, options.height * rows + gap[1] * rows];
|
|
956
|
+
}
|
|
930
957
|
default:
|
|
931
|
-
return [
|
|
932
|
-
options.width,
|
|
933
|
-
options.height
|
|
934
|
-
];
|
|
958
|
+
return [options.width, options.height];
|
|
935
959
|
}
|
|
936
960
|
};
|
|
937
961
|
|
|
@@ -1016,14 +1040,14 @@
|
|
|
1016
1040
|
parentElementType = this.checkParentElementType();
|
|
1017
1041
|
this.watermarkDom.style.cssText = "\n z-index:".concat(this.options.zIndex, "!important;display:block!important;visibility:visible!important;transform:none!important;scale:none!important;\n ").concat(parentElementType === 'custom' ? 'top:0!important;bottom:0!important;left:0!important;right:0!important;height:100%!important;pointer-events:none!important;position:absolute!important;' : 'position:relative!important;', "\n ");
|
|
1018
1042
|
backgroundSize = generateBackgroundSize(this.options);
|
|
1019
|
-
watermarkInnerDom.style.cssText = "\n display:block!important;visibility:visible!important;pointer-events:none;top:0;bottom:0;left:0;right:0;transform:none!important;scale:none!important;\n position:".concat(parentElementType === 'root' ? 'fixed' : 'absolute', "!important;-webkit-print-color-adjust:exact!important;width:100%!important;height:100%!important;\n z-index:").concat(this.options.zIndex, "!important;background-image:url(").concat(image, ")!important;background-repeat:").concat(this.options.backgroundRepeat, "!important;\n background-size:").concat(backgroundSize[0], "px ").concat(backgroundSize[1], "px!important;background-position:").concat(this.options.backgroundPosition, ";\n ").concat(this.options.movable
|
|
1043
|
+
watermarkInnerDom.style.cssText = "\n display:block!important;visibility:visible!important;pointer-events:none;top:0;bottom:0;left:0;right:0;transform:none!important;scale:none!important;\n position:".concat(parentElementType === 'root' ? 'fixed' : 'absolute', "!important;-webkit-print-color-adjust:exact!important;width:100%!important;height:100%!important;\n z-index:").concat(this.options.zIndex, "!important;background-image:url(").concat(image, ")!important;background-repeat:").concat(this.options.backgroundRepeat, "!important;\n background-size:").concat(backgroundSize[0], "px ").concat(backgroundSize[1], "px!important;background-position:").concat(this.options.backgroundPosition, ";\n ").concat(generateAnimationStyle(this.options.movable, this.options.backgroundRepeat), "\n ");
|
|
1020
1044
|
this.watermarkDom.appendChild(watermarkInnerDom);
|
|
1021
1045
|
this.parentElement.appendChild(this.watermarkDom);
|
|
1022
1046
|
if (this.options.mutationObserve) {
|
|
1023
1047
|
try {
|
|
1024
1048
|
this.bindMutationObserve();
|
|
1025
1049
|
}
|
|
1026
|
-
catch (
|
|
1050
|
+
catch (_j) {
|
|
1027
1051
|
(_e = (_d = this.options).onObserveError) === null || _e === void 0 ? void 0 : _e.call(_d);
|
|
1028
1052
|
}
|
|
1029
1053
|
}
|
|
@@ -1155,7 +1179,7 @@
|
|
|
1155
1179
|
attributes: true, // 属性的变动
|
|
1156
1180
|
childList: true, // 子节点的变动(指新增,删除或者更改)
|
|
1157
1181
|
subtree: true, // 布尔值,表示是否将该观察器应用于该节点的所有后代节点。
|
|
1158
|
-
characterData: true // 节点内容或节点文本的变动。
|
|
1182
|
+
characterData: true, // 节点内容或节点文本的变动。
|
|
1159
1183
|
});
|
|
1160
1184
|
this.parentObserve = new MutationObserver(function (mutationsList) { return __awaiter(_this, void 0, void 0, function () {
|
|
1161
1185
|
var _i, mutationsList_1, item;
|
|
@@ -1170,7 +1194,9 @@
|
|
|
1170
1194
|
item = mutationsList_1[_i];
|
|
1171
1195
|
if (!((item === null || item === void 0 ? void 0 : item.target) === this.watermarkDom ||
|
|
1172
1196
|
((_a = item === null || item === void 0 ? void 0 : item.removedNodes) === null || _a === void 0 ? void 0 : _a[0]) === this.watermarkDom ||
|
|
1173
|
-
(item.type === 'childList' &&
|
|
1197
|
+
(item.type === 'childList' &&
|
|
1198
|
+
item.target === this.parentElement &&
|
|
1199
|
+
item.target.lastChild !== this.watermarkDom))) return [3 /*break*/, 3];
|
|
1174
1200
|
this.remove();
|
|
1175
1201
|
return [4 /*yield*/, this.create()];
|
|
1176
1202
|
case 2:
|
|
@@ -1187,7 +1213,7 @@
|
|
|
1187
1213
|
attributes: true, // 属性的变动
|
|
1188
1214
|
childList: true, // 子节点的变动(指新增,删除或者更改)
|
|
1189
1215
|
subtree: true, // 布尔值,表示是否将该观察器应用于该节点的所有后代节点。
|
|
1190
|
-
characterData: true // 节点内容或节点文本的变动。
|
|
1216
|
+
characterData: true, // 节点内容或节点文本的变动。
|
|
1191
1217
|
});
|
|
1192
1218
|
};
|
|
1193
1219
|
Watermark.prototype.bindCheckWatermarkElementEvent = function () {
|
|
@@ -1215,7 +1241,7 @@
|
|
|
1215
1241
|
if (props === void 0) { props = {}; }
|
|
1216
1242
|
var defaultProps = {
|
|
1217
1243
|
globalAlpha: 0.005,
|
|
1218
|
-
mode: 'blind'
|
|
1244
|
+
mode: 'blind',
|
|
1219
1245
|
};
|
|
1220
1246
|
return _super.call(this, __assign(__assign({}, props), defaultProps)) || this;
|
|
1221
1247
|
}
|
|
@@ -1287,12 +1313,15 @@
|
|
|
1287
1313
|
*/
|
|
1288
1314
|
function ImageWatermark(args) {
|
|
1289
1315
|
if (args === void 0) { args = {}; }
|
|
1290
|
-
var _a;
|
|
1316
|
+
var _a, _b;
|
|
1291
1317
|
this.drew = false;
|
|
1292
1318
|
this.props = args;
|
|
1293
1319
|
this.options = __assign(__assign({}, initialOptions), args);
|
|
1320
|
+
if (this.props.crossOrigin) {
|
|
1321
|
+
(_a = this.props.dom) === null || _a === void 0 ? void 0 : _a.setAttribute('crossOrigin', 'anonymous');
|
|
1322
|
+
}
|
|
1294
1323
|
this.watermarkCanvas = new WatermarkCanvas(this.props, this.options);
|
|
1295
|
-
this.originalSrc = (
|
|
1324
|
+
this.originalSrc = (_b = this.props.dom) === null || _b === void 0 ? void 0 : _b.src;
|
|
1296
1325
|
this.backgroundImage = this.getBackgroundImage();
|
|
1297
1326
|
}
|
|
1298
1327
|
ImageWatermark.prototype.create = function () {
|