@tsparticles/interaction-external-cannon 4.0.0-beta.15 → 4.0.0-beta.16
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 +1 -1
- package/browser/index.lazy.js +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.lazy.js +1 -1
- package/esm/index.js +1 -1
- package/esm/index.lazy.js +1 -1
- package/package.json +3 -3
- package/tsparticles.interaction.external.cannon.js +2 -2
- package/tsparticles.interaction.external.cannon.min.js +1 -1
package/browser/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { ensureInteractivityPluginLoaded } from "@tsparticles/plugin-interactivi
|
|
|
2
2
|
export { Cannon } from "./Options/Classes/Cannon.js";
|
|
3
3
|
import { Cannoner } from "./Cannoner.js";
|
|
4
4
|
export async function loadExternalCannonInteraction(engine) {
|
|
5
|
-
engine.checkVersion("4.0.0-beta.
|
|
5
|
+
engine.checkVersion("4.0.0-beta.16");
|
|
6
6
|
await engine.pluginManager.register((e) => {
|
|
7
7
|
ensureInteractivityPluginLoaded(e);
|
|
8
8
|
e.pluginManager.addInteractor?.("externalCannon", container => {
|
package/browser/index.lazy.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Cannon } from "./Options/Classes/Cannon.js";
|
|
2
2
|
export async function loadExternalCannonInteraction(engine) {
|
|
3
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
+
engine.checkVersion("4.0.0-beta.16");
|
|
4
4
|
await engine.pluginManager.register(async (e) => {
|
|
5
5
|
const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity/lazy");
|
|
6
6
|
ensureInteractivityPluginLoaded(e);
|
package/cjs/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { ensureInteractivityPluginLoaded } from "@tsparticles/plugin-interactivi
|
|
|
2
2
|
export { Cannon } from "./Options/Classes/Cannon.js";
|
|
3
3
|
import { Cannoner } from "./Cannoner.js";
|
|
4
4
|
export async function loadExternalCannonInteraction(engine) {
|
|
5
|
-
engine.checkVersion("4.0.0-beta.
|
|
5
|
+
engine.checkVersion("4.0.0-beta.16");
|
|
6
6
|
await engine.pluginManager.register((e) => {
|
|
7
7
|
ensureInteractivityPluginLoaded(e);
|
|
8
8
|
e.pluginManager.addInteractor?.("externalCannon", container => {
|
package/cjs/index.lazy.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Cannon } from "./Options/Classes/Cannon.js";
|
|
2
2
|
export async function loadExternalCannonInteraction(engine) {
|
|
3
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
+
engine.checkVersion("4.0.0-beta.16");
|
|
4
4
|
await engine.pluginManager.register(async (e) => {
|
|
5
5
|
const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity/lazy");
|
|
6
6
|
ensureInteractivityPluginLoaded(e);
|
package/esm/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { ensureInteractivityPluginLoaded } from "@tsparticles/plugin-interactivi
|
|
|
2
2
|
export { Cannon } from "./Options/Classes/Cannon.js";
|
|
3
3
|
import { Cannoner } from "./Cannoner.js";
|
|
4
4
|
export async function loadExternalCannonInteraction(engine) {
|
|
5
|
-
engine.checkVersion("4.0.0-beta.
|
|
5
|
+
engine.checkVersion("4.0.0-beta.16");
|
|
6
6
|
await engine.pluginManager.register((e) => {
|
|
7
7
|
ensureInteractivityPluginLoaded(e);
|
|
8
8
|
e.pluginManager.addInteractor?.("externalCannon", container => {
|
package/esm/index.lazy.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Cannon } from "./Options/Classes/Cannon.js";
|
|
2
2
|
export async function loadExternalCannonInteraction(engine) {
|
|
3
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
+
engine.checkVersion("4.0.0-beta.16");
|
|
4
4
|
await engine.pluginManager.register(async (e) => {
|
|
5
5
|
const { ensureInteractivityPluginLoaded } = await import("@tsparticles/plugin-interactivity/lazy");
|
|
6
6
|
ensureInteractivityPluginLoaded(e);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/interaction-external-cannon",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.16",
|
|
4
4
|
"description": "tsParticles cannon external interaction",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
},
|
|
102
102
|
"type": "module",
|
|
103
103
|
"peerDependencies": {
|
|
104
|
-
"@tsparticles/engine": "4.0.0-beta.
|
|
105
|
-
"@tsparticles/plugin-interactivity": "4.0.0-beta.
|
|
104
|
+
"@tsparticles/engine": "4.0.0-beta.16",
|
|
105
|
+
"@tsparticles/plugin-interactivity": "4.0.0-beta.16"
|
|
106
106
|
}
|
|
107
107
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function(g){g.__tsParticlesInternals=g.__tsParticlesInternals||{};g.__tsParticlesInternals.bundles=g.__tsParticlesInternals.bundles||{};g.__tsParticlesInternals.effects=g.__tsParticlesInternals.effects||{};g.__tsParticlesInternals.engine=g.__tsParticlesInternals.engine||{};g.__tsParticlesInternals.interactions=g.__tsParticlesInternals.interactions||{};g.__tsParticlesInternals.palettes=g.__tsParticlesInternals.palettes||{};g.__tsParticlesInternals.paths=g.__tsParticlesInternals.paths||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins.emittersShapes=g.__tsParticlesInternals.plugins.emittersShapes||{};g.__tsParticlesInternals.presets=g.__tsParticlesInternals.presets||{};g.__tsParticlesInternals.shapes=g.__tsParticlesInternals.shapes||{};g.__tsParticlesInternals.updaters=g.__tsParticlesInternals.updaters||{};g.__tsParticlesInternals.utils=g.__tsParticlesInternals.utils||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas.utils=g.__tsParticlesInternals.canvas.utils||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path.utils=g.__tsParticlesInternals.path.utils||{};var __tsProxyFactory=typeof Proxy!=="undefined"?function(obj){return new Proxy(obj,{get:function(target,key){if(!(key in target)){target[key]={};}return target[key];}});}:function(obj){return obj;};g.__tsParticlesInternals.bundles=__tsProxyFactory(g.__tsParticlesInternals.bundles);g.__tsParticlesInternals.effects=__tsProxyFactory(g.__tsParticlesInternals.effects);g.__tsParticlesInternals.interactions=__tsProxyFactory(g.__tsParticlesInternals.interactions);g.__tsParticlesInternals.palettes=__tsProxyFactory(g.__tsParticlesInternals.palettes);g.__tsParticlesInternals.paths=__tsProxyFactory(g.__tsParticlesInternals.paths);g.__tsParticlesInternals.plugins=__tsProxyFactory(g.__tsParticlesInternals.plugins);g.__tsParticlesInternals.plugins.emittersShapes=__tsProxyFactory(g.__tsParticlesInternals.plugins.emittersShapes);g.__tsParticlesInternals.presets=__tsProxyFactory(g.__tsParticlesInternals.presets);g.__tsParticlesInternals.shapes=__tsProxyFactory(g.__tsParticlesInternals.shapes);g.__tsParticlesInternals.updaters=__tsProxyFactory(g.__tsParticlesInternals.updaters);g.__tsParticlesInternals.utils=__tsProxyFactory(g.__tsParticlesInternals.utils);g.__tsParticlesInternals.canvas=__tsProxyFactory(g.__tsParticlesInternals.canvas);g.__tsParticlesInternals.path=__tsProxyFactory(g.__tsParticlesInternals.path);g.tsparticlesInternalExports=g.tsparticlesInternalExports||{};})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
|
|
2
|
-
/* External Interaction v4.0.0-beta.
|
|
2
|
+
/* External Interaction v4.0.0-beta.16 */
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tsparticles/plugin-interactivity'), require('@tsparticles/engine')) :
|
|
5
5
|
typeof define === 'function' && define.amd ? define(['exports', '@tsparticles/plugin-interactivity', '@tsparticles/engine'], factory) :
|
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
async function loadExternalCannonInteraction(engine) {
|
|
181
|
-
engine.checkVersion("4.0.0-beta.
|
|
181
|
+
engine.checkVersion("4.0.0-beta.16");
|
|
182
182
|
await engine.pluginManager.register((e) => {
|
|
183
183
|
pluginInteractivity.ensureInteractivityPluginLoaded(e);
|
|
184
184
|
e.pluginManager.addInteractor?.("externalCannon", container => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t){t.__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.bundles=t.__tsParticlesInternals.bundles||{},t.__tsParticlesInternals.effects=t.__tsParticlesInternals.effects||{},t.__tsParticlesInternals.engine=t.__tsParticlesInternals.engine||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.palettes=t.__tsParticlesInternals.palettes||{},t.__tsParticlesInternals.paths=t.__tsParticlesInternals.paths||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins.emittersShapes=t.__tsParticlesInternals.plugins.emittersShapes||{},t.__tsParticlesInternals.presets=t.__tsParticlesInternals.presets||{},t.__tsParticlesInternals.shapes=t.__tsParticlesInternals.shapes||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.utils=t.__tsParticlesInternals.utils||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas.utils=t.__tsParticlesInternals.canvas.utils||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path.utils=t.__tsParticlesInternals.path.utils||{};var e="undefined"!=typeof Proxy?function(t){return new Proxy(t,{get:function(t,e){return e in t||(t[e]={}),t[e]}})}:function(t){return t};t.__tsParticlesInternals.bundles=e(t.__tsParticlesInternals.bundles),t.__tsParticlesInternals.effects=e(t.__tsParticlesInternals.effects),t.__tsParticlesInternals.interactions=e(t.__tsParticlesInternals.interactions),t.__tsParticlesInternals.palettes=e(t.__tsParticlesInternals.palettes),t.__tsParticlesInternals.paths=e(t.__tsParticlesInternals.paths),t.__tsParticlesInternals.plugins=e(t.__tsParticlesInternals.plugins),t.__tsParticlesInternals.plugins.emittersShapes=e(t.__tsParticlesInternals.plugins.emittersShapes),t.__tsParticlesInternals.presets=e(t.__tsParticlesInternals.presets),t.__tsParticlesInternals.shapes=e(t.__tsParticlesInternals.shapes),t.__tsParticlesInternals.updaters=e(t.__tsParticlesInternals.updaters),t.__tsParticlesInternals.utils=e(t.__tsParticlesInternals.utils),t.__tsParticlesInternals.canvas=e(t.__tsParticlesInternals.canvas),t.__tsParticlesInternals.path=e(t.__tsParticlesInternals.path),t.tsparticlesInternalExports=t.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@tsparticles/plugin-interactivity"),require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/plugin-interactivity","@tsparticles/engine"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.interactions.externalCannon=t.__tsParticlesInternals.interactions.externalCannon||{}),t.__tsParticlesInternals.plugins.interactivity,t.__tsParticlesInternals.engine)}(this,function(t,e,s){"use strict";class a{drawVector;maxDragDistance;maxParticles;minParticles;particleFactor;spread;vectorColor;velocityFactor;constructor(){this.spread=30,this.velocityFactor=.5,this.particleFactor=.2,this.maxDragDistance=200,this.minParticles=5,this.maxParticles=200,this.drawVector=!0,this.vectorColor="#ffffff80"}load(t){t&&(void 0!==t.spread&&(this.spread=t.spread),void 0!==t.velocityFactor&&(this.velocityFactor=t.velocityFactor),void 0!==t.particleFactor&&(this.particleFactor=t.particleFactor),void 0!==t.minParticles&&(this.minParticles=t.minParticles),void 0!==t.maxParticles&&(this.maxParticles=t.maxParticles),void 0!==t.drawVector&&(this.drawVector=t.drawVector),void 0!==t.vectorColor&&(this.vectorColor=t.vectorColor))}}var n;!function(t){t[t.idle=0]="idle",t[t.aiming=1]="aiming",t[t.fired=2]="fired"}(n||(n={}));const r="cannon",i=s.identity/20;class l extends e.ExternalInteractorBase{maxDistance=0;_data;_gesture={origin:s.Vector.origin,current:s.Vector.origin,active:!1};_lastDownPosition=void 0;_state=n.idle;constructor(t){super(t)}clear(t,e){}init(){const t=this.container.actualOptions.interactivity?.modes.cannon??new a;this._data={spread:s.degToRad(t.spread),maxDragDistance:t.maxDragDistance,velocityFactor:t.velocityFactor,particleFactor:t.particleFactor,minParticles:t.minParticles,maxParticles:t.maxParticles,drawVector:t.drawVector,vectorColor:t.vectorColor}}interact(t,e){const s=t.mouse,a=s.position,r=s.clicking,i=s.downPosition;r&&i&&i!==this._lastDownPosition&&this._state===n.idle&&(this._lastDownPosition=i,this._gesture={origin:{x:i.x,y:i.y},current:{x:i.x,y:i.y},active:!0},this._state=n.aiming),this._state===n.aiming&&a&&(this._gesture.current={x:a.x,y:a.y},this._drawVector()),r||this._state!==n.aiming||(this._gesture.active=!1,this._fire(),this._state=n.idle)}isEnabled(t){const{container:e}=this,s=e.actualOptions.interactivity?.events;if(!s?.onClick.enable)return!1;const a=s.onClick.mode;return!!(Array.isArray(a)?a.includes(r):a===r)&&(this._state!==n.idle||t.mouse.clicking)}loadModeOptions(t,...e){t.cannon??=new a;for(const s of e)t.cannon.load(s?.cannon)}reset(t,e){}_drawVector(){this.container.canvas.render.draw(t=>{const e=this._data;if(!e)return;const{origin:a,current:n}=this._gesture,r=this.container.retina.pixelRatio,l=s.getDistance(a,n),c=e.maxDragDistance>s.none?Math.min(l,e.maxDragDistance*r):r,o=l>0?c/l:0,_=a.x+(n.x-a.x)*o,P=a.y+(n.y-a.y)*o;t.save(),t.strokeStyle=e.vectorColor,t.lineWidth=s.double*r,t.beginPath(),t.moveTo(a.x,a.y),t.lineTo(_,P),t.stroke();const d=Math.max(4,c*i)*r;t.beginPath(),t.arc(a.x,a.y,d,0,s.doublePI),t.strokeStyle=e.vectorColor,t.lineWidth=s.double*r,t.stroke(),t.restore()})}_fire(){const t=this._data;if(!t)return;const{origin:e,current:a}=this._gesture,n=this.container.retina.pixelRatio,r=s.getDistance(e,a),i=t.maxDragDistance>s.none?Math.min(r,t.maxDragDistance*n):r;if(i<2)return;const l=s.identity/n,c=(d=a.x,p=a.y,I=e.x,h=e.y,Math.atan2(h-p,I-d)),o=i*l*t.velocityFactor,_=Math.min(t.maxParticles,Math.max(t.minParticles,Math.round(i*t.particleFactor))),P=180/Math.PI;var d,p,I,h;for(let a=0;a<_;a++){const a=c+s.getRandomInRange(-t.spread,t.spread),n=s.getRandomInRange(.25*o,o);this.container.particles.addParticle(e,{move:{enable:!0,speed:n,direction:a*P}})}}}async function c(t){t.checkVersion("4.0.0-beta.
|
|
1
|
+
!function(t){t.__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.bundles=t.__tsParticlesInternals.bundles||{},t.__tsParticlesInternals.effects=t.__tsParticlesInternals.effects||{},t.__tsParticlesInternals.engine=t.__tsParticlesInternals.engine||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.palettes=t.__tsParticlesInternals.palettes||{},t.__tsParticlesInternals.paths=t.__tsParticlesInternals.paths||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins.emittersShapes=t.__tsParticlesInternals.plugins.emittersShapes||{},t.__tsParticlesInternals.presets=t.__tsParticlesInternals.presets||{},t.__tsParticlesInternals.shapes=t.__tsParticlesInternals.shapes||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.utils=t.__tsParticlesInternals.utils||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas.utils=t.__tsParticlesInternals.canvas.utils||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path.utils=t.__tsParticlesInternals.path.utils||{};var e="undefined"!=typeof Proxy?function(t){return new Proxy(t,{get:function(t,e){return e in t||(t[e]={}),t[e]}})}:function(t){return t};t.__tsParticlesInternals.bundles=e(t.__tsParticlesInternals.bundles),t.__tsParticlesInternals.effects=e(t.__tsParticlesInternals.effects),t.__tsParticlesInternals.interactions=e(t.__tsParticlesInternals.interactions),t.__tsParticlesInternals.palettes=e(t.__tsParticlesInternals.palettes),t.__tsParticlesInternals.paths=e(t.__tsParticlesInternals.paths),t.__tsParticlesInternals.plugins=e(t.__tsParticlesInternals.plugins),t.__tsParticlesInternals.plugins.emittersShapes=e(t.__tsParticlesInternals.plugins.emittersShapes),t.__tsParticlesInternals.presets=e(t.__tsParticlesInternals.presets),t.__tsParticlesInternals.shapes=e(t.__tsParticlesInternals.shapes),t.__tsParticlesInternals.updaters=e(t.__tsParticlesInternals.updaters),t.__tsParticlesInternals.utils=e(t.__tsParticlesInternals.utils),t.__tsParticlesInternals.canvas=e(t.__tsParticlesInternals.canvas),t.__tsParticlesInternals.path=e(t.__tsParticlesInternals.path),t.tsparticlesInternalExports=t.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@tsparticles/plugin-interactivity"),require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/plugin-interactivity","@tsparticles/engine"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.interactions.externalCannon=t.__tsParticlesInternals.interactions.externalCannon||{}),t.__tsParticlesInternals.plugins.interactivity,t.__tsParticlesInternals.engine)}(this,function(t,e,s){"use strict";class a{drawVector;maxDragDistance;maxParticles;minParticles;particleFactor;spread;vectorColor;velocityFactor;constructor(){this.spread=30,this.velocityFactor=.5,this.particleFactor=.2,this.maxDragDistance=200,this.minParticles=5,this.maxParticles=200,this.drawVector=!0,this.vectorColor="#ffffff80"}load(t){t&&(void 0!==t.spread&&(this.spread=t.spread),void 0!==t.velocityFactor&&(this.velocityFactor=t.velocityFactor),void 0!==t.particleFactor&&(this.particleFactor=t.particleFactor),void 0!==t.minParticles&&(this.minParticles=t.minParticles),void 0!==t.maxParticles&&(this.maxParticles=t.maxParticles),void 0!==t.drawVector&&(this.drawVector=t.drawVector),void 0!==t.vectorColor&&(this.vectorColor=t.vectorColor))}}var n;!function(t){t[t.idle=0]="idle",t[t.aiming=1]="aiming",t[t.fired=2]="fired"}(n||(n={}));const r="cannon",i=s.identity/20;class l extends e.ExternalInteractorBase{maxDistance=0;_data;_gesture={origin:s.Vector.origin,current:s.Vector.origin,active:!1};_lastDownPosition=void 0;_state=n.idle;constructor(t){super(t)}clear(t,e){}init(){const t=this.container.actualOptions.interactivity?.modes.cannon??new a;this._data={spread:s.degToRad(t.spread),maxDragDistance:t.maxDragDistance,velocityFactor:t.velocityFactor,particleFactor:t.particleFactor,minParticles:t.minParticles,maxParticles:t.maxParticles,drawVector:t.drawVector,vectorColor:t.vectorColor}}interact(t,e){const s=t.mouse,a=s.position,r=s.clicking,i=s.downPosition;r&&i&&i!==this._lastDownPosition&&this._state===n.idle&&(this._lastDownPosition=i,this._gesture={origin:{x:i.x,y:i.y},current:{x:i.x,y:i.y},active:!0},this._state=n.aiming),this._state===n.aiming&&a&&(this._gesture.current={x:a.x,y:a.y},this._drawVector()),r||this._state!==n.aiming||(this._gesture.active=!1,this._fire(),this._state=n.idle)}isEnabled(t){const{container:e}=this,s=e.actualOptions.interactivity?.events;if(!s?.onClick.enable)return!1;const a=s.onClick.mode;return!!(Array.isArray(a)?a.includes(r):a===r)&&(this._state!==n.idle||t.mouse.clicking)}loadModeOptions(t,...e){t.cannon??=new a;for(const s of e)t.cannon.load(s?.cannon)}reset(t,e){}_drawVector(){this.container.canvas.render.draw(t=>{const e=this._data;if(!e)return;const{origin:a,current:n}=this._gesture,r=this.container.retina.pixelRatio,l=s.getDistance(a,n),c=e.maxDragDistance>s.none?Math.min(l,e.maxDragDistance*r):r,o=l>0?c/l:0,_=a.x+(n.x-a.x)*o,P=a.y+(n.y-a.y)*o;t.save(),t.strokeStyle=e.vectorColor,t.lineWidth=s.double*r,t.beginPath(),t.moveTo(a.x,a.y),t.lineTo(_,P),t.stroke();const d=Math.max(4,c*i)*r;t.beginPath(),t.arc(a.x,a.y,d,0,s.doublePI),t.strokeStyle=e.vectorColor,t.lineWidth=s.double*r,t.stroke(),t.restore()})}_fire(){const t=this._data;if(!t)return;const{origin:e,current:a}=this._gesture,n=this.container.retina.pixelRatio,r=s.getDistance(e,a),i=t.maxDragDistance>s.none?Math.min(r,t.maxDragDistance*n):r;if(i<2)return;const l=s.identity/n,c=(d=a.x,p=a.y,I=e.x,h=e.y,Math.atan2(h-p,I-d)),o=i*l*t.velocityFactor,_=Math.min(t.maxParticles,Math.max(t.minParticles,Math.round(i*t.particleFactor))),P=180/Math.PI;var d,p,I,h;for(let a=0;a<_;a++){const a=c+s.getRandomInRange(-t.spread,t.spread),n=s.getRandomInRange(.25*o,o);this.container.particles.addParticle(e,{move:{enable:!0,speed:n,direction:a*P}})}}}async function c(t){t.checkVersion("4.0.0-beta.16"),await t.pluginManager.register(t=>{e.ensureInteractivityPluginLoaded(t),t.pluginManager.addInteractor?.("externalCannon",t=>Promise.resolve(new l(t)))})}const o=globalThis;o.__tsParticlesInternals=o.__tsParticlesInternals??{},o.loadExternalCannonInteraction=c,t.Cannon=a,t.loadExternalCannonInteraction=c}),Object.assign(globalThis.window||globalThis,{loadExternalCannonInteraction:(globalThis.__tsParticlesInternals.interactions.externalCannon||{}).loadExternalCannonInteraction}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
|