@tsparticles/plugin-polygon-mask 4.0.0-beta.0 → 4.0.0-beta.1
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/423.min.js +1 -0
- package/{319.min.js → 832.min.js} +2 -2
- package/browser/Options/Classes/PolygonMask.js +2 -2
- package/browser/Options/Classes/PolygonMaskDraw.js +2 -2
- package/browser/Options/Classes/PolygonMaskDrawStroke.js +4 -4
- package/browser/PolygonMaskInstance.js +6 -8
- package/browser/PolygonMaskPlugin.js +5 -5
- package/browser/index.js +3 -3
- package/browser/utils.js +4 -4
- package/cjs/Options/Classes/PolygonMask.js +2 -2
- package/cjs/Options/Classes/PolygonMaskDraw.js +2 -2
- package/cjs/Options/Classes/PolygonMaskDrawStroke.js +4 -4
- package/cjs/PolygonMaskInstance.js +6 -8
- package/cjs/PolygonMaskPlugin.js +5 -5
- package/cjs/index.js +3 -3
- package/cjs/utils.js +4 -4
- package/dist_browser_PolygonMaskInstance_js.js +3 -3
- package/dist_browser_PolygonMaskPlugin_js.js +5 -5
- package/esm/Options/Classes/PolygonMask.js +2 -2
- package/esm/Options/Classes/PolygonMaskDraw.js +2 -2
- package/esm/Options/Classes/PolygonMaskDrawStroke.js +4 -4
- package/esm/PolygonMaskInstance.js +6 -8
- package/esm/PolygonMaskPlugin.js +5 -5
- package/esm/index.js +3 -3
- package/esm/utils.js +4 -4
- package/package.json +2 -2
- package/report.html +84 -29
- package/tsparticles.plugin.polygon-mask.js +2 -2
- package/tsparticles.plugin.polygon-mask.min.js +2 -2
- package/types/Options/Classes/PolygonMask.d.ts +2 -2
- package/types/Options/Classes/PolygonMaskDraw.d.ts +2 -2
- package/types/Options/Classes/PolygonMaskDrawStroke.d.ts +3 -3
- package/types/PolygonMaskInstance.d.ts +4 -4
- package/types/PolygonMaskPlugin.d.ts +3 -3
- package/types/utils.d.ts +3 -3
- package/umd/Options/Classes/PolygonMask.js +2 -2
- package/umd/Options/Classes/PolygonMaskDraw.js +2 -2
- package/umd/Options/Classes/PolygonMaskDrawStroke.js +4 -4
- package/umd/PolygonMaskInstance.js +6 -8
- package/umd/PolygonMaskPlugin.js +5 -5
- package/umd/index.js +3 -3
- package/umd/utils.js +4 -4
- package/99.min.js +0 -1
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Demo / Generator : https://particles.js.org/
|
|
5
5
|
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
6
|
* How to use? : Check the GitHub README
|
|
7
|
-
* v4.0.0-beta.
|
|
7
|
+
* v4.0.0-beta.1
|
|
8
8
|
*/
|
|
9
9
|
/*
|
|
10
10
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
@@ -74,7 +74,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
74
74
|
\*******************************/
|
|
75
75
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
76
76
|
|
|
77
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PolygonMaskInlineArrangement: () => (/* reexport safe */ _Enums_PolygonMaskInlineArrangement_js__WEBPACK_IMPORTED_MODULE_0__.PolygonMaskInlineArrangement),\n/* harmony export */ PolygonMaskMoveType: () => (/* reexport safe */ _Enums_PolygonMaskMoveType_js__WEBPACK_IMPORTED_MODULE_1__.PolygonMaskMoveType),\n/* harmony export */ PolygonMaskType: () => (/* reexport safe */ _Enums_PolygonMaskType_js__WEBPACK_IMPORTED_MODULE_2__.PolygonMaskType),\n/* harmony export */ loadPolygonMaskPlugin: () => (/* binding */ loadPolygonMaskPlugin)\n/* harmony export */ });\n/* harmony import */ var _Enums_PolygonMaskInlineArrangement_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Enums/PolygonMaskInlineArrangement.js */ \"./dist/browser/Enums/PolygonMaskInlineArrangement.js\");\n/* harmony import */ var _Enums_PolygonMaskMoveType_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Enums/PolygonMaskMoveType.js */ \"./dist/browser/Enums/PolygonMaskMoveType.js\");\n/* harmony import */ var _Enums_PolygonMaskType_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Enums/PolygonMaskType.js */ \"./dist/browser/Enums/PolygonMaskType.js\");\nasync function loadPolygonMaskPlugin(engine) {\n engine.checkVersion(\"4.0.0-beta.
|
|
77
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PolygonMaskInlineArrangement: () => (/* reexport safe */ _Enums_PolygonMaskInlineArrangement_js__WEBPACK_IMPORTED_MODULE_0__.PolygonMaskInlineArrangement),\n/* harmony export */ PolygonMaskMoveType: () => (/* reexport safe */ _Enums_PolygonMaskMoveType_js__WEBPACK_IMPORTED_MODULE_1__.PolygonMaskMoveType),\n/* harmony export */ PolygonMaskType: () => (/* reexport safe */ _Enums_PolygonMaskType_js__WEBPACK_IMPORTED_MODULE_2__.PolygonMaskType),\n/* harmony export */ loadPolygonMaskPlugin: () => (/* binding */ loadPolygonMaskPlugin)\n/* harmony export */ });\n/* harmony import */ var _Enums_PolygonMaskInlineArrangement_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Enums/PolygonMaskInlineArrangement.js */ \"./dist/browser/Enums/PolygonMaskInlineArrangement.js\");\n/* harmony import */ var _Enums_PolygonMaskMoveType_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Enums/PolygonMaskMoveType.js */ \"./dist/browser/Enums/PolygonMaskMoveType.js\");\n/* harmony import */ var _Enums_PolygonMaskType_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Enums/PolygonMaskType.js */ \"./dist/browser/Enums/PolygonMaskType.js\");\nasync function loadPolygonMaskPlugin(engine) {\n engine.checkVersion(\"4.0.0-beta.1\");\n await engine.pluginManager.register(async (e)=>{\n const { PolygonMaskPlugin } = await __webpack_require__.e(/*! import() */ \"dist_browser_PolygonMaskPlugin_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./PolygonMaskPlugin.js */ \"./dist/browser/PolygonMaskPlugin.js\"));\n e.pluginManager.addPlugin(new PolygonMaskPlugin(e.pluginManager));\n });\n}\n\n\n\n\n\n//# sourceURL=webpack://@tsparticles/plugin-polygon-mask/./dist/browser/index.js?\n}");
|
|
78
78
|
|
|
79
79
|
/***/ }
|
|
80
80
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var
|
|
2
|
-
(`+
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(this,e=>(()=>{"use strict";var t,r,n,o={303(t){t.exports=e},478(e,t,r){var n,o;r.d(t,{G:()=>n}),(o=n||(n={})).equidistant="equidistant",o.onePerPoint="one-per-point",o.perPoint="per-point",o.randomLength="random-length",o.randomPoint="random-point"},476(e,t,r){var n,o;r.d(t,{O:()=>n}),(o=n||(n={})).path="path",o.radius="radius"},45(e,t,r){var n,o;r.d(t,{T:()=>n}),(o=n||(n={})).inline="inline",o.inside="inside",o.outside="outside",o.none="none"}},i={};function a(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return o[e](r,r.exports,a),r.exports}a.m=o,a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce((t,r)=>(a.f[r](e,t),t),[])),a.u=e=>""+e+".min.js",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s={},a.l=(e,t,r,n)=>{if(s[e])return void s[e].push(t);if(void 0!==r)for(var o,i,p=document.getElementsByTagName("script"),l=0;l<p.length;l++){var u=p[l];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")=="@tsparticles/plugin-polygon-mask:"+r){o=u;break}}o||(i=!0,(o=document.createElement("script")).charset="utf-8",a.nc&&o.setAttribute("nonce",a.nc),o.setAttribute("data-webpack","@tsparticles/plugin-polygon-mask:"+r),o.src=e),s[e]=[t];var c=(t,r)=>{o.onerror=o.onload=null,clearTimeout(d);var n=s[e];if(delete s[e],o.parentNode&&o.parentNode.removeChild(o),n&&n.forEach(e=>e(r)),t)return t(r)},d=setTimeout(c.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=c.bind(null,o.onerror),o.onload=c.bind(null,o.onload),i&&document.head.appendChild(o)},a.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.g.importScripts&&(p=a.g.location+"");var s,p,l=a.g.document;if(!p&&l&&(l.currentScript&&"SCRIPT"===l.currentScript.tagName.toUpperCase()&&(p=l.currentScript.src),!p)){var u=l.getElementsByTagName("script");if(u.length)for(var c=u.length-1;c>-1&&(!p||!/^http(s?):/.test(p));)p=u[c--].src}if(!p)throw Error("Automatic publicPath is not supported in this browser");a.p=p=p.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),t={131:0},a.f.j=(e,r)=>{var n=a.o(t,e)?t[e]:void 0;if(0!==n)if(n)r.push(n[2]);else{var o=new Promise((r,o)=>n=t[e]=[r,o]);r.push(n[2]=o);var i=a.p+a.u(e),s=Error();a.l(i,r=>{if(a.o(t,e)&&(0!==(n=t[e])&&(t[e]=void 0),n)){var o=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;s.message="Loading chunk "+e+` failed.
|
|
2
|
+
(`+o+": "+i+")",s.name="ChunkLoadError",s.type=o,s.request=i,n[1](s)}},"chunk-"+e,e)}},r=(e,r)=>{var n,o,[i,s,p]=r,l=0;if(i.some(e=>0!==t[e])){for(n in s)a.o(s,n)&&(a.m[n]=s[n]);p&&p(a)}for(e&&e(r);l<i.length;l++)o=i[l],a.o(t,o)&&t[o]&&t[o][0](),t[o]=0},(n=this.webpackChunk_tsparticles_plugin_polygon_mask=this.webpackChunk_tsparticles_plugin_polygon_mask||[]).forEach(r.bind(null,0)),n.push=r.bind(null,n.push.bind(n));var d={};a.r(d),a.d(d,{PolygonMaskInlineArrangement:()=>g.G,PolygonMaskMoveType:()=>f.O,PolygonMaskType:()=>m.T,loadPolygonMaskPlugin:()=>h});var g=a(478),f=a(476),m=a(45);async function h(e){e.checkVersion("4.0.0-beta.1"),await e.pluginManager.register(async e=>{let{PolygonMaskPlugin:t}=await a.e(423).then(a.bind(a,423));e.pluginManager.addPlugin(new t(e.pluginManager))})}return d})());
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ICoordinates, type IOptionLoader, type PluginManager, type RecursivePartial } from "@tsparticles/engine";
|
|
2
2
|
import type { IPolygonMask } from "../Interfaces/IPolygonMask.js";
|
|
3
3
|
import { PolygonMaskDraw } from "./PolygonMaskDraw.js";
|
|
4
4
|
import { PolygonMaskInline } from "./PolygonMaskInline.js";
|
|
@@ -15,6 +15,6 @@ export declare class PolygonMask implements IPolygonMask, IOptionLoader<IPolygon
|
|
|
15
15
|
scale: number;
|
|
16
16
|
type: PolygonMaskType;
|
|
17
17
|
url?: string;
|
|
18
|
-
constructor(
|
|
18
|
+
constructor(pluginManager: PluginManager);
|
|
19
19
|
load(data?: RecursivePartial<IPolygonMask>): void;
|
|
20
20
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type IOptionLoader, type PluginManager, type RecursivePartial } from "@tsparticles/engine";
|
|
2
2
|
import type { IPolygonMaskDraw } from "../Interfaces/IPolygonMaskDraw.js";
|
|
3
3
|
import { PolygonMaskDrawStroke } from "./PolygonMaskDrawStroke.js";
|
|
4
4
|
export declare class PolygonMaskDraw implements IPolygonMaskDraw, IOptionLoader<IPolygonMaskDraw> {
|
|
5
5
|
enable: boolean;
|
|
6
6
|
stroke: PolygonMaskDrawStroke;
|
|
7
|
-
constructor(
|
|
7
|
+
constructor(pluginManager: PluginManager);
|
|
8
8
|
load(data?: RecursivePartial<IPolygonMaskDraw>): void;
|
|
9
9
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type IOptionLoader, OptionsColor, type PluginManager, type RecursivePartial } from "@tsparticles/engine";
|
|
2
2
|
import type { IPolygonMaskDrawStroke } from "../Interfaces/IPolygonMaskDrawStroke.js";
|
|
3
3
|
export declare class PolygonMaskDrawStroke implements IPolygonMaskDrawStroke, IOptionLoader<IPolygonMaskDrawStroke> {
|
|
4
4
|
color: OptionsColor;
|
|
5
5
|
opacity: number;
|
|
6
6
|
width: number;
|
|
7
|
-
private readonly
|
|
8
|
-
constructor(
|
|
7
|
+
private readonly _pluginManager;
|
|
8
|
+
constructor(pluginManager: PluginManager);
|
|
9
9
|
load(data?: RecursivePartial<IPolygonMaskDrawStroke>): void;
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./pathseg.js";
|
|
2
|
-
import { type
|
|
2
|
+
import { type CanvasContextType, type IContainerPlugin, type ICoordinates, type IDelta, type IDimension, OutModeDirection, type Particle, type PluginManager } from "@tsparticles/engine";
|
|
3
3
|
import type { ISvgPath } from "./Interfaces/ISvgPath.js";
|
|
4
4
|
import type { PolygonMaskContainer } from "./types.js";
|
|
5
5
|
export declare class PolygonMaskInstance implements IContainerPlugin {
|
|
@@ -9,12 +9,12 @@ export declare class PolygonMaskInstance implements IContainerPlugin {
|
|
|
9
9
|
raw?: ICoordinates[];
|
|
10
10
|
redrawTimeout?: number | NodeJS.Timeout;
|
|
11
11
|
private readonly _container;
|
|
12
|
-
private readonly _engine;
|
|
13
12
|
private _moveRadius;
|
|
13
|
+
private readonly _pluginManager;
|
|
14
14
|
private _scale;
|
|
15
|
-
constructor(
|
|
15
|
+
constructor(pluginManager: PluginManager, container: PolygonMaskContainer);
|
|
16
16
|
clickPositionValid(position: ICoordinates): boolean;
|
|
17
|
-
draw(context:
|
|
17
|
+
draw(context: CanvasContextType): void;
|
|
18
18
|
init(): Promise<void>;
|
|
19
19
|
particleBounce(particle: Particle, delta: IDelta, direction: OutModeDirection): boolean;
|
|
20
20
|
particlePosition(position?: ICoordinates): ICoordinates | undefined;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { Container,
|
|
1
|
+
import type { Container, IContainerPlugin, IPlugin, PluginManager, RecursivePartial } from "@tsparticles/engine";
|
|
2
2
|
import type { IPolygonMaskOptions, PolygonMaskOptions } from "./types.js";
|
|
3
3
|
export declare class PolygonMaskPlugin implements IPlugin {
|
|
4
4
|
readonly id = "polygon-mask";
|
|
5
|
-
private readonly
|
|
6
|
-
constructor(
|
|
5
|
+
private readonly _pluginManager;
|
|
6
|
+
constructor(pluginManager: PluginManager);
|
|
7
7
|
getPlugin(container: Container): Promise<IContainerPlugin>;
|
|
8
8
|
loadOptions(_container: Container, options: PolygonMaskOptions, source?: RecursivePartial<IPolygonMaskOptions>): void;
|
|
9
9
|
needsPlugin(options?: RecursivePartial<IPolygonMaskOptions>): boolean;
|
package/types/utils.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type CanvasContextType, type ICoordinates, type PluginManager, Vector } from "@tsparticles/engine";
|
|
2
2
|
import type { IPolygonMaskDrawStroke } from "./Options/Interfaces/IPolygonMaskDrawStroke.js";
|
|
3
3
|
import type { ISvgPath } from "./Interfaces/ISvgPath.js";
|
|
4
|
-
export declare function drawPolygonMask(
|
|
5
|
-
export declare function drawPolygonMaskPath(
|
|
4
|
+
export declare function drawPolygonMask(pluginManager: PluginManager, context: CanvasContextType, rawData: ICoordinates[], stroke: IPolygonMaskDrawStroke, hdr?: boolean): void;
|
|
5
|
+
export declare function drawPolygonMaskPath(pluginManager: PluginManager, context: CanvasContextType, path: Path2D, stroke: IPolygonMaskDrawStroke, position: ICoordinates, hdr?: boolean): void;
|
|
6
6
|
export declare function parsePaths(paths: ISvgPath[], scale: number, offset: ICoordinates): ICoordinates[];
|
|
7
7
|
export declare function calcClosestPointOnSegment(s1: ICoordinates, s2: ICoordinates, pos: ICoordinates): ICoordinates & {
|
|
8
8
|
isOnSegment: boolean;
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
scale;
|
|
27
27
|
type;
|
|
28
28
|
url;
|
|
29
|
-
constructor(
|
|
30
|
-
this.draw = new PolygonMaskDraw_js_1.PolygonMaskDraw(
|
|
29
|
+
constructor(pluginManager) {
|
|
30
|
+
this.draw = new PolygonMaskDraw_js_1.PolygonMaskDraw(pluginManager);
|
|
31
31
|
this.enable = false;
|
|
32
32
|
this.inline = new PolygonMaskInline_js_1.PolygonMaskInline();
|
|
33
33
|
this.move = new PolygonMaskMove_js_1.PolygonMaskMove();
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
class PolygonMaskDraw {
|
|
16
16
|
enable;
|
|
17
17
|
stroke;
|
|
18
|
-
constructor(
|
|
18
|
+
constructor(pluginManager) {
|
|
19
19
|
this.enable = false;
|
|
20
|
-
this.stroke = new PolygonMaskDrawStroke_js_1.PolygonMaskDrawStroke(
|
|
20
|
+
this.stroke = new PolygonMaskDrawStroke_js_1.PolygonMaskDrawStroke(pluginManager);
|
|
21
21
|
}
|
|
22
22
|
load(data) {
|
|
23
23
|
if ((0, engine_1.isNull)(data)) {
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
color;
|
|
16
16
|
opacity;
|
|
17
17
|
width;
|
|
18
|
-
|
|
19
|
-
constructor(
|
|
20
|
-
this.
|
|
18
|
+
_pluginManager;
|
|
19
|
+
constructor(pluginManager) {
|
|
20
|
+
this._pluginManager = pluginManager;
|
|
21
21
|
this.color = new engine_1.OptionsColor();
|
|
22
22
|
this.width = 0.5;
|
|
23
23
|
this.opacity = 1;
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
}
|
|
29
29
|
this.color = engine_1.OptionsColor.create(this.color, data.color);
|
|
30
30
|
if ((0, engine_1.isString)(this.color.value)) {
|
|
31
|
-
this.opacity = (0, engine_1.stringToAlpha)(this.
|
|
31
|
+
this.opacity = (0, engine_1.stringToAlpha)(this._pluginManager, this.color.value) ?? this.opacity;
|
|
32
32
|
}
|
|
33
33
|
if (data.opacity !== undefined) {
|
|
34
34
|
this.opacity = data.opacity;
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
raw;
|
|
24
24
|
redrawTimeout;
|
|
25
25
|
_container;
|
|
26
|
-
_engine;
|
|
27
26
|
_moveRadius;
|
|
27
|
+
_pluginManager;
|
|
28
28
|
_scale;
|
|
29
|
-
constructor(
|
|
29
|
+
constructor(pluginManager, container) {
|
|
30
30
|
this._container = container;
|
|
31
|
-
this.
|
|
31
|
+
this._pluginManager = pluginManager;
|
|
32
32
|
this.dimension = {
|
|
33
33
|
height: 0,
|
|
34
34
|
width: 0,
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
for (const path of this.paths) {
|
|
60
60
|
const path2d = path.path2d;
|
|
61
61
|
if (path2d && this.offset) {
|
|
62
|
-
(0, utils_js_1.drawPolygonMaskPath)(this.
|
|
62
|
+
(0, utils_js_1.drawPolygonMaskPath)(this._pluginManager, context, path2d, polygonDraw.stroke, this.offset, this._container.hdr);
|
|
63
63
|
}
|
|
64
64
|
else if (rawData) {
|
|
65
|
-
(0, utils_js_1.drawPolygonMask)(this.
|
|
65
|
+
(0, utils_js_1.drawPolygonMask)(this._pluginManager, context, rawData, polygonDraw.stroke, this._container.hdr);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -294,9 +294,7 @@
|
|
|
294
294
|
this.raw = this._parseSvgPath(svg, force);
|
|
295
295
|
}
|
|
296
296
|
this._createPath2D();
|
|
297
|
-
this.
|
|
298
|
-
container: this._container,
|
|
299
|
-
});
|
|
297
|
+
this._container.dispatchEvent("polygonMaskLoaded");
|
|
300
298
|
};
|
|
301
299
|
_parseSvgPath = (xml, force) => {
|
|
302
300
|
const forceDownload = force ?? false;
|
package/umd/PolygonMaskPlugin.js
CHANGED
|
@@ -48,13 +48,13 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
48
48
|
const PolygonMaskType_js_1 = require("./Enums/PolygonMaskType.js");
|
|
49
49
|
class PolygonMaskPlugin {
|
|
50
50
|
id = "polygon-mask";
|
|
51
|
-
|
|
52
|
-
constructor(
|
|
53
|
-
this.
|
|
51
|
+
_pluginManager;
|
|
52
|
+
constructor(pluginManager) {
|
|
53
|
+
this._pluginManager = pluginManager;
|
|
54
54
|
}
|
|
55
55
|
async getPlugin(container) {
|
|
56
56
|
const { PolygonMaskInstance } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./PolygonMaskInstance.js"))) : new Promise((resolve_1, reject_1) => { require(["./PolygonMaskInstance.js"], resolve_1, reject_1); }).then(__importStar));
|
|
57
|
-
return new PolygonMaskInstance(
|
|
57
|
+
return new PolygonMaskInstance(this._pluginManager, container);
|
|
58
58
|
}
|
|
59
59
|
loadOptions(_container, options, source) {
|
|
60
60
|
if (!this.needsPlugin(options) && !this.needsPlugin(source)) {
|
|
@@ -62,7 +62,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
62
62
|
}
|
|
63
63
|
let polygonOptions = options.polygon;
|
|
64
64
|
if (polygonOptions?.load === undefined) {
|
|
65
|
-
options.polygon = polygonOptions = new PolygonMask_js_1.PolygonMask(this.
|
|
65
|
+
options.polygon = polygonOptions = new PolygonMask_js_1.PolygonMask(this._pluginManager);
|
|
66
66
|
}
|
|
67
67
|
polygonOptions.load(source?.polygon);
|
|
68
68
|
}
|
package/umd/index.js
CHANGED
|
@@ -48,10 +48,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
48
48
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
49
|
exports.loadPolygonMaskPlugin = loadPolygonMaskPlugin;
|
|
50
50
|
async function loadPolygonMaskPlugin(engine) {
|
|
51
|
-
engine.checkVersion("4.0.0-beta.
|
|
52
|
-
await engine.register(async (e) => {
|
|
51
|
+
engine.checkVersion("4.0.0-beta.1");
|
|
52
|
+
await engine.pluginManager.register(async (e) => {
|
|
53
53
|
const { PolygonMaskPlugin } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./PolygonMaskPlugin.js"))) : new Promise((resolve_1, reject_1) => { require(["./PolygonMaskPlugin.js"], resolve_1, reject_1); }).then(__importStar));
|
|
54
|
-
e.addPlugin(new PolygonMaskPlugin(
|
|
54
|
+
e.pluginManager.addPlugin(new PolygonMaskPlugin(e.pluginManager));
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
__exportStar(require("./Enums/PolygonMaskInlineArrangement.js"), exports);
|
package/umd/utils.js
CHANGED
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
min: 0,
|
|
20
20
|
max: 1,
|
|
21
21
|
};
|
|
22
|
-
function drawPolygonMask(
|
|
23
|
-
const color = (0, engine_1.rangeColorToRgb)(
|
|
22
|
+
function drawPolygonMask(pluginManager, context, rawData, stroke, hdr = false) {
|
|
23
|
+
const color = (0, engine_1.rangeColorToRgb)(pluginManager, stroke.color);
|
|
24
24
|
if (!color) {
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
context.lineWidth = stroke.width;
|
|
39
39
|
context.stroke();
|
|
40
40
|
}
|
|
41
|
-
function drawPolygonMaskPath(
|
|
41
|
+
function drawPolygonMaskPath(pluginManager, context, path, stroke, position, hdr = false) {
|
|
42
42
|
const defaultTransform = {
|
|
43
43
|
a: 1,
|
|
44
44
|
b: 0,
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
d: 1,
|
|
47
47
|
};
|
|
48
48
|
context.setTransform(defaultTransform.a, defaultTransform.b, defaultTransform.c, defaultTransform.d, position.x, position.y);
|
|
49
|
-
const color = (0, engine_1.rangeColorToRgb)(
|
|
49
|
+
const color = (0, engine_1.rangeColorToRgb)(pluginManager, stroke.color);
|
|
50
50
|
if (!color) {
|
|
51
51
|
return;
|
|
52
52
|
}
|
package/99.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_tsparticles_plugin_polygon_mask=this.webpackChunk_tsparticles_plugin_polygon_mask||[]).push([[99],{99(i,t,e){e.d(t,{PolygonMaskPlugin:()=>u});var s=e(303);class o{color;opacity;width;_engine;constructor(i){this._engine=i,this.color=new s.OptionsColor,this.width=.5,this.opacity=1}load(i){(0,s.isNull)(i)||(this.color=s.OptionsColor.create(this.color,i.color),(0,s.isString)(this.color.value)&&(this.opacity=(0,s.stringToAlpha)(this._engine,this.color.value)??this.opacity),void 0!==i.opacity&&(this.opacity=i.opacity),void 0!==i.width&&(this.width=i.width))}}class n{enable;stroke;constructor(i){this.enable=!1,this.stroke=new o(i)}load(i){if((0,s.isNull)(i))return;void 0!==i.enable&&(this.enable=i.enable);let t=i.stroke;this.stroke.load(t)}}var a=e(666);class l{arrangement;constructor(){this.arrangement=a.G.onePerPoint}load(i){(0,s.isNull)(i)||void 0!==i.arrangement&&(this.arrangement=i.arrangement)}}class h{path;size;constructor(){this.path=[],this.size={height:0,width:0}}load(i){(0,s.isNull)(i)||(void 0!==i.path&&(this.path=i.path),void 0!==i.size&&(void 0!==i.size.width&&(this.size.width=i.size.width),void 0!==i.size.height&&(this.size.height=i.size.height)))}}var r=e(248);class d{radius;type;constructor(){this.radius=10,this.type=r.O.path}load(i){(0,s.isNull)(i)||(void 0!==i.radius&&(this.radius=i.radius),void 0!==i.type&&(this.type=i.type))}}var p=e(361);class c{data;draw;enable;inline;move;position;scale;type;url;constructor(i){this.draw=new n(i),this.enable=!1,this.inline=new l,this.move=new d,this.scale=1,this.type=p.T.none}load(i){(0,s.isNull)(i)||(this.draw.load(i.draw),this.inline.load(i.inline),this.move.load(i.move),void 0!==i.scale&&(this.scale=i.scale),void 0!==i.type&&(this.type=i.type),void 0!==i.enable?this.enable=i.enable:this.enable=this.type!==p.T.none,void 0!==i.url&&(this.url=i.url),void 0!==i.data&&((0,s.isString)(i.data)?this.data=i.data:(this.data=new h,this.data.load(i.data))),void 0!==i.position&&(this.position=(0,s.deepExtend)({},i.position)))}}class u{id="polygon-mask";_engine;constructor(i){this._engine=i}async getPlugin(i){let{PolygonMaskInstance:t}=await e.e(319).then(e.bind(e,319));return new t(i,this._engine)}loadOptions(i,t,e){if(!this.needsPlugin(t)&&!this.needsPlugin(e))return;let s=t.polygon;s?.load===void 0&&(t.polygon=s=new c(this._engine)),s.load(e?.polygon)}needsPlugin(i){return i?.polygon?.enable??(i?.polygon?.type!==void 0&&i.polygon.type!==p.T.none)}}}}]);
|