@tsparticles/interaction-external-grab
Advanced tools
Comparing version 3.0.0-beta.4 to 3.0.0-beta.5
@@ -7,14 +7,2 @@ import { GrabLinks } from "./GrabLinks.js"; | ||
} | ||
get lineLinked() { | ||
return this.links; | ||
} | ||
set lineLinked(value) { | ||
this.links = value; | ||
} | ||
get line_linked() { | ||
return this.links; | ||
} | ||
set line_linked(value) { | ||
this.links = value; | ||
} | ||
load(data) { | ||
@@ -27,4 +15,4 @@ if (!data) { | ||
} | ||
this.links.load(data.links ?? data.lineLinked ?? data.line_linked); | ||
this.links.load(data.links); | ||
} | ||
} |
@@ -10,14 +10,2 @@ "use strict"; | ||
} | ||
get lineLinked() { | ||
return this.links; | ||
} | ||
set lineLinked(value) { | ||
this.links = value; | ||
} | ||
get line_linked() { | ||
return this.links; | ||
} | ||
set line_linked(value) { | ||
this.links = value; | ||
} | ||
load(data) { | ||
@@ -30,5 +18,5 @@ if (!data) { | ||
} | ||
this.links.load(data.links ?? data.lineLinked ?? data.line_linked); | ||
this.links.load(data.links); | ||
} | ||
} | ||
exports.Grab = Grab; |
@@ -7,14 +7,2 @@ import { GrabLinks } from "./GrabLinks.js"; | ||
} | ||
get lineLinked() { | ||
return this.links; | ||
} | ||
set lineLinked(value) { | ||
this.links = value; | ||
} | ||
get line_linked() { | ||
return this.links; | ||
} | ||
set line_linked(value) { | ||
this.links = value; | ||
} | ||
load(data) { | ||
@@ -27,4 +15,4 @@ if (!data) { | ||
} | ||
this.links.load(data.links ?? data.lineLinked ?? data.line_linked); | ||
this.links.load(data.links); | ||
} | ||
} |
{ | ||
"name": "@tsparticles/interaction-external-grab", | ||
"version": "3.0.0-beta.4", | ||
"version": "3.0.0-beta.5", | ||
"description": "tsParticles grab external interaction", | ||
@@ -90,3 +90,3 @@ "homepage": "https://particles.js.org", | ||
"dependencies": { | ||
"@tsparticles/engine": "^3.0.0-beta.4" | ||
"@tsparticles/engine": "^3.0.0-beta.5" | ||
}, | ||
@@ -93,0 +93,0 @@ "publishConfig": { |
@@ -7,3 +7,3 @@ /*! | ||
* How to use? : Check the GitHub README | ||
* v3.0.0-beta.4 | ||
* v3.0.0-beta.5 | ||
*/ | ||
@@ -135,14 +135,2 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
} | ||
get lineLinked() { | ||
return this.links; | ||
} | ||
set lineLinked(value) { | ||
this.links = value; | ||
} | ||
get line_linked() { | ||
return this.links; | ||
} | ||
set line_linked(value) { | ||
this.links = value; | ||
} | ||
load(data) { | ||
@@ -155,3 +143,3 @@ if (!data) { | ||
} | ||
this.links.load(data.links ?? data.lineLinked ?? data.line_linked); | ||
this.links.load(data.links); | ||
} | ||
@@ -158,0 +146,0 @@ } |
/*! For license information please see tsparticles.interaction.external.grab.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 i="object"==typeof exports?e(require("@tsparticles/engine")):e(t.window);for(var n in i)("object"==typeof exports?exports:t)[n]=i[n]}}(this,(t=>(()=>{"use strict";var e={533:e=>{e.exports=t}},i={};function n(t){var o=i[t];if(void 0!==o)return o.exports;var r=i[t]={exports:{}};return e[t](r,r.exports,n),r.exports}n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return(()=>{n.r(o),n.d(o,{Grab:()=>i,GrabLinks:()=>e,loadExternalGrabInteraction:()=>a});var t=n(533);class e{constructor(){this.blink=!1,this.consent=!1,this.opacity=1}load(e){e&&(void 0!==e.blink&&(this.blink=e.blink),void 0!==e.color&&(this.color=t.OptionsColor.create(this.color,e.color)),void 0!==e.consent&&(this.consent=e.consent),void 0!==e.opacity&&(this.opacity=e.opacity))}}class i{constructor(){this.distance=100,this.links=new e}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))}}function r(e,i,n,o,r){e.canvas.draw((e=>{const s=i.getPosition();!function(e,i,n,o,r,s){(0,t.drawLine)(e,n,o),e.strokeStyle=(0,t.getStyleFromRgb)(r,s),e.lineWidth=i,e.stroke()}(e,i.retina.linksWidth??0,s,r,n,o)}))}class s extends t.ExternalInteractorBase{constructor(t){super(t)}clear(){}init(){const t=this.container,e=t.actualOptions.interactivity.modes.grab;e&&(t.retina.grabModeDistance=e.distance*t.retina.pixelRatio)}async interact(){const e=this.container,i=e.actualOptions.interactivity;if(!i.modes.grab||!i.events.onHover.enable||e.interactivity.status!==t.mouseMoveEvent)return;const n=e.interactivity.mouse.position;if(!n)return;const o=e.retina.grabModeDistance;if(!o||o<0)return;const s=e.particles.quadTree.queryCircle(n,o,(t=>this.isEnabled(t)));for(const a of s){const s=a.getPosition(),c=(0,t.getDistance)(s,n);if(c>o)continue;const l=i.modes.grab.links,d=l.opacity,p=d-c*d/o;if(p<=0)continue;const u=l.color??a.options.links?.color;if(!e.particles.grabLineColor&&u){const n=i.modes.grab.links;e.particles.grabLineColor=(0,t.getLinkRandomColor)(u,n.blink,n.consent)}const b=(0,t.getLinkColor)(a,void 0,e.particles.grabLineColor);b&&r(e,a,b,p,n)}}isEnabled(e){const i=this.container,n=i.interactivity.mouse,o=(e?.interactivity??i.actualOptions.interactivity).events;return o.onHover.enable&&!!n.position&&(0,t.isInArray)("grab",o.onHover.mode)}loadModeOptions(t,...e){t.grab||(t.grab=new i);for(const i of e)t.grab.load(i?.grab)}reset(){}}async function a(t,e=!0){await t.addInteractor("externalGrab",(t=>new s(t)),e)}})(),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 o="object"==typeof exports?e(require("@tsparticles/engine")):e(t.window);for(var i in o)("object"==typeof exports?exports:t)[i]=o[i]}}(this,(t=>(()=>{"use strict";var e={533:e=>{e.exports=t}},o={};function i(t){var n=o[t];if(void 0!==n)return n.exports;var r=o[t]={exports:{}};return e[t](r,r.exports,i),r.exports}i.d=(t,e)=>{for(var o in e)i.o(e,o)&&!i.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},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 n={};return(()=>{i.r(n),i.d(n,{Grab:()=>o,GrabLinks:()=>e,loadExternalGrabInteraction:()=>a});var t=i(533);class e{constructor(){this.blink=!1,this.consent=!1,this.opacity=1}load(e){e&&(void 0!==e.blink&&(this.blink=e.blink),void 0!==e.color&&(this.color=t.OptionsColor.create(this.color,e.color)),void 0!==e.consent&&(this.consent=e.consent),void 0!==e.opacity&&(this.opacity=e.opacity))}}class o{constructor(){this.distance=100,this.links=new e}load(t){t&&(void 0!==t.distance&&(this.distance=t.distance),this.links.load(t.links))}}function r(e,o,i,n,r){e.canvas.draw((e=>{const s=o.getPosition();!function(e,o,i,n,r,s){(0,t.drawLine)(e,i,n),e.strokeStyle=(0,t.getStyleFromRgb)(r,s),e.lineWidth=o,e.stroke()}(e,o.retina.linksWidth??0,s,r,i,n)}))}class s extends t.ExternalInteractorBase{constructor(t){super(t)}clear(){}init(){const t=this.container,e=t.actualOptions.interactivity.modes.grab;e&&(t.retina.grabModeDistance=e.distance*t.retina.pixelRatio)}async interact(){const e=this.container,o=e.actualOptions.interactivity;if(!o.modes.grab||!o.events.onHover.enable||e.interactivity.status!==t.mouseMoveEvent)return;const i=e.interactivity.mouse.position;if(!i)return;const n=e.retina.grabModeDistance;if(!n||n<0)return;const s=e.particles.quadTree.queryCircle(i,n,(t=>this.isEnabled(t)));for(const a of s){const s=a.getPosition(),c=(0,t.getDistance)(s,i);if(c>n)continue;const l=o.modes.grab.links,d=l.opacity,p=d-c*d/n;if(p<=0)continue;const b=l.color??a.options.links?.color;if(!e.particles.grabLineColor&&b){const i=o.modes.grab.links;e.particles.grabLineColor=(0,t.getLinkRandomColor)(b,i.blink,i.consent)}const u=(0,t.getLinkColor)(a,void 0,e.particles.grabLineColor);u&&r(e,a,u,p,i)}}isEnabled(e){const o=this.container,i=o.interactivity.mouse,n=(e?.interactivity??o.actualOptions.interactivity).events;return n.onHover.enable&&!!i.position&&(0,t.isInArray)("grab",n.onHover.mode)}loadModeOptions(t,...e){t.grab||(t.grab=new o);for(const o of e)t.grab.load(o?.grab)}reset(){}}async function a(t,e=!0){await t.addInteractor("externalGrab",(t=>new s(t)),e)}})(),n})())); |
@@ -1,1 +0,1 @@ | ||
/*! tsParticles Grab External Interaction v3.0.0-beta.4 by Matteo Bruni */ | ||
/*! tsParticles Grab External Interaction v3.0.0-beta.5 by Matteo Bruni */ |
@@ -8,7 +8,3 @@ import type { IOptionLoader, RecursivePartial } from "@tsparticles/engine"; | ||
constructor(); | ||
get lineLinked(): GrabLinks; | ||
set lineLinked(value: GrabLinks); | ||
get line_linked(): GrabLinks; | ||
set line_linked(value: GrabLinks); | ||
load(data?: RecursivePartial<IGrab>): void; | ||
} |
import type { IGrabLinks } from "./IGrabLinks.js"; | ||
export interface IGrab { | ||
distance: number; | ||
lineLinked: IGrabLinks; | ||
line_linked: IGrabLinks; | ||
links: IGrabLinks; | ||
} |
@@ -19,14 +19,2 @@ (function (factory) { | ||
} | ||
get lineLinked() { | ||
return this.links; | ||
} | ||
set lineLinked(value) { | ||
this.links = value; | ||
} | ||
get line_linked() { | ||
return this.links; | ||
} | ||
set line_linked(value) { | ||
this.links = value; | ||
} | ||
load(data) { | ||
@@ -39,3 +27,3 @@ if (!data) { | ||
} | ||
this.links.load(data.links ?? data.lineLinked ?? data.line_linked); | ||
this.links.load(data.links); | ||
} | ||
@@ -42,0 +30,0 @@ } |
Sorry, the diff of this file is not supported yet
325120
1024