@tsparticles/interaction-external-grab
Advanced tools
Comparing version 3.6.0 to 3.7.0
@@ -6,4 +6,5 @@ import { ExternalInteractorBase, getDistance, getLinkColor, getLinkRandomColor, isInArray, mouseMoveEvent, } from "@tsparticles/engine"; | ||
export class Grabber extends ExternalInteractorBase { | ||
constructor(container) { | ||
constructor(container, engine) { | ||
super(container); | ||
this._engine = engine; | ||
} | ||
@@ -47,3 +48,3 @@ clear() { | ||
const linksOptions = interactivity.modes.grab.links; | ||
container.particles.grabLineColor = getLinkRandomColor(optColor, linksOptions.blink, linksOptions.consent); | ||
container.particles.grabLineColor = getLinkRandomColor(this._engine, optColor, linksOptions.blink, linksOptions.consent); | ||
} | ||
@@ -50,0 +51,0 @@ const colorLine = getLinkColor(particle, undefined, container.particles.grabLineColor); |
@@ -0,5 +1,7 @@ | ||
import { assertValidVersion } from "@tsparticles/engine"; | ||
import { Grabber } from "./Grabber.js"; | ||
export async function loadExternalGrabInteraction(engine, refresh = true) { | ||
assertValidVersion(engine, "3.7.0"); | ||
await engine.addInteractor("externalGrab", container => { | ||
return Promise.resolve(new Grabber(container)); | ||
return Promise.resolve(new Grabber(container, engine)); | ||
}, refresh); | ||
@@ -6,0 +8,0 @@ } |
@@ -9,4 +9,5 @@ "use strict"; | ||
class Grabber extends engine_1.ExternalInteractorBase { | ||
constructor(container) { | ||
constructor(container, engine) { | ||
super(container); | ||
this._engine = engine; | ||
} | ||
@@ -50,3 +51,3 @@ clear() { | ||
const linksOptions = interactivity.modes.grab.links; | ||
container.particles.grabLineColor = (0, engine_1.getLinkRandomColor)(optColor, linksOptions.blink, linksOptions.consent); | ||
container.particles.grabLineColor = (0, engine_1.getLinkRandomColor)(this._engine, optColor, linksOptions.blink, linksOptions.consent); | ||
} | ||
@@ -53,0 +54,0 @@ const colorLine = (0, engine_1.getLinkColor)(particle, undefined, container.particles.grabLineColor); |
@@ -18,6 +18,8 @@ "use strict"; | ||
exports.loadExternalGrabInteraction = loadExternalGrabInteraction; | ||
const engine_1 = require("@tsparticles/engine"); | ||
const Grabber_js_1 = require("./Grabber.js"); | ||
async function loadExternalGrabInteraction(engine, refresh = true) { | ||
(0, engine_1.assertValidVersion)(engine, "3.7.0"); | ||
await engine.addInteractor("externalGrab", container => { | ||
return Promise.resolve(new Grabber_js_1.Grabber(container)); | ||
return Promise.resolve(new Grabber_js_1.Grabber(container, engine)); | ||
}, refresh); | ||
@@ -24,0 +26,0 @@ } |
@@ -6,4 +6,5 @@ import { ExternalInteractorBase, getDistance, getLinkColor, getLinkRandomColor, isInArray, mouseMoveEvent, } from "@tsparticles/engine"; | ||
export class Grabber extends ExternalInteractorBase { | ||
constructor(container) { | ||
constructor(container, engine) { | ||
super(container); | ||
this._engine = engine; | ||
} | ||
@@ -47,3 +48,3 @@ clear() { | ||
const linksOptions = interactivity.modes.grab.links; | ||
container.particles.grabLineColor = getLinkRandomColor(optColor, linksOptions.blink, linksOptions.consent); | ||
container.particles.grabLineColor = getLinkRandomColor(this._engine, optColor, linksOptions.blink, linksOptions.consent); | ||
} | ||
@@ -50,0 +51,0 @@ const colorLine = getLinkColor(particle, undefined, container.particles.grabLineColor); |
@@ -0,5 +1,7 @@ | ||
import { assertValidVersion } from "@tsparticles/engine"; | ||
import { Grabber } from "./Grabber.js"; | ||
export async function loadExternalGrabInteraction(engine, refresh = true) { | ||
assertValidVersion(engine, "3.7.0"); | ||
await engine.addInteractor("externalGrab", container => { | ||
return Promise.resolve(new Grabber(container)); | ||
return Promise.resolve(new Grabber(container, engine)); | ||
}, refresh); | ||
@@ -6,0 +8,0 @@ } |
{ | ||
"name": "@tsparticles/interaction-external-grab", | ||
"version": "3.6.0", | ||
"version": "3.7.0", | ||
"description": "tsParticles grab external interaction", | ||
@@ -90,3 +90,3 @@ "homepage": "https://particles.js.org", | ||
"dependencies": { | ||
"@tsparticles/engine": "^3.6.0" | ||
"@tsparticles/engine": "3.7.0" | ||
}, | ||
@@ -93,0 +93,0 @@ "publishConfig": { |
@@ -7,3 +7,3 @@ /*! | ||
* How to use? : Check the GitHub README | ||
* v3.6.0 | ||
* v3.7.0 | ||
*/ | ||
@@ -38,3 +38,3 @@ /* | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Grabber: () => (/* binding */ Grabber)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Options_Classes_Grab_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/Grab.js */ \"./dist/browser/Options/Classes/Grab.js\");\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\n\nconst grabMode = \"grab\",\n minDistance = 0,\n minOpacity = 0;\nclass Grabber extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ExternalInteractorBase {\n constructor(container) {\n super(container);\n }\n clear() {}\n init() {\n const container = this.container,\n grab = container.actualOptions.interactivity.modes.grab;\n if (!grab) {\n return;\n }\n container.retina.grabModeDistance = grab.distance * container.retina.pixelRatio;\n }\n interact() {\n const container = this.container,\n options = container.actualOptions,\n interactivity = options.interactivity;\n if (!interactivity.modes.grab || !interactivity.events.onHover.enable || container.interactivity.status !== _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.mouseMoveEvent) {\n return;\n }\n const mousePos = container.interactivity.mouse.position;\n if (!mousePos) {\n return;\n }\n const distance = container.retina.grabModeDistance;\n if (!distance || distance < minDistance) {\n return;\n }\n const query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(p));\n for (const particle of query) {\n const pos = particle.getPosition(),\n pointDistance = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistance)(pos, mousePos);\n if (pointDistance > distance) {\n continue;\n }\n const grabLineOptions = interactivity.modes.grab.links,\n lineOpacity = grabLineOptions.opacity,\n opacityLine = lineOpacity - pointDistance * lineOpacity / distance;\n if (opacityLine <= minOpacity) {\n continue;\n }\n const optColor = grabLineOptions.color ?? particle.options.links?.color;\n if (!container.particles.grabLineColor && optColor) {\n const linksOptions = interactivity.modes.grab.links;\n container.particles.grabLineColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getLinkRandomColor)(optColor, linksOptions.blink, linksOptions.consent);\n }\n const colorLine = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getLinkColor)(particle, undefined, container.particles.grabLineColor);\n if (!colorLine) {\n continue;\n }\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.drawGrab)(container, particle, colorLine, opacityLine, mousePos);\n }\n }\n isEnabled(particle) {\n const container = this.container,\n mouse = container.interactivity.mouse,\n events = (particle?.interactivity ?? container.actualOptions.interactivity).events;\n return events.onHover.enable && !!mouse.position && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(grabMode, events.onHover.mode);\n }\n loadModeOptions(options, ...sources) {\n if (!options.grab) {\n options.grab = new _Options_Classes_Grab_js__WEBPACK_IMPORTED_MODULE_2__.Grab();\n }\n for (const source of sources) {\n options.grab.load(source?.grab);\n }\n }\n reset() {}\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-grab/./dist/browser/Grabber.js?"); | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Grabber: () => (/* binding */ Grabber)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Options_Classes_Grab_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/Grab.js */ \"./dist/browser/Options/Classes/Grab.js\");\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\n\nconst grabMode = \"grab\",\n minDistance = 0,\n minOpacity = 0;\nclass Grabber extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ExternalInteractorBase {\n constructor(container, engine) {\n super(container);\n this._engine = engine;\n }\n clear() {}\n init() {\n const container = this.container,\n grab = container.actualOptions.interactivity.modes.grab;\n if (!grab) {\n return;\n }\n container.retina.grabModeDistance = grab.distance * container.retina.pixelRatio;\n }\n interact() {\n const container = this.container,\n options = container.actualOptions,\n interactivity = options.interactivity;\n if (!interactivity.modes.grab || !interactivity.events.onHover.enable || container.interactivity.status !== _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.mouseMoveEvent) {\n return;\n }\n const mousePos = container.interactivity.mouse.position;\n if (!mousePos) {\n return;\n }\n const distance = container.retina.grabModeDistance;\n if (!distance || distance < minDistance) {\n return;\n }\n const query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(p));\n for (const particle of query) {\n const pos = particle.getPosition(),\n pointDistance = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistance)(pos, mousePos);\n if (pointDistance > distance) {\n continue;\n }\n const grabLineOptions = interactivity.modes.grab.links,\n lineOpacity = grabLineOptions.opacity,\n opacityLine = lineOpacity - pointDistance * lineOpacity / distance;\n if (opacityLine <= minOpacity) {\n continue;\n }\n const optColor = grabLineOptions.color ?? particle.options.links?.color;\n if (!container.particles.grabLineColor && optColor) {\n const linksOptions = interactivity.modes.grab.links;\n container.particles.grabLineColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getLinkRandomColor)(this._engine, optColor, linksOptions.blink, linksOptions.consent);\n }\n const colorLine = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getLinkColor)(particle, undefined, container.particles.grabLineColor);\n if (!colorLine) {\n continue;\n }\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.drawGrab)(container, particle, colorLine, opacityLine, mousePos);\n }\n }\n isEnabled(particle) {\n const container = this.container,\n mouse = container.interactivity.mouse,\n events = (particle?.interactivity ?? container.actualOptions.interactivity).events;\n return events.onHover.enable && !!mouse.position && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(grabMode, events.onHover.mode);\n }\n loadModeOptions(options, ...sources) {\n if (!options.grab) {\n options.grab = new _Options_Classes_Grab_js__WEBPACK_IMPORTED_MODULE_2__.Grab();\n }\n for (const source of sources) {\n options.grab.load(source?.grab);\n }\n }\n reset() {}\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-grab/./dist/browser/Grabber.js?"); | ||
@@ -79,3 +79,3 @@ /***/ }), | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Grab: () => (/* reexport safe */ _Options_Classes_Grab_js__WEBPACK_IMPORTED_MODULE_1__.Grab),\n/* harmony export */ GrabLinks: () => (/* reexport safe */ _Options_Classes_GrabLinks_js__WEBPACK_IMPORTED_MODULE_2__.GrabLinks),\n/* harmony export */ loadExternalGrabInteraction: () => (/* binding */ loadExternalGrabInteraction)\n/* harmony export */ });\n/* harmony import */ var _Grabber_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Grabber.js */ \"./dist/browser/Grabber.js\");\n/* harmony import */ var _Options_Classes_Grab_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/Grab.js */ \"./dist/browser/Options/Classes/Grab.js\");\n/* harmony import */ var _Options_Classes_GrabLinks_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/GrabLinks.js */ \"./dist/browser/Options/Classes/GrabLinks.js\");\n\nasync function loadExternalGrabInteraction(engine, refresh = true) {\n await engine.addInteractor(\"externalGrab\", container => {\n return Promise.resolve(new _Grabber_js__WEBPACK_IMPORTED_MODULE_0__.Grabber(container));\n }, refresh);\n}\n\n\n\n\n\n//# sourceURL=webpack://@tsparticles/interaction-external-grab/./dist/browser/index.js?"); | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Grab: () => (/* reexport safe */ _Options_Classes_Grab_js__WEBPACK_IMPORTED_MODULE_2__.Grab),\n/* harmony export */ GrabLinks: () => (/* reexport safe */ _Options_Classes_GrabLinks_js__WEBPACK_IMPORTED_MODULE_3__.GrabLinks),\n/* harmony export */ loadExternalGrabInteraction: () => (/* binding */ loadExternalGrabInteraction)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Grabber_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Grabber.js */ \"./dist/browser/Grabber.js\");\n/* harmony import */ var _Options_Classes_Grab_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/Grab.js */ \"./dist/browser/Options/Classes/Grab.js\");\n/* harmony import */ var _Options_Classes_GrabLinks_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Options/Classes/GrabLinks.js */ \"./dist/browser/Options/Classes/GrabLinks.js\");\n\n\nasync function loadExternalGrabInteraction(engine, refresh = true) {\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.assertValidVersion)(engine, \"3.7.0\");\n await engine.addInteractor(\"externalGrab\", container => {\n return Promise.resolve(new _Grabber_js__WEBPACK_IMPORTED_MODULE_1__.Grabber(container, engine));\n }, refresh);\n}\n\n\n\n\n\n//# sourceURL=webpack://@tsparticles/interaction-external-grab/./dist/browser/index.js?"); | ||
@@ -82,0 +82,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 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=>(()=>{var e={303: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={};i.r(n),i.d(n,{Grab:()=>a,GrabLinks:()=>s,loadExternalGrabInteraction:()=>d});var r=i(303);class s{constructor(){this.blink=!1,this.consent=!1,this.opacity=1}load(t){(0,r.isNull)(t)||(void 0!==t.blink&&(this.blink=t.blink),void 0!==t.color&&(this.color=r.OptionsColor.create(this.color,t.color)),void 0!==t.consent&&(this.consent=t.consent),void 0!==t.opacity&&(this.opacity=t.opacity))}}class a{constructor(){this.distance=100,this.links=new s}load(t){(0,r.isNull)(t)||(void 0!==t.distance&&(this.distance=t.distance),this.links.load(t.links))}}function c(t,e,o,i,n){t.canvas.draw((t=>{const s=e.getPosition();!function(t,e,o,i,n,s){(0,r.drawLine)(t,o,i),t.strokeStyle=(0,r.getStyleFromRgb)(n,s),t.lineWidth=e,t.stroke()}(t,e.retina.linksWidth??0,s,n,o,i)}))}class l extends r.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)}interact(){const t=this.container,e=t.actualOptions.interactivity;if(!e.modes.grab||!e.events.onHover.enable||t.interactivity.status!==r.mouseMoveEvent)return;const o=t.interactivity.mouse.position;if(!o)return;const i=t.retina.grabModeDistance;if(!i||i<0)return;const n=t.particles.quadTree.queryCircle(o,i,(t=>this.isEnabled(t)));for(const s of n){const n=s.getPosition(),a=(0,r.getDistance)(n,o);if(a>i)continue;const l=e.modes.grab.links,d=l.opacity,p=d-a*d/i;if(p<=0)continue;const b=l.color??s.options.links?.color;if(!t.particles.grabLineColor&&b){const o=e.modes.grab.links;t.particles.grabLineColor=(0,r.getLinkRandomColor)(b,o.blink,o.consent)}const u=(0,r.getLinkColor)(s,void 0,t.particles.grabLineColor);u&&c(t,s,u,p,o)}}isEnabled(t){const e=this.container,o=e.interactivity.mouse,i=(t?.interactivity??e.actualOptions.interactivity).events;return i.onHover.enable&&!!o.position&&(0,r.isInArray)("grab",i.onHover.mode)}loadModeOptions(t,...e){t.grab||(t.grab=new a);for(const o of e)t.grab.load(o?.grab)}reset(){}}async function d(t,e=!0){await t.addInteractor("externalGrab",(t=>Promise.resolve(new l(t))),e)}return n})())); | ||
!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=>(()=>{var e={303: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={};i.r(n),i.d(n,{Grab:()=>a,GrabLinks:()=>s,loadExternalGrabInteraction:()=>d});var r=i(303);class s{constructor(){this.blink=!1,this.consent=!1,this.opacity=1}load(t){(0,r.isNull)(t)||(void 0!==t.blink&&(this.blink=t.blink),void 0!==t.color&&(this.color=r.OptionsColor.create(this.color,t.color)),void 0!==t.consent&&(this.consent=t.consent),void 0!==t.opacity&&(this.opacity=t.opacity))}}class a{constructor(){this.distance=100,this.links=new s}load(t){(0,r.isNull)(t)||(void 0!==t.distance&&(this.distance=t.distance),this.links.load(t.links))}}function c(t,e,o,i,n){t.canvas.draw((t=>{const s=e.getPosition();!function(t,e,o,i,n,s){(0,r.drawLine)(t,o,i),t.strokeStyle=(0,r.getStyleFromRgb)(n,s),t.lineWidth=e,t.stroke()}(t,e.retina.linksWidth??0,s,n,o,i)}))}class l extends r.ExternalInteractorBase{constructor(t,e){super(t),this._engine=e}clear(){}init(){const t=this.container,e=t.actualOptions.interactivity.modes.grab;e&&(t.retina.grabModeDistance=e.distance*t.retina.pixelRatio)}interact(){const t=this.container,e=t.actualOptions.interactivity;if(!e.modes.grab||!e.events.onHover.enable||t.interactivity.status!==r.mouseMoveEvent)return;const o=t.interactivity.mouse.position;if(!o)return;const i=t.retina.grabModeDistance;if(!i||i<0)return;const n=t.particles.quadTree.queryCircle(o,i,(t=>this.isEnabled(t)));for(const s of n){const n=s.getPosition(),a=(0,r.getDistance)(n,o);if(a>i)continue;const l=e.modes.grab.links,d=l.opacity,p=d-a*d/i;if(p<=0)continue;const b=l.color??s.options.links?.color;if(!t.particles.grabLineColor&&b){const o=e.modes.grab.links;t.particles.grabLineColor=(0,r.getLinkRandomColor)(this._engine,b,o.blink,o.consent)}const u=(0,r.getLinkColor)(s,void 0,t.particles.grabLineColor);u&&c(t,s,u,p,o)}}isEnabled(t){const e=this.container,o=e.interactivity.mouse,i=(t?.interactivity??e.actualOptions.interactivity).events;return i.onHover.enable&&!!o.position&&(0,r.isInArray)("grab",i.onHover.mode)}loadModeOptions(t,...e){t.grab||(t.grab=new a);for(const o of e)t.grab.load(o?.grab)}reset(){}}async function d(t,e=!0){(0,r.assertValidVersion)(t,"3.7.0"),await t.addInteractor("externalGrab",(e=>Promise.resolve(new l(e,t))),e)}return n})())); |
@@ -1,1 +0,1 @@ | ||
/*! tsParticles Grab External Interaction v3.6.0 by Matteo Bruni */ | ||
/*! tsParticles Grab External Interaction v3.7.0 by Matteo Bruni */ |
@@ -1,5 +0,6 @@ | ||
import { ExternalInteractorBase, type IModes, type Modes, type Particle, type RecursivePartial } from "@tsparticles/engine"; | ||
import { type Engine, ExternalInteractorBase, type IModes, type Modes, type Particle, type RecursivePartial } from "@tsparticles/engine"; | ||
import type { GrabContainer, GrabMode, IGrabMode } from "./Types.js"; | ||
export declare class Grabber extends ExternalInteractorBase<GrabContainer> { | ||
constructor(container: GrabContainer); | ||
private readonly _engine; | ||
constructor(container: GrabContainer, engine: Engine); | ||
clear(): void; | ||
@@ -6,0 +7,0 @@ init(): void; |
@@ -1,2 +0,2 @@ | ||
import type { Engine } from "@tsparticles/engine"; | ||
import { type Engine } from "@tsparticles/engine"; | ||
export declare function loadExternalGrabInteraction(engine: Engine, refresh?: boolean): Promise<void>; | ||
@@ -3,0 +3,0 @@ export * from "./Options/Classes/Grab.js"; |
@@ -18,4 +18,5 @@ (function (factory) { | ||
class Grabber extends engine_1.ExternalInteractorBase { | ||
constructor(container) { | ||
constructor(container, engine) { | ||
super(container); | ||
this._engine = engine; | ||
} | ||
@@ -59,3 +60,3 @@ clear() { | ||
const linksOptions = interactivity.modes.grab.links; | ||
container.particles.grabLineColor = (0, engine_1.getLinkRandomColor)(optColor, linksOptions.blink, linksOptions.consent); | ||
container.particles.grabLineColor = (0, engine_1.getLinkRandomColor)(this._engine, optColor, linksOptions.blink, linksOptions.consent); | ||
} | ||
@@ -62,0 +63,0 @@ const colorLine = (0, engine_1.getLinkColor)(particle, undefined, container.particles.grabLineColor); |
@@ -21,3 +21,3 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./Grabber.js", "./Options/Classes/Grab.js", "./Options/Classes/GrabLinks.js", "./Options/Interfaces/IGrab.js", "./Options/Interfaces/IGrabLinks.js"], factory); | ||
define(["require", "exports", "@tsparticles/engine", "./Grabber.js", "./Options/Classes/Grab.js", "./Options/Classes/GrabLinks.js", "./Options/Interfaces/IGrab.js", "./Options/Interfaces/IGrabLinks.js"], factory); | ||
} | ||
@@ -28,6 +28,8 @@ })(function (require, exports) { | ||
exports.loadExternalGrabInteraction = loadExternalGrabInteraction; | ||
const engine_1 = require("@tsparticles/engine"); | ||
const Grabber_js_1 = require("./Grabber.js"); | ||
async function loadExternalGrabInteraction(engine, refresh = true) { | ||
(0, engine_1.assertValidVersion)(engine, "3.7.0"); | ||
await engine.addInteractor("externalGrab", container => { | ||
return Promise.resolve(new Grabber_js_1.Grabber(container)); | ||
return Promise.resolve(new Grabber_js_1.Grabber(container, engine)); | ||
}, refresh); | ||
@@ -34,0 +36,0 @@ } |
Sorry, the diff of this file is not supported yet
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
331882
1001
+ Added@tsparticles/engine@3.7.0(transitive)
- Removed@tsparticles/engine@3.7.1(transitive)
Updated@tsparticles/engine@3.7.0