tsparticles-interaction-external-connect
Advanced tools
Comparing version 2.10.1 to 2.11.0
import { Connector } from "./Connector"; | ||
export async function loadExternalConnectInteraction(engine) { | ||
await engine.addInteractor("externalConnect", (container) => new Connector(container)); | ||
export async function loadExternalConnectInteraction(engine, refresh = true) { | ||
await engine.addInteractor("externalConnect", (container) => new Connector(container), refresh); | ||
} | ||
@@ -5,0 +5,0 @@ export * from "./Options/Classes/Connect"; |
@@ -19,4 +19,4 @@ "use strict"; | ||
const Connector_1 = require("./Connector"); | ||
async function loadExternalConnectInteraction(engine) { | ||
await engine.addInteractor("externalConnect", (container) => new Connector_1.Connector(container)); | ||
async function loadExternalConnectInteraction(engine, refresh = true) { | ||
await engine.addInteractor("externalConnect", (container) => new Connector_1.Connector(container), refresh); | ||
} | ||
@@ -23,0 +23,0 @@ exports.loadExternalConnectInteraction = loadExternalConnectInteraction; |
import { Connector } from "./Connector"; | ||
export async function loadExternalConnectInteraction(engine) { | ||
await engine.addInteractor("externalConnect", (container) => new Connector(container)); | ||
export async function loadExternalConnectInteraction(engine, refresh = true) { | ||
await engine.addInteractor("externalConnect", (container) => new Connector(container), refresh); | ||
} | ||
@@ -5,0 +5,0 @@ export * from "./Options/Classes/Connect"; |
{ | ||
"name": "tsparticles-interaction-external-connect", | ||
"version": "2.10.1", | ||
"version": "2.11.0", | ||
"description": "tsParticles connect external interaction", | ||
@@ -76,5 +76,6 @@ "homepage": "https://particles.js.org", | ||
"types": "types/index.d.ts", | ||
"sideEffects": false, | ||
"dependencies": { | ||
"tsparticles-engine": "^2.10.1" | ||
"tsparticles-engine": "^2.11.0" | ||
} | ||
} |
@@ -30,7 +30,12 @@ [![banner](https://particles.js.org/images/banner2.png)](https://particles.js.org) | ||
```javascript | ||
loadExternalConnectInteraction(tsParticles); | ||
(async () => { | ||
await loadExternalConnectInteraction(tsParticles); | ||
tsParticles.load("tsparticles", { | ||
/* options */ | ||
}); | ||
await tsParticles.load({ | ||
id: "tsparticles", | ||
options: { | ||
/* options */ | ||
}, | ||
}); | ||
})(); | ||
``` | ||
@@ -58,3 +63,5 @@ | ||
loadExternalConnectInteraction(tsParticles); | ||
(async () => { | ||
await loadExternalConnectInteraction(tsParticles); | ||
})(); | ||
``` | ||
@@ -68,3 +75,5 @@ | ||
loadExternalConnectInteraction(tsParticles); | ||
(async () => { | ||
await loadExternalConnectInteraction(tsParticles); | ||
})(); | ||
``` |
@@ -7,3 +7,3 @@ /*! | ||
* How to use? : Check the GitHub README | ||
* v2.10.1 | ||
* v2.11.0 | ||
*/ | ||
@@ -257,4 +257,4 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
async function loadExternalConnectInteraction(engine) { | ||
await engine.addInteractor("externalConnect", container => new Connector(container)); | ||
async function loadExternalConnectInteraction(engine, refresh = true) { | ||
await engine.addInteractor("externalConnect", container => new Connector(container), refresh); | ||
} | ||
@@ -261,0 +261,0 @@ |
/*! For license information please see tsparticles.interaction.external.connect.min.js.LICENSE.txt */ | ||
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("tsparticles-engine"));else if("function"==typeof define&&define.amd)define(["tsparticles-engine"],e);else{var n="object"==typeof exports?e(require("tsparticles-engine")):e(t.window);for(var i in n)("object"==typeof exports?exports:t)[i]=n[i]}}(this,(t=>(()=>{"use strict";var e={961:e=>{e.exports=t}},n={};function i(t){var o=n[t];if(void 0!==o)return o.exports;var r=n[t]={exports:{}};return e[t](r,r.exports,i),r.exports}i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return(()=>{i.r(o),i.d(o,{Connect:()=>n,ConnectLinks:()=>e,loadExternalConnectInteraction:()=>c});var t=i(961);class e{constructor(){this.opacity=.5}load(t){t&&void 0!==t.opacity&&(this.opacity=t.opacity)}}class n{constructor(){this.distance=80,this.links=new e,this.radius=60}get lineLinked(){return this.links}set lineLinked(t){this.links=t}get line_linked(){return this.links}set line_linked(t){this.links=t}load(t){t&&(void 0!==t.distance&&(this.distance=t.distance),this.links.load(t.links??t.lineLinked??t.line_linked),void 0!==t.radius&&(this.radius=t.radius))}}function r(e,n,i,o){const r=e.actualOptions.interactivity.modes.connect;if(r)return function(e,n,i,o){const r=Math.floor(i.getRadius()/n.getRadius()),s=n.getFillColor(),a=i.getFillColor();if(!s||!a)return;const c=n.getPosition(),l=i.getPosition(),d=(0,t.colorMix)(s,a,n.getRadius(),i.getRadius()),u=e.createLinearGradient(c.x,c.y,l.x,l.y);return u.addColorStop(0,(0,t.getStyleFromHsl)(s,o)),u.addColorStop(r>1?1:r,(0,t.getStyleFromRgb)(d,o)),u.addColorStop(1,(0,t.getStyleFromHsl)(a,o)),u}(n,i,o,r.links.opacity)}function s(e,n,i){e.canvas.draw((o=>{const s=r(e,o,n,i);if(!s)return;const a=n.getPosition(),c=i.getPosition();!function(e,n,i,o,r){(0,t.drawLine)(e,o,r),e.lineWidth=n,e.strokeStyle=i,e.stroke()}(o,n.retina.linksWidth??0,s,a,c)}))}class a extends t.ExternalInteractorBase{constructor(t){super(t)}clear(){}init(){const t=this.container,e=t.actualOptions.interactivity.modes.connect;e&&(t.retina.connectModeDistance=e.distance*t.retina.pixelRatio,t.retina.connectModeRadius=e.radius*t.retina.pixelRatio)}async interact(){const t=this.container;if(t.actualOptions.interactivity.events.onHover.enable&&"pointermove"===t.interactivity.status){const e=t.interactivity.mouse.position;if(!t.retina.connectModeDistance||t.retina.connectModeDistance<0||!t.retina.connectModeRadius||t.retina.connectModeRadius<0||!e)return;const n=Math.abs(t.retina.connectModeRadius),i=t.particles.quadTree.queryCircle(e,n,(t=>this.isEnabled(t)));let o=0;for(const e of i){const n=e.getPosition();for(const r of i.slice(o+1)){const i=r.getPosition(),o=Math.abs(t.retina.connectModeDistance),a=Math.abs(n.x-i.x),c=Math.abs(n.y-i.y);a<o&&c<o&&s(t,e,r)}++o}}}isEnabled(e){const n=this.container,i=n.interactivity.mouse,o=(e?.interactivity??n.actualOptions.interactivity).events;return!(!o.onHover.enable||!i.position)&&(0,t.isInArray)("connect",o.onHover.mode)}loadModeOptions(t,...e){t.connect||(t.connect=new n);for(const n of e)t.connect.load(n?.connect)}reset(){}}async function c(t){await t.addInteractor("externalConnect",(t=>new a(t)))}})(),o})())); | ||
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("tsparticles-engine"));else if("function"==typeof define&&define.amd)define(["tsparticles-engine"],e);else{var n="object"==typeof exports?e(require("tsparticles-engine")):e(t.window);for(var i in n)("object"==typeof exports?exports:t)[i]=n[i]}}(this,(t=>(()=>{"use strict";var e={961:e=>{e.exports=t}},n={};function i(t){var o=n[t];if(void 0!==o)return o.exports;var r=n[t]={exports:{}};return e[t](r,r.exports,i),r.exports}i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return(()=>{i.r(o),i.d(o,{Connect:()=>n,ConnectLinks:()=>e,loadExternalConnectInteraction:()=>c});var t=i(961);class e{constructor(){this.opacity=.5}load(t){t&&void 0!==t.opacity&&(this.opacity=t.opacity)}}class n{constructor(){this.distance=80,this.links=new e,this.radius=60}get lineLinked(){return this.links}set lineLinked(t){this.links=t}get line_linked(){return this.links}set line_linked(t){this.links=t}load(t){t&&(void 0!==t.distance&&(this.distance=t.distance),this.links.load(t.links??t.lineLinked??t.line_linked),void 0!==t.radius&&(this.radius=t.radius))}}function r(e,n,i,o){const r=e.actualOptions.interactivity.modes.connect;if(r)return function(e,n,i,o){const r=Math.floor(i.getRadius()/n.getRadius()),s=n.getFillColor(),a=i.getFillColor();if(!s||!a)return;const c=n.getPosition(),l=i.getPosition(),d=(0,t.colorMix)(s,a,n.getRadius(),i.getRadius()),u=e.createLinearGradient(c.x,c.y,l.x,l.y);return u.addColorStop(0,(0,t.getStyleFromHsl)(s,o)),u.addColorStop(r>1?1:r,(0,t.getStyleFromRgb)(d,o)),u.addColorStop(1,(0,t.getStyleFromHsl)(a,o)),u}(n,i,o,r.links.opacity)}function s(e,n,i){e.canvas.draw((o=>{const s=r(e,o,n,i);if(!s)return;const a=n.getPosition(),c=i.getPosition();!function(e,n,i,o,r){(0,t.drawLine)(e,o,r),e.lineWidth=n,e.strokeStyle=i,e.stroke()}(o,n.retina.linksWidth??0,s,a,c)}))}class a extends t.ExternalInteractorBase{constructor(t){super(t)}clear(){}init(){const t=this.container,e=t.actualOptions.interactivity.modes.connect;e&&(t.retina.connectModeDistance=e.distance*t.retina.pixelRatio,t.retina.connectModeRadius=e.radius*t.retina.pixelRatio)}async interact(){const t=this.container;if(t.actualOptions.interactivity.events.onHover.enable&&"pointermove"===t.interactivity.status){const e=t.interactivity.mouse.position;if(!t.retina.connectModeDistance||t.retina.connectModeDistance<0||!t.retina.connectModeRadius||t.retina.connectModeRadius<0||!e)return;const n=Math.abs(t.retina.connectModeRadius),i=t.particles.quadTree.queryCircle(e,n,(t=>this.isEnabled(t)));let o=0;for(const e of i){const n=e.getPosition();for(const r of i.slice(o+1)){const i=r.getPosition(),o=Math.abs(t.retina.connectModeDistance),a=Math.abs(n.x-i.x),c=Math.abs(n.y-i.y);a<o&&c<o&&s(t,e,r)}++o}}}isEnabled(e){const n=this.container,i=n.interactivity.mouse,o=(e?.interactivity??n.actualOptions.interactivity).events;return!(!o.onHover.enable||!i.position)&&(0,t.isInArray)("connect",o.onHover.mode)}loadModeOptions(t,...e){t.connect||(t.connect=new n);for(const n of e)t.connect.load(n?.connect)}reset(){}}async function c(t,e=!0){await t.addInteractor("externalConnect",(t=>new a(t)),e)}})(),o})())); |
@@ -1,1 +0,1 @@ | ||
/*! tsParticles Connect External Interaction v2.10.1 by Matteo Bruni */ | ||
/*! tsParticles Connect External Interaction v2.11.0 by Matteo Bruni */ |
import type { Engine } from "tsparticles-engine"; | ||
export declare function loadExternalConnectInteraction(engine: Engine): Promise<void>; | ||
export declare function loadExternalConnectInteraction(engine: Engine, refresh?: boolean): Promise<void>; | ||
export * from "./Options/Classes/Connect"; | ||
@@ -4,0 +4,0 @@ export * from "./Options/Classes/ConnectLinks"; |
@@ -28,4 +28,4 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
const Connector_1 = require("./Connector"); | ||
async function loadExternalConnectInteraction(engine) { | ||
await engine.addInteractor("externalConnect", (container) => new Connector_1.Connector(container)); | ||
async function loadExternalConnectInteraction(engine, refresh = true) { | ||
await engine.addInteractor("externalConnect", (container) => new Connector_1.Connector(container), refresh); | ||
} | ||
@@ -32,0 +32,0 @@ exports.loadExternalConnectInteraction = loadExternalConnectInteraction; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
332539
77
Updatedtsparticles-engine@^2.11.0