@tsparticles/plugin-poisson-disc 3.9.0 → 3.9.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/browser/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { PoissonDiscPlugin } from "./PoissonDiscPlugin.js";
2
2
  export async function loadPoissonDiscPlugin(engine, refresh = true) {
3
- engine.checkVersion("3.9.0");
3
+ engine.checkVersion("3.9.1");
4
4
  await engine.addPlugin(new PoissonDiscPlugin(engine), refresh);
5
5
  }
package/cjs/index.js CHANGED
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.loadPoissonDiscPlugin = loadPoissonDiscPlugin;
4
4
  const PoissonDiscPlugin_js_1 = require("./PoissonDiscPlugin.js");
5
5
  async function loadPoissonDiscPlugin(engine, refresh = true) {
6
- engine.checkVersion("3.9.0");
6
+ engine.checkVersion("3.9.1");
7
7
  await engine.addPlugin(new PoissonDiscPlugin_js_1.PoissonDiscPlugin(engine), refresh);
8
8
  }
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { PoissonDiscPlugin } from "./PoissonDiscPlugin.js";
2
2
  export async function loadPoissonDiscPlugin(engine, refresh = true) {
3
- engine.checkVersion("3.9.0");
3
+ engine.checkVersion("3.9.1");
4
4
  await engine.addPlugin(new PoissonDiscPlugin(engine), refresh);
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/plugin-poisson-disc",
3
- "version": "3.9.0",
3
+ "version": "3.9.1",
4
4
  "description": "tsParticles poisson disc plugin",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -85,7 +85,7 @@
85
85
  "./package.json": "./package.json"
86
86
  },
87
87
  "dependencies": {
88
- "@tsparticles/engine": "3.9.0"
88
+ "@tsparticles/engine": "3.9.1"
89
89
  },
90
90
  "publishConfig": {
91
91
  "access": "public"
package/report.html CHANGED
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="UTF-8"/>
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
6
- <title>@tsparticles/plugin-poisson-disc [1 Aug 2025 at 08:48]</title>
6
+ <title>@tsparticles/plugin-poisson-disc [3 Aug 2025 at 23:37]</title>
7
7
  <link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABrVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+O1foceMD///+J0/qK1Pr7/v8Xdr/9///W8P4UdL7L7P0Scr2r4Pyj3vwad8D5/f/2/f+55f3E6f34+/2H0/ojfMKpzOd0rNgQcb3F3O/j9f7c8v6g3Pz0/P/w+v/q+P7n9v6T1/uQ1vuE0vqLut/y+v+Z2fvt+f+15Pzv9fuc2/vR7v2V2Pvd6/bg9P7I6/285/2y4/yp3/zp8vk8i8kqgMT7/P31+fyv4vxGkcz6/P6/6P3j7vfS5PNnpNUxhcbO7f7F6v3O4vHK3/DA2u631Ouy0eqXweKJud5wqthfoNMMbLvY8f73+v2dxeR8sNtTmdDx9/zX6PSjyeaCtd1YnNGX2PuQveCGt95Nls42h8dLlM3F4vBtAAAAM3RSTlMAAyOx0/sKBvik8opWGBMOAe3l1snDm2E9LSb06eHcu5JpHbarfHZCN9CBb08zzkdNS0kYaptYAAAFV0lEQVRYw92X51/aYBDHHS2O2qqttVbrqNq9m+TJIAYIShBkWwqIiCgoWvfeq7Z2/s29hyQNyUcR7LveGwVyXy6XH8/9rqxglLfUPLxVduUor3h0rfp2TYvpivk37929TkG037hffoX0+peVtZQc1589rigVUdXS/ABSAyEmGIO/1XfvldSK8vs3OqB6u3m0nxmIrvgB0dj7rr7Y9IbuF68hnfFaiHA/sxqm0wciIG43P60qKv9WXWc1RXGh/mFESFABTSBi0sNAKzqet17eCtOb3kZIDwxEEU0oAIJGYxNBDhBND29e0rtXXbcpuPmED9I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0ecPnDtQYDQvJXaBeNzce45Fp28ZQLrEZVuFqgBwOalArKXnW1UzlnSusQKJqKYNuz4tOnI6sZG4zanpemv+7ySU2jbA9h6uhcgpfy6G2PahirDZ6zvq6zDduMVFTKvzw8wgyEdelwY9in3XkEPs3osJuwRQ4qTkfzifndg9Gfc4pdsu82+tTnHZTBa2EAMrqr2t43pguc8tNm7JQVQ2S0ukj2d22dhXYP0/veWtwKrCkNoNimAN5+Xr/oLrxswKbVJjteWrX7eR63o4j9q0GxnaBdWgGA5VStpanIjQmEhV0/nVt5VOFUvix6awJhPcAaTEShgrG+iGyvb5a0Ndb1YGHFPEwoqAinoaykaID1o1pdPNu7XsnCKQ3R+hwWIIhGvORcJUBYXe3Xa3vq/mF/N9V13ugufMkfXn+KHsRD0B8AAAAASUVORK5CYII=" type="image/x-icon" />
8
8
 
9
9
  <script>
@@ -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
- * v3.9.0
7
+ * v3.9.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_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 */ loadPoissonDiscPlugin: () => (/* binding */ loadPoissonDiscPlugin)\n/* harmony export */ });\n/* harmony import */ var _PoissonDiscPlugin_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./PoissonDiscPlugin.js */ \"./dist/browser/PoissonDiscPlugin.js\");\n\nasync function loadPoissonDiscPlugin(engine, refresh = true) {\n engine.checkVersion(\"3.9.0\");\n await engine.addPlugin(new _PoissonDiscPlugin_js__WEBPACK_IMPORTED_MODULE_0__.PoissonDiscPlugin(engine), refresh);\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-poisson-disc/./dist/browser/index.js?\n}");
77
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadPoissonDiscPlugin: () => (/* binding */ loadPoissonDiscPlugin)\n/* harmony export */ });\n/* harmony import */ var _PoissonDiscPlugin_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./PoissonDiscPlugin.js */ \"./dist/browser/PoissonDiscPlugin.js\");\n\nasync function loadPoissonDiscPlugin(engine, refresh = true) {\n engine.checkVersion(\"3.9.1\");\n await engine.addPlugin(new _PoissonDiscPlugin_js__WEBPACK_IMPORTED_MODULE_0__.PoissonDiscPlugin(engine), refresh);\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-poisson-disc/./dist/browser/index.js?\n}");
78
78
 
79
79
  /***/ }),
80
80
 
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see tsparticles.plugin.poisson.min.js.LICENSE.txt */
2
- !function(i,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 s="object"==typeof exports?t(require("@tsparticles/engine")):t(i.window);for(var e in s)("object"==typeof exports?exports:i)[e]=s[e]}}(this,(i=>(()=>{var t={303:t=>{t.exports=i}},s={};function e(i){var o=s[i];if(void 0!==o)return o.exports;var n=s[i]={exports:{}};return t[i](n,n.exports,e),n.exports}e.d=(i,t)=>{for(var s in t)e.o(t,s)&&!e.o(i,s)&&Object.defineProperty(i,s,{enumerable:!0,get:t[s]})},e.o=(i,t)=>Object.prototype.hasOwnProperty.call(i,t),e.r=i=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})};var o={};e.r(o),e.d(o,{loadPoissonDiscPlugin:()=>d});var n=e(303);class r{constructor(){this.enable=!1,this.dimensions=2,this.radius=0,this.retries=30,this.steps=0}load(i){(0,n.isNull)(i)||(void 0!==i.enable&&(this.enable=i.enable),void 0!==i.dimensions&&(this.dimensions=i.dimensions),void 0!==i.radius&&(this.radius=i.radius),void 0!==i.retries&&(this.retries=i.retries))}}const a=2*Math.PI;class h{constructor(i,t,s,e,o){this.size={...i},this.radius=t,this.retries=s,this.dimensions=e,this.cellSize=Math.floor(this.radius/Math.sqrt(this.dimensions)),this.cols=Math.floor(this.size.width/this.cellSize),this.rows=Math.floor(this.size.height/this.cellSize),this.points=[],this.active=[],this.grid=[],this.firstPoint=o?{...o}:void 0,this.reset()}addPoint(i){const t={position:{...i},gridPosition:{x:Math.floor(i.x/this.cellSize),y:Math.floor(i.y/this.cellSize)}},s=this.points.length;this.points.push(t),this.grid[t.gridPosition.y][t.gridPosition.x]=s,this.active.push(s)}getRandom(i,t){return Math.floor((0,n.getRandom)()*(t-i))+i}initialiseGrid(){for(let i=0;i<=this.rows;i++){this.grid[i]=[];for(let t=0;t<=this.cols;t++)this.grid[i][t]=-1}}reset(){if(this.points=[],this.active=[],this.grid=[],this.initialiseGrid(),this.firstPoint)this.addPoint(this.firstPoint);else{const i=0;this.addPoint({x:this.getRandom(i,this.size.width),y:this.getRandom(i,this.size.height)})}}async run(){this.reset();for(;this.active.length>0;)await this.steps(1)}async steps(i){for(let t=0;t<i;t++)this.active.length<=0||await this._step()}_getNewPoint(i,t){const s=t*(a/this.retries),e=this.getRandom(this.radius,2*this.radius),o=Math.cos(s)*e,r=Math.sin(s)*e,h={x:Math.floor(i.position.x+o),y:Math.floor(i.position.y+r)},l=Math.floor(h.x/this.cellSize),c=Math.floor(h.y/this.cellSize);if(h.x>0&&h.x<this.size.width&&h.y>0&&h.y<this.size.height&&this.grid[c][l]<0){for(let i=-1;i<=1;i++)for(let t=-1;t<=1;t++){const s={x:l+t,y:c+i};if(s.x>=0&&s.y>=0&&s.x<this.cols&&s.y<this.rows&&(s.x!==l||s.y!==c)&&this.grid[s.y][s.x]>=0){const i=this.grid[s.y][s.x],t=this.points[i];if((0,n.getDistance)(h,t.position)<this.radius)return}}return h}}async _step(){const i=this.getRandom(0,this.active.length);return new Promise((t=>{let s=!1;for(let t=0;t<this.retries;t++){const e=this._getNewPoint(this.points[this.active[i]],t);if(e){s=!0,this.addPoint(e);break}}if(!s){const t=1;this.active.splice(i,t)}t()}))}}class l{constructor(i,t){this._container=i,this._engine=t,this._currentIndex=0}async init(){await this._initData()}particlePosition(i){const t=this._container.actualOptions.poisson;if(this.poissonDisc&&t?.enable&&!(this._currentIndex>=this.poissonDisc.points.length))return i??this.poissonDisc?.points[this._currentIndex++]?.position}resize(){const i=this._container,t=i.actualOptions.poisson;if(!t?.enable)return;this.redrawTimeout&&clearTimeout(this.redrawTimeout);this.redrawTimeout=setTimeout((()=>{(async()=>{await this._initData(),await i.particles.redraw()})()}),250)}stop(){delete this.poissonDisc}async _initData(){const i=this._container,t=i.actualOptions.poisson,s=i.actualOptions.particles,e=i.canvas.size,o=i.retina.pixelRatio;if(!t?.enable)return;this._currentIndex=0,this.poissonDisc=new h(e,t.radius?t.radius*o:Math.max((0,n.getRangeMax)(s.size.value)*o,Math.sqrt(e.width*e.height/s.number.value)),t.retries,t.dimensions);t.steps>0?await this.poissonDisc.steps(t.steps):await this.poissonDisc.run()}}class c{constructor(i){this.id="poisson",this._engine=i}getPlugin(i){return Promise.resolve(new l(i,this._engine))}loadOptions(i,t){if(!this.needsPlugin(i)&&!this.needsPlugin(t))return;let s=i.poisson;void 0===s?.load&&(i.poisson=s=new r),s.load(t?.poisson)}needsPlugin(i){return i?.poisson?.enable??!1}}async function d(i,t=!0){i.checkVersion("3.9.0"),await i.addPlugin(new c(i),t)}return o})()));
2
+ !function(i,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 s="object"==typeof exports?t(require("@tsparticles/engine")):t(i.window);for(var e in s)("object"==typeof exports?exports:i)[e]=s[e]}}(this,(i=>(()=>{var t={303:t=>{t.exports=i}},s={};function e(i){var o=s[i];if(void 0!==o)return o.exports;var n=s[i]={exports:{}};return t[i](n,n.exports,e),n.exports}e.d=(i,t)=>{for(var s in t)e.o(t,s)&&!e.o(i,s)&&Object.defineProperty(i,s,{enumerable:!0,get:t[s]})},e.o=(i,t)=>Object.prototype.hasOwnProperty.call(i,t),e.r=i=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})};var o={};e.r(o),e.d(o,{loadPoissonDiscPlugin:()=>d});var n=e(303);class r{constructor(){this.enable=!1,this.dimensions=2,this.radius=0,this.retries=30,this.steps=0}load(i){(0,n.isNull)(i)||(void 0!==i.enable&&(this.enable=i.enable),void 0!==i.dimensions&&(this.dimensions=i.dimensions),void 0!==i.radius&&(this.radius=i.radius),void 0!==i.retries&&(this.retries=i.retries))}}const a=2*Math.PI;class h{constructor(i,t,s,e,o){this.size={...i},this.radius=t,this.retries=s,this.dimensions=e,this.cellSize=Math.floor(this.radius/Math.sqrt(this.dimensions)),this.cols=Math.floor(this.size.width/this.cellSize),this.rows=Math.floor(this.size.height/this.cellSize),this.points=[],this.active=[],this.grid=[],this.firstPoint=o?{...o}:void 0,this.reset()}addPoint(i){const t={position:{...i},gridPosition:{x:Math.floor(i.x/this.cellSize),y:Math.floor(i.y/this.cellSize)}},s=this.points.length;this.points.push(t),this.grid[t.gridPosition.y][t.gridPosition.x]=s,this.active.push(s)}getRandom(i,t){return Math.floor((0,n.getRandom)()*(t-i))+i}initialiseGrid(){for(let i=0;i<=this.rows;i++){this.grid[i]=[];for(let t=0;t<=this.cols;t++)this.grid[i][t]=-1}}reset(){if(this.points=[],this.active=[],this.grid=[],this.initialiseGrid(),this.firstPoint)this.addPoint(this.firstPoint);else{const i=0;this.addPoint({x:this.getRandom(i,this.size.width),y:this.getRandom(i,this.size.height)})}}async run(){this.reset();for(;this.active.length>0;)await this.steps(1)}async steps(i){for(let t=0;t<i;t++)this.active.length<=0||await this._step()}_getNewPoint(i,t){const s=t*(a/this.retries),e=this.getRandom(this.radius,2*this.radius),o=Math.cos(s)*e,r=Math.sin(s)*e,h={x:Math.floor(i.position.x+o),y:Math.floor(i.position.y+r)},l=Math.floor(h.x/this.cellSize),c=Math.floor(h.y/this.cellSize);if(h.x>0&&h.x<this.size.width&&h.y>0&&h.y<this.size.height&&this.grid[c][l]<0){for(let i=-1;i<=1;i++)for(let t=-1;t<=1;t++){const s={x:l+t,y:c+i};if(s.x>=0&&s.y>=0&&s.x<this.cols&&s.y<this.rows&&(s.x!==l||s.y!==c)&&this.grid[s.y][s.x]>=0){const i=this.grid[s.y][s.x],t=this.points[i];if((0,n.getDistance)(h,t.position)<this.radius)return}}return h}}async _step(){const i=this.getRandom(0,this.active.length);return new Promise((t=>{let s=!1;for(let t=0;t<this.retries;t++){const e=this._getNewPoint(this.points[this.active[i]],t);if(e){s=!0,this.addPoint(e);break}}if(!s){const t=1;this.active.splice(i,t)}t()}))}}class l{constructor(i,t){this._container=i,this._engine=t,this._currentIndex=0}async init(){await this._initData()}particlePosition(i){const t=this._container.actualOptions.poisson;if(this.poissonDisc&&t?.enable&&!(this._currentIndex>=this.poissonDisc.points.length))return i??this.poissonDisc?.points[this._currentIndex++]?.position}resize(){const i=this._container,t=i.actualOptions.poisson;if(!t?.enable)return;this.redrawTimeout&&clearTimeout(this.redrawTimeout);this.redrawTimeout=setTimeout((()=>{(async()=>{await this._initData(),await i.particles.redraw()})()}),250)}stop(){delete this.poissonDisc}async _initData(){const i=this._container,t=i.actualOptions.poisson,s=i.actualOptions.particles,e=i.canvas.size,o=i.retina.pixelRatio;if(!t?.enable)return;this._currentIndex=0,this.poissonDisc=new h(e,t.radius?t.radius*o:Math.max((0,n.getRangeMax)(s.size.value)*o,Math.sqrt(e.width*e.height/s.number.value)),t.retries,t.dimensions);t.steps>0?await this.poissonDisc.steps(t.steps):await this.poissonDisc.run()}}class c{constructor(i){this.id="poisson",this._engine=i}getPlugin(i){return Promise.resolve(new l(i,this._engine))}loadOptions(i,t){if(!this.needsPlugin(i)&&!this.needsPlugin(t))return;let s=i.poisson;void 0===s?.load&&(i.poisson=s=new r),s.load(t?.poisson)}needsPlugin(i){return i?.poisson?.enable??!1}}async function d(i,t=!0){i.checkVersion("3.9.1"),await i.addPlugin(new c(i),t)}return o})()));
@@ -1 +1 @@
1
- /*! tsParticles Poisson Disc Plugin v3.9.0 by Matteo Bruni */
1
+ /*! tsParticles Poisson Disc Plugin v3.9.1 by Matteo Bruni */
package/umd/index.js CHANGED
@@ -12,7 +12,7 @@
12
12
  exports.loadPoissonDiscPlugin = loadPoissonDiscPlugin;
13
13
  const PoissonDiscPlugin_js_1 = require("./PoissonDiscPlugin.js");
14
14
  async function loadPoissonDiscPlugin(engine, refresh = true) {
15
- engine.checkVersion("3.9.0");
15
+ engine.checkVersion("3.9.1");
16
16
  await engine.addPlugin(new PoissonDiscPlugin_js_1.PoissonDiscPlugin(engine), refresh);
17
17
  }
18
18
  });