watermark-js-plus 1.5.8 → 1.5.9
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 +88 -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 +88 -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 +88 -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 +88 -78
- package/dist/ie/index.umd.js.map +1 -1
- package/dist/ie/index.umd.min.js +1 -1
- package/dist/index.cjs.js +86 -76
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.esm.js +86 -76
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.iife.js +86 -76
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.umd.js +86 -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/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/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/ie/index.iife.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* watermark-js-plus v1.5.
|
|
2
|
+
* watermark-js-plus v1.5.9
|
|
3
3
|
* (c) 2022-2024 Michael Sun
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -557,10 +557,10 @@ var WatermarkPlus = (function (exports) {
|
|
|
557
557
|
var store = sharedStore.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {});
|
|
558
558
|
|
|
559
559
|
(store.versions || (store.versions = [])).push({
|
|
560
|
-
version: '3.
|
|
560
|
+
version: '3.41.0',
|
|
561
561
|
mode: IS_PURE ? 'pure' : 'global',
|
|
562
562
|
copyright: '© 2014-2025 Denis Pushkarev (zloirock.ru)',
|
|
563
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.
|
|
563
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.41.0/LICENSE',
|
|
564
564
|
source: 'https://github.com/zloirock/core-js'
|
|
565
565
|
});
|
|
566
566
|
return sharedStore.exports;
|
|
@@ -4216,7 +4216,7 @@ var WatermarkPlus = (function (exports) {
|
|
|
4216
4216
|
}
|
|
4217
4217
|
}
|
|
4218
4218
|
|
|
4219
|
-
var css_248z = "@keyframes watermark{0%{background-position:0 0}25%{background-position:100% 100%}50%{background-position:
|
|
4219
|
+
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}}";
|
|
4220
4220
|
styleInject(css_248z);
|
|
4221
4221
|
|
|
4222
4222
|
/******************************************************************************
|
|
@@ -4233,7 +4233,7 @@ var WatermarkPlus = (function (exports) {
|
|
|
4233
4233
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
4234
4234
|
PERFORMANCE OF THIS SOFTWARE.
|
|
4235
4235
|
***************************************************************************** */
|
|
4236
|
-
/* global Reflect, Promise */
|
|
4236
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
4237
4237
|
|
|
4238
4238
|
var extendStatics = function(d, b) {
|
|
4239
4239
|
extendStatics = Object.setPrototypeOf ||
|
|
@@ -4272,8 +4272,8 @@ var WatermarkPlus = (function (exports) {
|
|
|
4272
4272
|
}
|
|
4273
4273
|
|
|
4274
4274
|
function __generator(thisArg, body) {
|
|
4275
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
4276
|
-
return g =
|
|
4275
|
+
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);
|
|
4276
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
4277
4277
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
4278
4278
|
function step(op) {
|
|
4279
4279
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -4297,7 +4297,12 @@ var WatermarkPlus = (function (exports) {
|
|
|
4297
4297
|
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
4298
4298
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
4299
4299
|
}
|
|
4300
|
-
}
|
|
4300
|
+
}
|
|
4301
|
+
|
|
4302
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
4303
|
+
var e = new Error(message);
|
|
4304
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
4305
|
+
};
|
|
4301
4306
|
|
|
4302
4307
|
var convertImage = function (canvas) {
|
|
4303
4308
|
return canvas.toDataURL('image/png', 1);
|
|
@@ -4348,7 +4353,7 @@ var WatermarkPlus = (function (exports) {
|
|
|
4348
4353
|
switch (_b.label) {
|
|
4349
4354
|
case 0:
|
|
4350
4355
|
svgElement = createSVGElement('svg', {
|
|
4351
|
-
xmlns: 'http://www.w3.org/2000/svg'
|
|
4356
|
+
xmlns: 'http://www.w3.org/2000/svg',
|
|
4352
4357
|
});
|
|
4353
4358
|
bodyElement = document.createElement('div');
|
|
4354
4359
|
bodyElement.setAttribute('xmlns', 'http://www.w3.org/1999/xhtml');
|
|
@@ -4370,14 +4375,14 @@ var WatermarkPlus = (function (exports) {
|
|
|
4370
4375
|
svgElement.setAttribute('height', height.toString());
|
|
4371
4376
|
foreignObjectElement = createSVGElement('foreignObject', {
|
|
4372
4377
|
width: width.toString(),
|
|
4373
|
-
height: height.toString()
|
|
4378
|
+
height: height.toString(),
|
|
4374
4379
|
});
|
|
4375
4380
|
foreignObjectElement.appendChild(bodyElement);
|
|
4376
4381
|
svgElement.appendChild(foreignObjectElement);
|
|
4377
4382
|
return [2 /*return*/, {
|
|
4378
4383
|
element: svgElement,
|
|
4379
4384
|
width: width,
|
|
4380
|
-
height: height
|
|
4385
|
+
height: height,
|
|
4381
4386
|
}];
|
|
4382
4387
|
}
|
|
4383
4388
|
});
|
|
@@ -4445,7 +4450,8 @@ var WatermarkPlus = (function (exports) {
|
|
|
4445
4450
|
var convertSVGToImage = function (svg) {
|
|
4446
4451
|
var richContent = svg.outerHTML
|
|
4447
4452
|
.replace(/<(img|br|input|hr|embed)(.*?)>/g, '<$1$2/>')
|
|
4448
|
-
.replace(/\n/g, '')
|
|
4453
|
+
.replace(/\n/g, '')
|
|
4454
|
+
.replace(/\t/g, '')
|
|
4449
4455
|
.replace(/#/g, '%23');
|
|
4450
4456
|
return "data:image/svg+xml;charset=utf-8,".concat(richContent);
|
|
4451
4457
|
};
|
|
@@ -4461,7 +4467,7 @@ var WatermarkPlus = (function (exports) {
|
|
|
4461
4467
|
if (width === void 0) { width = undefined; }
|
|
4462
4468
|
if (height === void 0) { height = undefined; }
|
|
4463
4469
|
var image = new Image();
|
|
4464
|
-
image.setAttribute('crossOrigin', '
|
|
4470
|
+
image.setAttribute('crossOrigin', 'anonymous');
|
|
4465
4471
|
!isUndefined(width) && (image.width = width);
|
|
4466
4472
|
!isUndefined(height) && (image.height = height);
|
|
4467
4473
|
image.src = url;
|
|
@@ -4509,7 +4515,7 @@ var WatermarkPlus = (function (exports) {
|
|
|
4509
4515
|
onSuccess: function () { },
|
|
4510
4516
|
onBeforeDestroy: function () { },
|
|
4511
4517
|
onDestroyed: function () { },
|
|
4512
|
-
onObserveError: function () { }
|
|
4518
|
+
onObserveError: function () { },
|
|
4513
4519
|
};
|
|
4514
4520
|
var generateRecommendOptions = function (canvas, options, args) {
|
|
4515
4521
|
var ctx = canvas.getContext('2d');
|
|
@@ -4522,7 +4528,7 @@ var WatermarkPlus = (function (exports) {
|
|
|
4522
4528
|
ctx.letterSpacing = options.letterSpacing;
|
|
4523
4529
|
ctx.wordSpacing = options.wordSpacing;
|
|
4524
4530
|
if (options === null || options === void 0 ? void 0 : options.rotate) {
|
|
4525
|
-
options.rotate = (360 - options.rotate % 360) * (Math.PI / 180);
|
|
4531
|
+
options.rotate = (360 - (options.rotate % 360)) * (Math.PI / 180);
|
|
4526
4532
|
}
|
|
4527
4533
|
if (isUndefined(args.textRowMaxWidth)) {
|
|
4528
4534
|
options.textRowMaxWidth = options.width;
|
|
@@ -4531,21 +4537,21 @@ var WatermarkPlus = (function (exports) {
|
|
|
4531
4537
|
image: {
|
|
4532
4538
|
rect: {
|
|
4533
4539
|
width: options.imageWidth,
|
|
4534
|
-
height: options.imageHeight
|
|
4540
|
+
height: options.imageHeight,
|
|
4535
4541
|
},
|
|
4536
4542
|
position: {
|
|
4537
4543
|
x: 0,
|
|
4538
|
-
y: 0
|
|
4539
|
-
}
|
|
4544
|
+
y: 0,
|
|
4545
|
+
},
|
|
4540
4546
|
},
|
|
4541
4547
|
textLine: {
|
|
4542
4548
|
data: [],
|
|
4543
|
-
yOffsetValue: 0
|
|
4549
|
+
yOffsetValue: 0,
|
|
4544
4550
|
},
|
|
4545
4551
|
advancedStyleParams: {
|
|
4546
4552
|
linear: {
|
|
4547
4553
|
x0: 0,
|
|
4548
|
-
x1: 0
|
|
4554
|
+
x1: 0,
|
|
4549
4555
|
},
|
|
4550
4556
|
radial: {
|
|
4551
4557
|
x0: 0,
|
|
@@ -4553,15 +4559,15 @@ var WatermarkPlus = (function (exports) {
|
|
|
4553
4559
|
r0: 0,
|
|
4554
4560
|
x1: 0,
|
|
4555
4561
|
y1: 0,
|
|
4556
|
-
r1: 0
|
|
4562
|
+
r1: 0,
|
|
4557
4563
|
},
|
|
4558
4564
|
conic: {
|
|
4559
4565
|
x: 0,
|
|
4560
4566
|
y: 0,
|
|
4561
|
-
startAngle: 0
|
|
4567
|
+
startAngle: 0,
|
|
4562
4568
|
},
|
|
4563
|
-
pattern: {}
|
|
4564
|
-
}
|
|
4569
|
+
pattern: {},
|
|
4570
|
+
},
|
|
4565
4571
|
};
|
|
4566
4572
|
switch (options.contentType) {
|
|
4567
4573
|
case 'text':
|
|
@@ -4611,14 +4617,14 @@ var WatermarkPlus = (function (exports) {
|
|
|
4611
4617
|
result.advancedStyleParams.linear.x0 = -options.width / 2;
|
|
4612
4618
|
result.advancedStyleParams.linear.x1 = options.width / 2;
|
|
4613
4619
|
// result.advancedStyleParams.radial.x0 = 0
|
|
4614
|
-
result.advancedStyleParams.radial.y0 = result.textLine.data.length * options.lineHeight / 2;
|
|
4620
|
+
result.advancedStyleParams.radial.y0 = (result.textLine.data.length * options.lineHeight) / 2;
|
|
4615
4621
|
// result.advancedStyleParams.radial.r0 = 0
|
|
4616
4622
|
// result.advancedStyleParams.radial.x1 = 0
|
|
4617
4623
|
// result.advancedStyleParams.radial.y1 = 0
|
|
4618
|
-
result.advancedStyleParams.radial.y1 = result.textLine.data.length * options.lineHeight / 2;
|
|
4624
|
+
result.advancedStyleParams.radial.y1 = (result.textLine.data.length * options.lineHeight) / 2;
|
|
4619
4625
|
// result.advancedStyleParams.radial.r1 = options.width / 2
|
|
4620
4626
|
// result.advancedStyleParams.conic.x = 0
|
|
4621
|
-
result.advancedStyleParams.conic.y = result.textLine.data.length * options.lineHeight / 2;
|
|
4627
|
+
result.advancedStyleParams.conic.y = (result.textLine.data.length * options.lineHeight) / 2;
|
|
4622
4628
|
break;
|
|
4623
4629
|
case 'top-start':
|
|
4624
4630
|
translateX = 0;
|
|
@@ -4628,13 +4634,13 @@ var WatermarkPlus = (function (exports) {
|
|
|
4628
4634
|
result.advancedStyleParams.linear.x0 = 0;
|
|
4629
4635
|
result.advancedStyleParams.linear.x1 = options.width;
|
|
4630
4636
|
result.advancedStyleParams.radial.x0 = options.width / 2;
|
|
4631
|
-
result.advancedStyleParams.radial.y0 = result.textLine.data.length * options.lineHeight / 2;
|
|
4637
|
+
result.advancedStyleParams.radial.y0 = (result.textLine.data.length * options.lineHeight) / 2;
|
|
4632
4638
|
// result.advancedStyleParams.radial.r0 = 0
|
|
4633
4639
|
result.advancedStyleParams.radial.x1 = options.width / 2;
|
|
4634
|
-
result.advancedStyleParams.radial.y1 = result.textLine.data.length * options.lineHeight / 2;
|
|
4640
|
+
result.advancedStyleParams.radial.y1 = (result.textLine.data.length * options.lineHeight) / 2;
|
|
4635
4641
|
// result.advancedStyleParams.radial.r1 = options.width / 2
|
|
4636
4642
|
result.advancedStyleParams.conic.x = options.width / 2;
|
|
4637
|
-
result.advancedStyleParams.conic.y = result.textLine.data.length * options.lineHeight / 2;
|
|
4643
|
+
result.advancedStyleParams.conic.y = (result.textLine.data.length * options.lineHeight) / 2;
|
|
4638
4644
|
break;
|
|
4639
4645
|
case 'top-end':
|
|
4640
4646
|
translateX = options.width;
|
|
@@ -4644,13 +4650,13 @@ var WatermarkPlus = (function (exports) {
|
|
|
4644
4650
|
result.advancedStyleParams.linear.x0 = 0;
|
|
4645
4651
|
result.advancedStyleParams.linear.x1 = -options.width;
|
|
4646
4652
|
result.advancedStyleParams.radial.x0 = -options.width / 2;
|
|
4647
|
-
result.advancedStyleParams.radial.y0 = result.textLine.data.length * options.lineHeight / 2;
|
|
4653
|
+
result.advancedStyleParams.radial.y0 = (result.textLine.data.length * options.lineHeight) / 2;
|
|
4648
4654
|
// result.advancedStyleParams.radial.r0 = 0
|
|
4649
4655
|
result.advancedStyleParams.radial.x1 = -options.width / 2;
|
|
4650
|
-
result.advancedStyleParams.radial.y1 = result.textLine.data.length * options.lineHeight / 2;
|
|
4656
|
+
result.advancedStyleParams.radial.y1 = (result.textLine.data.length * options.lineHeight) / 2;
|
|
4651
4657
|
// result.advancedStyleParams.radial.r1 = options.width / 2
|
|
4652
4658
|
result.advancedStyleParams.conic.x = -options.width / 2;
|
|
4653
|
-
result.advancedStyleParams.conic.y = result.textLine.data.length * options.lineHeight / 2;
|
|
4659
|
+
result.advancedStyleParams.conic.y = (result.textLine.data.length * options.lineHeight) / 2;
|
|
4654
4660
|
break;
|
|
4655
4661
|
case 'bottom':
|
|
4656
4662
|
translateX = options.width / 2;
|
|
@@ -4660,13 +4666,13 @@ var WatermarkPlus = (function (exports) {
|
|
|
4660
4666
|
result.advancedStyleParams.linear.x0 = -options.width / 2;
|
|
4661
4667
|
result.advancedStyleParams.linear.x1 = options.width / 2;
|
|
4662
4668
|
// result.advancedStyleParams.radial.x0 = 0
|
|
4663
|
-
result.advancedStyleParams.radial.y0 = -result.textLine.data.length * options.lineHeight / 2;
|
|
4669
|
+
result.advancedStyleParams.radial.y0 = (-result.textLine.data.length * options.lineHeight) / 2;
|
|
4664
4670
|
// result.advancedStyleParams.radial.r0 = 0
|
|
4665
4671
|
// result.advancedStyleParams.radial.x1 = 0
|
|
4666
|
-
result.advancedStyleParams.radial.y1 = -result.textLine.data.length * options.lineHeight / 2;
|
|
4672
|
+
result.advancedStyleParams.radial.y1 = (-result.textLine.data.length * options.lineHeight) / 2;
|
|
4667
4673
|
// result.advancedStyleParams.radial.r1 = options.width / 2
|
|
4668
4674
|
result.advancedStyleParams.conic.x = 0;
|
|
4669
|
-
result.advancedStyleParams.conic.y = -result.textLine.data.length * options.lineHeight / 2;
|
|
4675
|
+
result.advancedStyleParams.conic.y = (-result.textLine.data.length * options.lineHeight) / 2;
|
|
4670
4676
|
break;
|
|
4671
4677
|
case 'bottom-start':
|
|
4672
4678
|
translateX = 0;
|
|
@@ -4676,13 +4682,13 @@ var WatermarkPlus = (function (exports) {
|
|
|
4676
4682
|
result.advancedStyleParams.linear.x0 = 0;
|
|
4677
4683
|
result.advancedStyleParams.linear.x1 = options.width;
|
|
4678
4684
|
result.advancedStyleParams.radial.x0 = options.width / 2;
|
|
4679
|
-
result.advancedStyleParams.radial.y0 = -result.textLine.data.length * options.lineHeight / 2;
|
|
4685
|
+
result.advancedStyleParams.radial.y0 = (-result.textLine.data.length * options.lineHeight) / 2;
|
|
4680
4686
|
// result.advancedStyleParams.radial.r0 = 0
|
|
4681
4687
|
result.advancedStyleParams.radial.x1 = options.width / 2;
|
|
4682
|
-
result.advancedStyleParams.radial.y1 = -result.textLine.data.length * options.lineHeight / 2;
|
|
4688
|
+
result.advancedStyleParams.radial.y1 = (-result.textLine.data.length * options.lineHeight) / 2;
|
|
4683
4689
|
// result.advancedStyleParams.radial.r1 = options.width / 2
|
|
4684
4690
|
result.advancedStyleParams.conic.x = options.width / 2;
|
|
4685
|
-
result.advancedStyleParams.conic.y = -result.textLine.data.length * options.lineHeight / 2;
|
|
4691
|
+
result.advancedStyleParams.conic.y = (-result.textLine.data.length * options.lineHeight) / 2;
|
|
4686
4692
|
break;
|
|
4687
4693
|
case 'bottom-end':
|
|
4688
4694
|
translateX = options.width;
|
|
@@ -4692,13 +4698,13 @@ var WatermarkPlus = (function (exports) {
|
|
|
4692
4698
|
result.advancedStyleParams.linear.x0 = 0;
|
|
4693
4699
|
result.advancedStyleParams.linear.x1 = -options.width;
|
|
4694
4700
|
result.advancedStyleParams.radial.x0 = -options.width / 2;
|
|
4695
|
-
result.advancedStyleParams.radial.y0 = -result.textLine.data.length * options.lineHeight / 2;
|
|
4701
|
+
result.advancedStyleParams.radial.y0 = (-result.textLine.data.length * options.lineHeight) / 2;
|
|
4696
4702
|
// result.advancedStyleParams.radial.r0 = 0
|
|
4697
4703
|
result.advancedStyleParams.radial.x1 = -options.width / 2;
|
|
4698
|
-
result.advancedStyleParams.radial.y1 = -result.textLine.data.length * options.lineHeight / 2;
|
|
4704
|
+
result.advancedStyleParams.radial.y1 = (-result.textLine.data.length * options.lineHeight) / 2;
|
|
4699
4705
|
// result.advancedStyleParams.radial.r1 = options.width / 2
|
|
4700
4706
|
result.advancedStyleParams.conic.x = -options.width / 2;
|
|
4701
|
-
result.advancedStyleParams.conic.y = -result.textLine.data.length * options.lineHeight / 2;
|
|
4707
|
+
result.advancedStyleParams.conic.y = (-result.textLine.data.length * options.lineHeight) / 2;
|
|
4702
4708
|
break;
|
|
4703
4709
|
case 'left':
|
|
4704
4710
|
translateX = 0;
|
|
@@ -4740,12 +4746,13 @@ var WatermarkPlus = (function (exports) {
|
|
|
4740
4746
|
if (['text', 'multi-line-text'].includes(options.contentType)) {
|
|
4741
4747
|
switch (options.textBaseline) {
|
|
4742
4748
|
case 'middle':
|
|
4743
|
-
result.textLine.yOffsetValue = (result.textLine.data.length - 1) * options.lineHeight / 2;
|
|
4749
|
+
result.textLine.yOffsetValue = ((result.textLine.data.length - 1) * options.lineHeight) / 2;
|
|
4744
4750
|
break;
|
|
4745
4751
|
case 'bottom':
|
|
4746
4752
|
case 'alphabetic':
|
|
4747
4753
|
case 'ideographic':
|
|
4748
|
-
result.textLine.yOffsetValue =
|
|
4754
|
+
result.textLine.yOffsetValue =
|
|
4755
|
+
(result.textLine.data.length - 1) * options.lineHeight + (options.lineHeight - parseInt(options.fontSize)) / 2;
|
|
4749
4756
|
break;
|
|
4750
4757
|
case 'top':
|
|
4751
4758
|
case 'hanging':
|
|
@@ -4763,11 +4770,11 @@ var WatermarkPlus = (function (exports) {
|
|
|
4763
4770
|
if (need) {
|
|
4764
4771
|
Object.defineProperty(window, 'MutationObserver', {
|
|
4765
4772
|
writable: false,
|
|
4766
|
-
configurable: false
|
|
4773
|
+
configurable: false,
|
|
4767
4774
|
});
|
|
4768
4775
|
Object.defineProperty(window, 'requestAnimationFrame', {
|
|
4769
4776
|
writable: false,
|
|
4770
|
-
configurable: false
|
|
4777
|
+
configurable: false,
|
|
4771
4778
|
});
|
|
4772
4779
|
}
|
|
4773
4780
|
});
|
|
@@ -4896,7 +4903,7 @@ var WatermarkPlus = (function (exports) {
|
|
|
4896
4903
|
};
|
|
4897
4904
|
WatermarkCanvas.prototype.createLinearGradient = function (ctx) {
|
|
4898
4905
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
4899
|
-
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));
|
|
4906
|
+
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));
|
|
4900
4907
|
(_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) {
|
|
4901
4908
|
gradient.addColorStop(item.offset, item.color);
|
|
4902
4909
|
});
|
|
@@ -4904,7 +4911,7 @@ var WatermarkPlus = (function (exports) {
|
|
|
4904
4911
|
};
|
|
4905
4912
|
WatermarkCanvas.prototype.createConicGradient = function (ctx) {
|
|
4906
4913
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
4907
|
-
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));
|
|
4914
|
+
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)));
|
|
4908
4915
|
(_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) {
|
|
4909
4916
|
gradient.addColorStop(item.offset, item.color);
|
|
4910
4917
|
});
|
|
@@ -4912,7 +4919,7 @@ var WatermarkPlus = (function (exports) {
|
|
|
4912
4919
|
};
|
|
4913
4920
|
WatermarkCanvas.prototype.createRadialGradient = function (ctx) {
|
|
4914
4921
|
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;
|
|
4915
|
-
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));
|
|
4922
|
+
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)));
|
|
4916
4923
|
(_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) {
|
|
4917
4924
|
gradient.addColorStop(item.offset, item.color);
|
|
4918
4925
|
});
|
|
@@ -4920,7 +4927,7 @@ var WatermarkPlus = (function (exports) {
|
|
|
4920
4927
|
};
|
|
4921
4928
|
WatermarkCanvas.prototype.createPattern = function (ctx) {
|
|
4922
4929
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4923
|
-
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) || '');
|
|
4930
|
+
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) || '');
|
|
4924
4931
|
};
|
|
4925
4932
|
WatermarkCanvas.prototype.setText = function (ctx, params) {
|
|
4926
4933
|
var methodName = 'fillText';
|
|
@@ -4934,7 +4941,7 @@ var WatermarkPlus = (function (exports) {
|
|
|
4934
4941
|
text: this.options.content,
|
|
4935
4942
|
x: 0,
|
|
4936
4943
|
y: 0 - this.recommendOptions.textLine.yOffsetValue,
|
|
4937
|
-
maxWidth: this.options.textRowMaxWidth || this.options.width
|
|
4944
|
+
maxWidth: this.options.textRowMaxWidth || this.options.width,
|
|
4938
4945
|
});
|
|
4939
4946
|
resolve(ctx.canvas);
|
|
4940
4947
|
};
|
|
@@ -4968,7 +4975,12 @@ var WatermarkPlus = (function (exports) {
|
|
|
4968
4975
|
var lines = this.recommendOptions.textLine.data;
|
|
4969
4976
|
var yOffsetValue = this.recommendOptions.textLine.yOffsetValue;
|
|
4970
4977
|
lines.forEach(function (text, index) {
|
|
4971
|
-
_this.setText(ctx, {
|
|
4978
|
+
_this.setText(ctx, {
|
|
4979
|
+
text: text,
|
|
4980
|
+
x: 0,
|
|
4981
|
+
y: _this.options.lineHeight * index - yOffsetValue,
|
|
4982
|
+
maxWidth: _this.options.textRowMaxWidth || _this.options.width,
|
|
4983
|
+
});
|
|
4972
4984
|
});
|
|
4973
4985
|
resolve(ctx.canvas);
|
|
4974
4986
|
};
|
|
@@ -4995,10 +5007,10 @@ var WatermarkPlus = (function (exports) {
|
|
|
4995
5007
|
var rect = { width: this.options.imageWidth || 0, height: this.options.imageHeight || 0 };
|
|
4996
5008
|
switch (true) {
|
|
4997
5009
|
case rect.width !== 0 && rect.height === 0:
|
|
4998
|
-
rect.height = rect.width * image.height / image.width;
|
|
5010
|
+
rect.height = (rect.width * image.height) / image.width;
|
|
4999
5011
|
break;
|
|
5000
5012
|
case rect.width === 0 && rect.height !== 0:
|
|
5001
|
-
rect.width = rect.height * image.width / image.height;
|
|
5013
|
+
rect.width = (rect.height * image.width) / image.height;
|
|
5002
5014
|
break;
|
|
5003
5015
|
case rect.width === 0 && rect.height === 0:
|
|
5004
5016
|
rect.width = image.width;
|
|
@@ -5011,7 +5023,7 @@ var WatermarkPlus = (function (exports) {
|
|
|
5011
5023
|
var _a, _b;
|
|
5012
5024
|
var result = {
|
|
5013
5025
|
x: -imageWidth / 2,
|
|
5014
|
-
y: -imageHeight / 2
|
|
5026
|
+
y: -imageHeight / 2,
|
|
5015
5027
|
};
|
|
5016
5028
|
switch (this.options.translatePlacement) {
|
|
5017
5029
|
case 'top':
|
|
@@ -5068,7 +5080,7 @@ var WatermarkPlus = (function (exports) {
|
|
|
5068
5080
|
}
|
|
5069
5081
|
GridLayout.prototype.draw = function () {
|
|
5070
5082
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
5071
|
-
var layoutCanvas = WatermarkCanvas.createCanvas(((_a = this.options.gridLayoutOptions) === null || _a === void 0 ? void 0 : _a.width) ||
|
|
5083
|
+
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);
|
|
5072
5084
|
var layoutContext = layoutCanvas.getContext('2d');
|
|
5073
5085
|
if ((_c = this.options.gridLayoutOptions) === null || _c === void 0 ? void 0 : _c.backgroundImage) {
|
|
5074
5086
|
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);
|
|
@@ -5097,21 +5109,14 @@ var WatermarkPlus = (function (exports) {
|
|
|
5097
5109
|
var generateBackgroundSize = function (options) {
|
|
5098
5110
|
var _a, _b, _c;
|
|
5099
5111
|
switch (options.layout) {
|
|
5100
|
-
case 'grid':
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
options.width * cols + gap[0] * cols,
|
|
5107
|
-
options.height * rows + gap[1] * rows
|
|
5108
|
-
];
|
|
5109
|
-
}
|
|
5112
|
+
case 'grid': {
|
|
5113
|
+
var cols = ((_a = options.gridLayoutOptions) === null || _a === void 0 ? void 0 : _a.cols) || 1;
|
|
5114
|
+
var rows = ((_b = options.gridLayoutOptions) === null || _b === void 0 ? void 0 : _b.rows) || 1;
|
|
5115
|
+
var gap = ((_c = options.gridLayoutOptions) === null || _c === void 0 ? void 0 : _c.gap) || [0, 0];
|
|
5116
|
+
return [options.width * cols + gap[0] * cols, options.height * rows + gap[1] * rows];
|
|
5117
|
+
}
|
|
5110
5118
|
default:
|
|
5111
|
-
return [
|
|
5112
|
-
options.width,
|
|
5113
|
-
options.height
|
|
5114
|
-
];
|
|
5119
|
+
return [options.width, options.height];
|
|
5115
5120
|
}
|
|
5116
5121
|
};
|
|
5117
5122
|
|
|
@@ -5196,14 +5201,14 @@ var WatermarkPlus = (function (exports) {
|
|
|
5196
5201
|
parentElementType = this.checkParentElementType();
|
|
5197
5202
|
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 ");
|
|
5198
5203
|
backgroundSize = generateBackgroundSize(this.options);
|
|
5199
|
-
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 ? 'animation: 200s
|
|
5204
|
+
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 ? 'animation: 200s linear 0s infinite alternate watermark !important;' : '', "\n ");
|
|
5200
5205
|
this.watermarkDom.appendChild(watermarkInnerDom);
|
|
5201
5206
|
this.parentElement.appendChild(this.watermarkDom);
|
|
5202
5207
|
if (this.options.mutationObserve) {
|
|
5203
5208
|
try {
|
|
5204
5209
|
this.bindMutationObserve();
|
|
5205
5210
|
}
|
|
5206
|
-
catch (
|
|
5211
|
+
catch (_j) {
|
|
5207
5212
|
(_e = (_d = this.options).onObserveError) === null || _e === void 0 ? void 0 : _e.call(_d);
|
|
5208
5213
|
}
|
|
5209
5214
|
}
|
|
@@ -5335,7 +5340,7 @@ var WatermarkPlus = (function (exports) {
|
|
|
5335
5340
|
attributes: true, // 属性的变动
|
|
5336
5341
|
childList: true, // 子节点的变动(指新增,删除或者更改)
|
|
5337
5342
|
subtree: true, // 布尔值,表示是否将该观察器应用于该节点的所有后代节点。
|
|
5338
|
-
characterData: true // 节点内容或节点文本的变动。
|
|
5343
|
+
characterData: true, // 节点内容或节点文本的变动。
|
|
5339
5344
|
});
|
|
5340
5345
|
this.parentObserve = new MutationObserver(function (mutationsList) { return __awaiter(_this, void 0, void 0, function () {
|
|
5341
5346
|
var _i, mutationsList_1, item;
|
|
@@ -5350,7 +5355,9 @@ var WatermarkPlus = (function (exports) {
|
|
|
5350
5355
|
item = mutationsList_1[_i];
|
|
5351
5356
|
if (!((item === null || item === void 0 ? void 0 : item.target) === this.watermarkDom ||
|
|
5352
5357
|
((_a = item === null || item === void 0 ? void 0 : item.removedNodes) === null || _a === void 0 ? void 0 : _a[0]) === this.watermarkDom ||
|
|
5353
|
-
(item.type === 'childList' &&
|
|
5358
|
+
(item.type === 'childList' &&
|
|
5359
|
+
item.target === this.parentElement &&
|
|
5360
|
+
item.target.lastChild !== this.watermarkDom))) return [3 /*break*/, 3];
|
|
5354
5361
|
this.remove();
|
|
5355
5362
|
return [4 /*yield*/, this.create()];
|
|
5356
5363
|
case 2:
|
|
@@ -5367,7 +5374,7 @@ var WatermarkPlus = (function (exports) {
|
|
|
5367
5374
|
attributes: true, // 属性的变动
|
|
5368
5375
|
childList: true, // 子节点的变动(指新增,删除或者更改)
|
|
5369
5376
|
subtree: true, // 布尔值,表示是否将该观察器应用于该节点的所有后代节点。
|
|
5370
|
-
characterData: true // 节点内容或节点文本的变动。
|
|
5377
|
+
characterData: true, // 节点内容或节点文本的变动。
|
|
5371
5378
|
});
|
|
5372
5379
|
};
|
|
5373
5380
|
Watermark.prototype.bindCheckWatermarkElementEvent = function () {
|
|
@@ -5395,7 +5402,7 @@ var WatermarkPlus = (function (exports) {
|
|
|
5395
5402
|
if (props === void 0) { props = {}; }
|
|
5396
5403
|
var defaultProps = {
|
|
5397
5404
|
globalAlpha: 0.005,
|
|
5398
|
-
mode: 'blind'
|
|
5405
|
+
mode: 'blind',
|
|
5399
5406
|
};
|
|
5400
5407
|
return _super.call(this, __assign(__assign({}, props), defaultProps)) || this;
|
|
5401
5408
|
}
|
|
@@ -5467,12 +5474,15 @@ var WatermarkPlus = (function (exports) {
|
|
|
5467
5474
|
*/
|
|
5468
5475
|
function ImageWatermark(args) {
|
|
5469
5476
|
if (args === void 0) { args = {}; }
|
|
5470
|
-
var _a;
|
|
5477
|
+
var _a, _b;
|
|
5471
5478
|
this.drew = false;
|
|
5472
5479
|
this.props = args;
|
|
5473
5480
|
this.options = __assign(__assign({}, initialOptions), args);
|
|
5481
|
+
if (this.props.crossOrigin) {
|
|
5482
|
+
(_a = this.props.dom) === null || _a === void 0 ? void 0 : _a.setAttribute('crossOrigin', 'anonymous');
|
|
5483
|
+
}
|
|
5474
5484
|
this.watermarkCanvas = new WatermarkCanvas(this.props, this.options);
|
|
5475
|
-
this.originalSrc = (
|
|
5485
|
+
this.originalSrc = (_b = this.props.dom) === null || _b === void 0 ? void 0 : _b.src;
|
|
5476
5486
|
this.backgroundImage = this.getBackgroundImage();
|
|
5477
5487
|
}
|
|
5478
5488
|
ImageWatermark.prototype.create = function () {
|