@tsparticles/plugin-polygon-mask 3.0.0-alpha.1 → 3.0.0-beta.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/README.md +15 -11
- package/browser/Options/Classes/PolygonMask.js +2 -8
- package/browser/Options/Classes/PolygonMaskDraw.js +1 -18
- package/browser/Options/Classes/PolygonMaskDrawStroke.js +3 -4
- package/browser/PolygonMaskInstance.js +297 -305
- package/browser/index.js +7 -8
- package/browser/pathseg.js +1 -1
- package/browser/utils.js +3 -5
- package/cjs/Options/Classes/PolygonMask.js +2 -8
- package/cjs/Options/Classes/PolygonMaskDraw.js +1 -18
- package/cjs/Options/Classes/PolygonMaskDrawStroke.js +2 -3
- package/cjs/PolygonMaskInstance.js +309 -332
- package/cjs/index.js +7 -19
- package/cjs/pathseg.js +1 -1
- package/cjs/utils.js +4 -6
- package/esm/Options/Classes/PolygonMask.js +2 -8
- package/esm/Options/Classes/PolygonMaskDraw.js +1 -18
- package/esm/Options/Classes/PolygonMaskDrawStroke.js +3 -4
- package/esm/PolygonMaskInstance.js +297 -305
- package/esm/index.js +7 -8
- package/esm/pathseg.js +1 -1
- package/esm/utils.js +3 -5
- package/package.json +8 -5
- package/report.html +4 -4
- package/tsparticles.plugin.polygon-mask.js +336 -362
- package/tsparticles.plugin.polygon-mask.min.js +1 -1
- package/tsparticles.plugin.polygon-mask.min.js.LICENSE.txt +1 -8
- package/types/Options/Classes/PolygonMask.d.ts +1 -4
- package/types/Options/Classes/PolygonMaskDraw.d.ts +1 -6
- package/types/Options/Classes/PolygonMaskDrawStroke.d.ts +1 -2
- package/types/Options/Interfaces/IPolygonMaskDraw.d.ts +0 -3
- package/types/PolygonMaskInstance.d.ts +13 -15
- package/types/index.d.ts +1 -1
- package/types/utils.d.ts +1 -2
- package/umd/Options/Classes/PolygonMask.js +3 -9
- package/umd/Options/Classes/PolygonMaskDraw.js +2 -19
- package/umd/Options/Classes/PolygonMaskDrawStroke.js +2 -3
- package/umd/PolygonMaskInstance.js +298 -306
- package/umd/index.js +7 -8
- package/umd/pathseg.js +1 -1
- package/umd/utils.js +3 -5
package/umd/index.js
CHANGED
|
@@ -36,23 +36,22 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
36
36
|
return new PolygonMaskInstance_1.PolygonMaskInstance(container, this._engine);
|
|
37
37
|
}
|
|
38
38
|
loadOptions(options, source) {
|
|
39
|
-
if (!this.needsPlugin(source)) {
|
|
39
|
+
if (!this.needsPlugin(options) && !this.needsPlugin(source)) {
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
let polygonOptions = options.polygon;
|
|
43
|
-
if (
|
|
43
|
+
if (polygonOptions?.load === undefined) {
|
|
44
44
|
options.polygon = polygonOptions = new PolygonMask_1.PolygonMask();
|
|
45
45
|
}
|
|
46
|
-
polygonOptions.load(source
|
|
46
|
+
polygonOptions.load(source?.polygon);
|
|
47
47
|
}
|
|
48
48
|
needsPlugin(options) {
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
return (options?.polygon?.enable ??
|
|
50
|
+
(options?.polygon?.type !== undefined && options.polygon.type !== "none"));
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
async function loadPolygonMaskPlugin(engine) {
|
|
54
|
-
|
|
55
|
-
await engine.addPlugin(plugin);
|
|
53
|
+
async function loadPolygonMaskPlugin(engine, refresh = true) {
|
|
54
|
+
await engine.addPlugin(new PolygonMaskPlugin(engine), refresh);
|
|
56
55
|
}
|
|
57
56
|
exports.loadPolygonMaskPlugin = loadPolygonMaskPlugin;
|
|
58
57
|
__exportStar(require("./Enums/PolygonMaskInlineArrangement"), exports);
|
package/umd/pathseg.js
CHANGED
|
@@ -1064,7 +1064,7 @@
|
|
|
1064
1064
|
this._pathElement.setAttribute("d", window.SVGPathSegList._pathSegArrayAsString(this._list));
|
|
1065
1065
|
this._pathElementMutationObserver.observe(this._pathElement, this._mutationObserverConfig);
|
|
1066
1066
|
};
|
|
1067
|
-
window.SVGPathSegList.prototype.segmentChanged = function (
|
|
1067
|
+
window.SVGPathSegList.prototype.segmentChanged = function () {
|
|
1068
1068
|
this._writeListToPath();
|
|
1069
1069
|
};
|
|
1070
1070
|
window.SVGPathSegList.prototype.clear = function () {
|
package/umd/utils.js
CHANGED
|
@@ -40,17 +40,15 @@
|
|
|
40
40
|
}
|
|
41
41
|
exports.drawPolygonMaskPath = drawPolygonMaskPath;
|
|
42
42
|
function parsePaths(paths, scale, offset) {
|
|
43
|
-
var _a;
|
|
44
43
|
const res = [];
|
|
45
44
|
for (const path of paths) {
|
|
46
|
-
const segments = path.element.pathSegList, len =
|
|
45
|
+
const segments = path.element.pathSegList, len = segments?.numberOfItems ?? 0, p = {
|
|
47
46
|
x: 0,
|
|
48
47
|
y: 0,
|
|
49
48
|
};
|
|
50
49
|
for (let i = 0; i < len; i++) {
|
|
51
|
-
const segment = segments
|
|
52
|
-
|
|
53
|
-
switch (segment === null || segment === void 0 ? void 0 : segment.pathSegType) {
|
|
50
|
+
const segment = segments?.getItem(i), svgPathSeg = window.SVGPathSeg;
|
|
51
|
+
switch (segment?.pathSegType) {
|
|
54
52
|
case svgPathSeg.PATHSEG_MOVETO_ABS:
|
|
55
53
|
case svgPathSeg.PATHSEG_LINETO_ABS:
|
|
56
54
|
case svgPathSeg.PATHSEG_CURVETO_CUBIC_ABS:
|