@tsparticles/interaction-external-grab 3.0.0-beta.3 → 3.0.0-beta.5
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/Grabber.js +2 -1
- package/browser/Options/Classes/Grab.js +1 -13
- package/cjs/Grabber.js +2 -1
- package/cjs/Options/Classes/Grab.js +1 -13
- package/esm/Grabber.js +2 -1
- package/esm/Options/Classes/Grab.js +1 -13
- package/package.json +3 -3
- package/report.html +4 -22
- package/tsparticles.interaction.external.grab.js +4 -15
- package/tsparticles.interaction.external.grab.min.js +1 -1
- package/tsparticles.interaction.external.grab.min.js.LICENSE.txt +1 -1
- package/types/Options/Classes/Grab.d.ts +0 -4
- package/types/Options/Interfaces/IGrab.d.ts +0 -2
- package/umd/Grabber.js +2 -1
- package/umd/Options/Classes/Grab.js +1 -13
|
@@ -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.0.0-beta.
|
|
7
|
+
* v3.0.0-beta.5
|
|
8
8
|
*/
|
|
9
9
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
10
10
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -131,18 +131,6 @@ class Grab {
|
|
|
131
131
|
this.distance = 100;
|
|
132
132
|
this.links = new GrabLinks();
|
|
133
133
|
}
|
|
134
|
-
get lineLinked() {
|
|
135
|
-
return this.links;
|
|
136
|
-
}
|
|
137
|
-
set lineLinked(value) {
|
|
138
|
-
this.links = value;
|
|
139
|
-
}
|
|
140
|
-
get line_linked() {
|
|
141
|
-
return this.links;
|
|
142
|
-
}
|
|
143
|
-
set line_linked(value) {
|
|
144
|
-
this.links = value;
|
|
145
|
-
}
|
|
146
134
|
load(data) {
|
|
147
135
|
if (!data) {
|
|
148
136
|
return;
|
|
@@ -150,7 +138,7 @@ class Grab {
|
|
|
150
138
|
if (data.distance !== undefined) {
|
|
151
139
|
this.distance = data.distance;
|
|
152
140
|
}
|
|
153
|
-
this.links.load(data.links
|
|
141
|
+
this.links.load(data.links);
|
|
154
142
|
}
|
|
155
143
|
}
|
|
156
144
|
;// CONCATENATED MODULE: ./dist/browser/Utils.js
|
|
@@ -171,6 +159,7 @@ function drawGrab(container, particle, lineColor, opacity, mousePos) {
|
|
|
171
159
|
|
|
172
160
|
|
|
173
161
|
|
|
162
|
+
const grabMode = "grab";
|
|
174
163
|
class Grabber extends engine_root_window_.ExternalInteractorBase {
|
|
175
164
|
constructor(container) {
|
|
176
165
|
super(container);
|
|
@@ -228,7 +217,7 @@ class Grabber extends engine_root_window_.ExternalInteractorBase {
|
|
|
228
217
|
const container = this.container,
|
|
229
218
|
mouse = container.interactivity.mouse,
|
|
230
219
|
events = (particle?.interactivity ?? container.actualOptions.interactivity).events;
|
|
231
|
-
return events.onHover.enable && !!mouse.position && (0,engine_root_window_.isInArray)(
|
|
220
|
+
return events.onHover.enable && !!mouse.position && (0,engine_root_window_.isInArray)(grabMode, events.onHover.mode);
|
|
232
221
|
}
|
|
233
222
|
loadModeOptions(options, ...sources) {
|
|
234
223
|
if (!options.grab) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.interaction.external.grab.min.js.LICENSE.txt */
|
|
2
|
-
!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
|
|
2
|
+
!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 @@
|
|
|
1
|
-
/*! tsParticles Grab External Interaction v3.0.0-beta.
|
|
1
|
+
/*! tsParticles Grab External Interaction v3.0.0-beta.5 by Matteo Bruni */
|
|
@@ -5,9 +5,5 @@ export declare class Grab implements IGrab, IOptionLoader<IGrab> {
|
|
|
5
5
|
distance: number;
|
|
6
6
|
links: GrabLinks;
|
|
7
7
|
constructor();
|
|
8
|
-
get lineLinked(): GrabLinks;
|
|
9
|
-
set lineLinked(value: GrabLinks);
|
|
10
|
-
get line_linked(): GrabLinks;
|
|
11
|
-
set line_linked(value: GrabLinks);
|
|
12
8
|
load(data?: RecursivePartial<IGrab>): void;
|
|
13
9
|
}
|
package/umd/Grabber.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
14
|
const Grab_js_1 = require("./Options/Classes/Grab.js");
|
|
15
15
|
const Utils_js_1 = require("./Utils.js");
|
|
16
|
+
const grabMode = "grab";
|
|
16
17
|
class Grabber extends engine_1.ExternalInteractorBase {
|
|
17
18
|
constructor(container) {
|
|
18
19
|
super(container);
|
|
@@ -65,7 +66,7 @@
|
|
|
65
66
|
}
|
|
66
67
|
isEnabled(particle) {
|
|
67
68
|
const container = this.container, mouse = container.interactivity.mouse, events = (particle?.interactivity ?? container.actualOptions.interactivity).events;
|
|
68
|
-
return events.onHover.enable && !!mouse.position && (0, engine_1.isInArray)(
|
|
69
|
+
return events.onHover.enable && !!mouse.position && (0, engine_1.isInArray)(grabMode, events.onHover.mode);
|
|
69
70
|
}
|
|
70
71
|
loadModeOptions(options, ...sources) {
|
|
71
72
|
if (!options.grab) {
|
|
@@ -16,18 +16,6 @@
|
|
|
16
16
|
this.distance = 100;
|
|
17
17
|
this.links = new GrabLinks_js_1.GrabLinks();
|
|
18
18
|
}
|
|
19
|
-
get lineLinked() {
|
|
20
|
-
return this.links;
|
|
21
|
-
}
|
|
22
|
-
set lineLinked(value) {
|
|
23
|
-
this.links = value;
|
|
24
|
-
}
|
|
25
|
-
get line_linked() {
|
|
26
|
-
return this.links;
|
|
27
|
-
}
|
|
28
|
-
set line_linked(value) {
|
|
29
|
-
this.links = value;
|
|
30
|
-
}
|
|
31
19
|
load(data) {
|
|
32
20
|
if (!data) {
|
|
33
21
|
return;
|
|
@@ -35,7 +23,7 @@
|
|
|
35
23
|
if (data.distance !== undefined) {
|
|
36
24
|
this.distance = data.distance;
|
|
37
25
|
}
|
|
38
|
-
this.links.load(data.links
|
|
26
|
+
this.links.load(data.links);
|
|
39
27
|
}
|
|
40
28
|
}
|
|
41
29
|
exports.Grab = Grab;
|