@tsparticles/interaction-external-bounce 3.0.0-beta.2 → 3.0.0-beta.4
Sign up to get free protection for your applications and to get access to all the features.
- package/browser/Bouncer.js +5 -4
- package/cjs/Bouncer.js +5 -4
- package/esm/Bouncer.js +5 -4
- package/package.json +3 -3
- package/report.html +4 -22
- package/tsparticles.interaction.external.bounce.js +5 -4
- package/tsparticles.interaction.external.bounce.min.js +1 -1
- package/tsparticles.interaction.external.bounce.min.js.LICENSE.txt +1 -1
- package/umd/Bouncer.js +5 -4
@@ -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.4
|
8
8
|
*/
|
9
9
|
(function webpackUniversalModuleDefinition(root, factory) {
|
10
10
|
if(typeof exports === 'object' && typeof module === 'object')
|
@@ -114,6 +114,7 @@ class Bounce {
|
|
114
114
|
;// CONCATENATED MODULE: ./dist/browser/Bouncer.js
|
115
115
|
|
116
116
|
|
117
|
+
const bounceMode = "bounce";
|
117
118
|
class Bouncer extends engine_root_window_.ExternalInteractorBase {
|
118
119
|
constructor(container) {
|
119
120
|
super(container);
|
@@ -181,10 +182,10 @@ class Bouncer extends engine_root_window_.ExternalInteractorBase {
|
|
181
182
|
hoverEnabled = events.onHover.enable,
|
182
183
|
hoverMode = events.onHover.mode,
|
183
184
|
divs = events.onDiv;
|
184
|
-
if (mouseMoveStatus && hoverEnabled && (0,engine_root_window_.isInArray)(
|
185
|
+
if (mouseMoveStatus && hoverEnabled && (0,engine_root_window_.isInArray)(bounceMode, hoverMode)) {
|
185
186
|
this._processMouseBounce();
|
186
187
|
} else {
|
187
|
-
(0,engine_root_window_.divModeExecute)(
|
188
|
+
(0,engine_root_window_.divModeExecute)(bounceMode, divs, (selector, div) => this._singleSelectorBounce(selector, div));
|
188
189
|
}
|
189
190
|
}
|
190
191
|
isEnabled(particle) {
|
@@ -193,7 +194,7 @@ class Bouncer extends engine_root_window_.ExternalInteractorBase {
|
|
193
194
|
mouse = container.interactivity.mouse,
|
194
195
|
events = (particle?.interactivity ?? options.interactivity).events,
|
195
196
|
divs = events.onDiv;
|
196
|
-
return mouse.position && events.onHover.enable && (0,engine_root_window_.isInArray)(
|
197
|
+
return mouse.position && events.onHover.enable && (0,engine_root_window_.isInArray)(bounceMode, events.onHover.mode) || (0,engine_root_window_.isDivModeEnabled)(bounceMode, divs);
|
197
198
|
}
|
198
199
|
loadModeOptions(options, ...sources) {
|
199
200
|
if (!options.bounce) {
|
@@ -1,2 +1,2 @@
|
|
1
1
|
/*! For license information please see tsparticles.interaction.external.bounce.min.js.LICENSE.txt */
|
2
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var o="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var n in o)("object"==typeof exports?exports:e)[n]=o[n]}}(this,(e=>(()=>{"use strict";var t={533:t=>{t.exports=e}},o={};function n(e){var i=o[e];if(void 0!==i)return i.exports;var r=o[e]={exports:{}};return t[e](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{n.r(i),n.d(i,{Bounce:()=>t,loadExternalBounceInteraction:()=>
|
2
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var o="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var n in o)("object"==typeof exports?exports:e)[n]=o[n]}}(this,(e=>(()=>{"use strict";var t={533:t=>{t.exports=e}},o={};function n(e){var i=o[e];if(void 0!==i)return i.exports;var r=o[e]={exports:{}};return t[e](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{n.r(i),n.d(i,{Bounce:()=>t,loadExternalBounceInteraction:()=>s});var e=n(533);class t{constructor(){this.distance=200}load(e){e&&void 0!==e.distance&&(this.distance=e.distance)}}const o="bounce";class r extends e.ExternalInteractorBase{constructor(t){super(t),this._processBounce=(t,o,n)=>{const i=this.container.particles.quadTree.query(n,(e=>this.isEnabled(e)));for(const r of i)n instanceof e.Circle?(0,e.circleBounce)((0,e.circleBounceDataFromParticle)(r),{position:t,radius:o,mass:o**2*Math.PI/2,velocity:e.Vector.origin,factor:e.Vector.origin}):n instanceof e.Rectangle&&(0,e.rectBounce)(r,(0,e.calculateBounds)(t,o))},this._processMouseBounce=()=>{const t=this.container,o=10*t.retina.pixelRatio,n=t.interactivity.mouse.position,i=t.retina.bounceModeDistance;!i||i<0||!n||this._processBounce(n,i,new e.Circle(n.x,n.y,i+o))},this._singleSelectorBounce=(t,o)=>{const n=this.container,i=document.querySelectorAll(t);i.length&&i.forEach((t=>{const i=t,r=n.retina.pixelRatio,s={x:(i.offsetLeft+i.offsetWidth/2)*r,y:(i.offsetTop+i.offsetHeight/2)*r},c=i.offsetWidth/2*r,a=10*r,u="circle"===o.type?new e.Circle(s.x,s.y,c+a):new e.Rectangle(i.offsetLeft*r-a,i.offsetTop*r-a,i.offsetWidth*r+2*a,i.offsetHeight*r+2*a);this._processBounce(s,c,u)}))}}clear(){}init(){const e=this.container,t=e.actualOptions.interactivity.modes.bounce;t&&(e.retina.bounceModeDistance=t.distance*e.retina.pixelRatio)}async interact(){const t=this.container,n=t.actualOptions.interactivity.events,i=t.interactivity.status===e.mouseMoveEvent,r=n.onHover.enable,s=n.onHover.mode,c=n.onDiv;i&&r&&(0,e.isInArray)(o,s)?this._processMouseBounce():(0,e.divModeExecute)(o,c,((e,t)=>this._singleSelectorBounce(e,t)))}isEnabled(t){const n=this.container,i=n.actualOptions,r=n.interactivity.mouse,s=(t?.interactivity??i.interactivity).events,c=s.onDiv;return r.position&&s.onHover.enable&&(0,e.isInArray)(o,s.onHover.mode)||(0,e.isDivModeEnabled)(o,c)}loadModeOptions(e,...o){e.bounce||(e.bounce=new t);for(const t of o)e.bounce.load(t?.bounce)}reset(){}}async function s(e,t=!0){await e.addInteractor("externalBounce",(e=>new r(e)),t)}})(),i})()));
|
@@ -1 +1 @@
|
|
1
|
-
/*! tsParticles Bounce External Interaction v3.0.0-beta.
|
1
|
+
/*! tsParticles Bounce External Interaction v3.0.0-beta.4 by Matteo Bruni */
|
package/umd/Bouncer.js
CHANGED
@@ -12,6 +12,7 @@
|
|
12
12
|
exports.Bouncer = void 0;
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
14
14
|
const Bounce_js_1 = require("./Options/Classes/Bounce.js");
|
15
|
+
const bounceMode = "bounce";
|
15
16
|
class Bouncer extends engine_1.ExternalInteractorBase {
|
16
17
|
constructor(container) {
|
17
18
|
super(container);
|
@@ -66,17 +67,17 @@
|
|
66
67
|
}
|
67
68
|
async interact() {
|
68
69
|
const container = this.container, options = container.actualOptions, events = options.interactivity.events, mouseMoveStatus = container.interactivity.status === engine_1.mouseMoveEvent, hoverEnabled = events.onHover.enable, hoverMode = events.onHover.mode, divs = events.onDiv;
|
69
|
-
if (mouseMoveStatus && hoverEnabled && (0, engine_1.isInArray)(
|
70
|
+
if (mouseMoveStatus && hoverEnabled && (0, engine_1.isInArray)(bounceMode, hoverMode)) {
|
70
71
|
this._processMouseBounce();
|
71
72
|
}
|
72
73
|
else {
|
73
|
-
(0, engine_1.divModeExecute)(
|
74
|
+
(0, engine_1.divModeExecute)(bounceMode, divs, (selector, div) => this._singleSelectorBounce(selector, div));
|
74
75
|
}
|
75
76
|
}
|
76
77
|
isEnabled(particle) {
|
77
78
|
const container = this.container, options = container.actualOptions, mouse = container.interactivity.mouse, events = (particle?.interactivity ?? options.interactivity).events, divs = events.onDiv;
|
78
|
-
return ((mouse.position && events.onHover.enable && (0, engine_1.isInArray)(
|
79
|
-
(0, engine_1.isDivModeEnabled)(
|
79
|
+
return ((mouse.position && events.onHover.enable && (0, engine_1.isInArray)(bounceMode, events.onHover.mode)) ||
|
80
|
+
(0, engine_1.isDivModeEnabled)(bounceMode, divs));
|
80
81
|
}
|
81
82
|
loadModeOptions(options, ...sources) {
|
82
83
|
if (!options.bounce) {
|