@tsparticles/interaction-external-bounce 3.0.0-alpha.0 → 3.0.0-beta.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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-alpha.0
7
+ * v3.0.0-beta.0
8
8
  */
9
9
  (function webpackUniversalModuleDefinition(root, factory) {
10
10
  if(typeof exports === 'object' && typeof module === 'object')
@@ -91,8 +91,8 @@ __webpack_require__.r(__webpack_exports__);
91
91
 
92
92
  // EXPORTS
93
93
  __webpack_require__.d(__webpack_exports__, {
94
- "Bounce": () => (/* reexport */ Bounce),
95
- "loadExternalBounceInteraction": () => (/* binding */ loadExternalBounceInteraction)
94
+ Bounce: () => (/* reexport */ Bounce),
95
+ loadExternalBounceInteraction: () => (/* binding */ loadExternalBounceInteraction)
96
96
  });
97
97
 
98
98
  // EXTERNAL MODULE: external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"}
@@ -117,6 +117,52 @@ class Bounce {
117
117
  class Bouncer extends engine_root_window_.ExternalInteractorBase {
118
118
  constructor(container) {
119
119
  super(container);
120
+ this._processBounce = (position, radius, area) => {
121
+ const query = this.container.particles.quadTree.query(area, p => this.isEnabled(p));
122
+ for (const particle of query) {
123
+ if (area instanceof engine_root_window_.Circle) {
124
+ (0,engine_root_window_.circleBounce)((0,engine_root_window_.circleBounceDataFromParticle)(particle), {
125
+ position,
126
+ radius,
127
+ mass: radius ** 2 * Math.PI / 2,
128
+ velocity: engine_root_window_.Vector.origin,
129
+ factor: engine_root_window_.Vector.origin
130
+ });
131
+ } else if (area instanceof engine_root_window_.Rectangle) {
132
+ (0,engine_root_window_.rectBounce)(particle, (0,engine_root_window_.calculateBounds)(position, radius));
133
+ }
134
+ }
135
+ };
136
+ this._processMouseBounce = () => {
137
+ const container = this.container,
138
+ pxRatio = container.retina.pixelRatio,
139
+ tolerance = 10 * pxRatio,
140
+ mousePos = container.interactivity.mouse.position,
141
+ radius = container.retina.bounceModeDistance;
142
+ if (!radius || radius < 0 || !mousePos) {
143
+ return;
144
+ }
145
+ this._processBounce(mousePos, radius, new engine_root_window_.Circle(mousePos.x, mousePos.y, radius + tolerance));
146
+ };
147
+ this._singleSelectorBounce = (selector, div) => {
148
+ const container = this.container,
149
+ query = document.querySelectorAll(selector);
150
+ if (!query.length) {
151
+ return;
152
+ }
153
+ query.forEach(item => {
154
+ const elem = item,
155
+ pxRatio = container.retina.pixelRatio,
156
+ pos = {
157
+ x: (elem.offsetLeft + elem.offsetWidth / 2) * pxRatio,
158
+ y: (elem.offsetTop + elem.offsetHeight / 2) * pxRatio
159
+ },
160
+ radius = elem.offsetWidth / 2 * pxRatio,
161
+ tolerance = 10 * pxRatio,
162
+ area = div.type === "circle" ? new engine_root_window_.Circle(pos.x, pos.y, radius + tolerance) : new engine_root_window_.Rectangle(elem.offsetLeft * pxRatio - tolerance, elem.offsetTop * pxRatio - tolerance, elem.offsetWidth * pxRatio + tolerance * 2, elem.offsetHeight * pxRatio + tolerance * 2);
163
+ this._processBounce(pos, radius, area);
164
+ });
165
+ };
120
166
  }
121
167
  clear() {}
122
168
  init() {
@@ -136,17 +182,16 @@ class Bouncer extends engine_root_window_.ExternalInteractorBase {
136
182
  hoverMode = events.onHover.mode,
137
183
  divs = events.onDiv;
138
184
  if (mouseMoveStatus && hoverEnabled && (0,engine_root_window_.isInArray)("bounce", hoverMode)) {
139
- this.processMouseBounce();
185
+ this._processMouseBounce();
140
186
  } else {
141
- (0,engine_root_window_.divModeExecute)("bounce", divs, (selector, div) => this.singleSelectorBounce(selector, div));
187
+ (0,engine_root_window_.divModeExecute)("bounce", divs, (selector, div) => this._singleSelectorBounce(selector, div));
142
188
  }
143
189
  }
144
190
  isEnabled(particle) {
145
- var _a;
146
191
  const container = this.container,
147
192
  options = container.actualOptions,
148
193
  mouse = container.interactivity.mouse,
149
- events = ((_a = particle === null || particle === void 0 ? void 0 : particle.interactivity) !== null && _a !== void 0 ? _a : options.interactivity).events,
194
+ events = (particle?.interactivity ?? options.interactivity).events,
150
195
  divs = events.onDiv;
151
196
  return mouse.position && events.onHover.enable && (0,engine_root_window_.isInArray)("bounce", events.onHover.mode) || (0,engine_root_window_.isDivModeEnabled)("bounce", divs);
152
197
  }
@@ -155,61 +200,15 @@ class Bouncer extends engine_root_window_.ExternalInteractorBase {
155
200
  options.bounce = new Bounce();
156
201
  }
157
202
  for (const source of sources) {
158
- options.bounce.load(source === null || source === void 0 ? void 0 : source.bounce);
203
+ options.bounce.load(source?.bounce);
159
204
  }
160
205
  }
161
206
  reset() {}
162
- processBounce(position, radius, area) {
163
- const query = this.container.particles.quadTree.query(area, p => this.isEnabled(p));
164
- for (const particle of query) {
165
- if (area instanceof engine_root_window_.Circle) {
166
- (0,engine_root_window_.circleBounce)((0,engine_root_window_.circleBounceDataFromParticle)(particle), {
167
- position,
168
- radius,
169
- mass: radius ** 2 * Math.PI / 2,
170
- velocity: engine_root_window_.Vector.origin,
171
- factor: engine_root_window_.Vector.origin
172
- });
173
- } else if (area instanceof engine_root_window_.Rectangle) {
174
- (0,engine_root_window_.rectBounce)(particle, (0,engine_root_window_.calculateBounds)(position, radius));
175
- }
176
- }
177
- }
178
- processMouseBounce() {
179
- const container = this.container,
180
- pxRatio = container.retina.pixelRatio,
181
- tolerance = 10 * pxRatio,
182
- mousePos = container.interactivity.mouse.position,
183
- radius = container.retina.bounceModeDistance;
184
- if (!radius || radius < 0 || !mousePos) {
185
- return;
186
- }
187
- this.processBounce(mousePos, radius, new engine_root_window_.Circle(mousePos.x, mousePos.y, radius + tolerance));
188
- }
189
- singleSelectorBounce(selector, div) {
190
- const container = this.container,
191
- query = document.querySelectorAll(selector);
192
- if (!query.length) {
193
- return;
194
- }
195
- query.forEach(item => {
196
- const elem = item,
197
- pxRatio = container.retina.pixelRatio,
198
- pos = {
199
- x: (elem.offsetLeft + elem.offsetWidth / 2) * pxRatio,
200
- y: (elem.offsetTop + elem.offsetHeight / 2) * pxRatio
201
- },
202
- radius = elem.offsetWidth / 2 * pxRatio,
203
- tolerance = 10 * pxRatio,
204
- area = div.type === "circle" ? new engine_root_window_.Circle(pos.x, pos.y, radius + tolerance) : new engine_root_window_.Rectangle(elem.offsetLeft * pxRatio - tolerance, elem.offsetTop * pxRatio - tolerance, elem.offsetWidth * pxRatio + tolerance * 2, elem.offsetHeight * pxRatio + tolerance * 2);
205
- this.processBounce(pos, radius, area);
206
- });
207
- }
208
207
  }
209
208
  ;// CONCATENATED MODULE: ./dist/browser/index.js
210
209
 
211
- async function loadExternalBounceInteraction(engine) {
212
- await engine.addInteractor("externalBounce", container => new Bouncer(container));
210
+ async function loadExternalBounceInteraction(engine, refresh = true) {
211
+ await engine.addInteractor("externalBounce", container => new Bouncer(container), refresh);
213
212
  }
214
213
 
215
214
 
@@ -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:()=>r});var e=n(533);class t{constructor(){this.distance=200}load(e){e&&void 0!==e.distance&&(this.distance=e.distance)}}class o extends e.ExternalInteractorBase{constructor(e){super(e)}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,o=t.actualOptions.interactivity.events,n=t.interactivity.status===e.mouseMoveEvent,i=o.onHover.enable,r=o.onHover.mode,c=o.onDiv;n&&i&&(0,e.isInArray)("bounce",r)?this.processMouseBounce():(0,e.divModeExecute)("bounce",c,((e,t)=>this.singleSelectorBounce(e,t)))}isEnabled(t){var o;const n=this.container,i=n.actualOptions,r=n.interactivity.mouse,c=(null!==(o=null==t?void 0:t.interactivity)&&void 0!==o?o:i.interactivity).events,s=c.onDiv;return r.position&&c.onHover.enable&&(0,e.isInArray)("bounce",c.onHover.mode)||(0,e.isDivModeEnabled)("bounce",s)}loadModeOptions(e,...o){e.bounce||(e.bounce=new t);for(const t of o)e.bounce.load(null==t?void 0:t.bounce)}reset(){}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))}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))}singleSelectorBounce(t,o){const n=this.container,i=document.querySelectorAll(t);i.length&&i.forEach((t=>{const i=t,r=n.retina.pixelRatio,c={x:(i.offsetLeft+i.offsetWidth/2)*r,y:(i.offsetTop+i.offsetHeight/2)*r},s=i.offsetWidth/2*r,a=10*r,u="circle"===o.type?new e.Circle(c.x,c.y,s+a):new e.Rectangle(i.offsetLeft*r-a,i.offsetTop*r-a,i.offsetWidth*r+2*a,i.offsetHeight*r+2*a);this.processBounce(c,s,u)}))}}async function r(e){await e.addInteractor("externalBounce",(e=>new o(e)))}})(),i})()));
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:()=>r});var e=n(533);class t{constructor(){this.distance=200}load(e){e&&void 0!==e.distance&&(this.distance=e.distance)}}class o 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,c={x:(i.offsetLeft+i.offsetWidth/2)*r,y:(i.offsetTop+i.offsetHeight/2)*r},s=i.offsetWidth/2*r,a=10*r,u="circle"===o.type?new e.Circle(c.x,c.y,s+a):new e.Rectangle(i.offsetLeft*r-a,i.offsetTop*r-a,i.offsetWidth*r+2*a,i.offsetHeight*r+2*a);this._processBounce(c,s,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,o=t.actualOptions.interactivity.events,n=t.interactivity.status===e.mouseMoveEvent,i=o.onHover.enable,r=o.onHover.mode,c=o.onDiv;n&&i&&(0,e.isInArray)("bounce",r)?this._processMouseBounce():(0,e.divModeExecute)("bounce",c,((e,t)=>this._singleSelectorBounce(e,t)))}isEnabled(t){const o=this.container,n=o.actualOptions,i=o.interactivity.mouse,r=(t?.interactivity??n.interactivity).events,c=r.onDiv;return i.position&&r.onHover.enable&&(0,e.isInArray)("bounce",r.onHover.mode)||(0,e.isDivModeEnabled)("bounce",c)}loadModeOptions(e,...o){e.bounce||(e.bounce=new t);for(const t of o)e.bounce.load(t?.bounce)}reset(){}}async function r(e,t=!0){await e.addInteractor("externalBounce",(e=>new o(e)),t)}})(),i})()));
@@ -1,8 +1 @@
1
- /*!
2
- * Author : Matteo Bruni
3
- * MIT license: https://opensource.org/licenses/MIT
4
- * Demo / Generator : https://particles.js.org/
5
- * GitHub : https://www.github.com/matteobruni/tsparticles
6
- * How to use? : Check the GitHub README
7
- * v3.0.0-alpha.0
8
- */
1
+ /*! tsParticles Bounce External Interaction v3.0.0-beta.0 by Matteo Bruni */
@@ -1,6 +1,5 @@
1
1
  import type { BounceContainer, BounceMode, IBounceMode } from "./Types";
2
- import { ExternalInteractorBase } from "@tsparticles/engine";
3
- import type { IModes, Modes, Particle, RecursivePartial } from "@tsparticles/engine";
2
+ import { ExternalInteractorBase, type IModes, type Modes, type Particle, type RecursivePartial } from "@tsparticles/engine";
4
3
  export declare class Bouncer extends ExternalInteractorBase<BounceContainer> {
5
4
  constructor(container: BounceContainer);
6
5
  clear(): void;
@@ -9,7 +8,7 @@ export declare class Bouncer extends ExternalInteractorBase<BounceContainer> {
9
8
  isEnabled(particle?: Particle): boolean;
10
9
  loadModeOptions(options: Modes & BounceMode, ...sources: RecursivePartial<(IModes & IBounceMode) | undefined>[]): void;
11
10
  reset(): void;
12
- private processBounce;
13
- private processMouseBounce;
14
- private singleSelectorBounce;
11
+ private readonly _processBounce;
12
+ private readonly _processMouseBounce;
13
+ private readonly _singleSelectorBounce;
15
14
  }
package/types/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import type { Engine } from "@tsparticles/engine";
2
- export declare function loadExternalBounceInteraction(engine: Engine): Promise<void>;
2
+ export declare function loadExternalBounceInteraction(engine: Engine, refresh?: boolean): Promise<void>;
3
3
  export * from "./Options/Classes/Bounce";
4
4
  export * from "./Options/Interfaces/IBounce";
package/umd/Bouncer.js CHANGED
@@ -15,6 +15,45 @@
15
15
  class Bouncer extends engine_1.ExternalInteractorBase {
16
16
  constructor(container) {
17
17
  super(container);
18
+ this._processBounce = (position, radius, area) => {
19
+ const query = this.container.particles.quadTree.query(area, (p) => this.isEnabled(p));
20
+ for (const particle of query) {
21
+ if (area instanceof engine_1.Circle) {
22
+ (0, engine_1.circleBounce)((0, engine_1.circleBounceDataFromParticle)(particle), {
23
+ position,
24
+ radius,
25
+ mass: (radius ** 2 * Math.PI) / 2,
26
+ velocity: engine_1.Vector.origin,
27
+ factor: engine_1.Vector.origin,
28
+ });
29
+ }
30
+ else if (area instanceof engine_1.Rectangle) {
31
+ (0, engine_1.rectBounce)(particle, (0, engine_1.calculateBounds)(position, radius));
32
+ }
33
+ }
34
+ };
35
+ this._processMouseBounce = () => {
36
+ const container = this.container, pxRatio = container.retina.pixelRatio, tolerance = 10 * pxRatio, mousePos = container.interactivity.mouse.position, radius = container.retina.bounceModeDistance;
37
+ if (!radius || radius < 0 || !mousePos) {
38
+ return;
39
+ }
40
+ this._processBounce(mousePos, radius, new engine_1.Circle(mousePos.x, mousePos.y, radius + tolerance));
41
+ };
42
+ this._singleSelectorBounce = (selector, div) => {
43
+ const container = this.container, query = document.querySelectorAll(selector);
44
+ if (!query.length) {
45
+ return;
46
+ }
47
+ query.forEach((item) => {
48
+ const elem = item, pxRatio = container.retina.pixelRatio, pos = {
49
+ x: (elem.offsetLeft + elem.offsetWidth / 2) * pxRatio,
50
+ y: (elem.offsetTop + elem.offsetHeight / 2) * pxRatio,
51
+ }, radius = (elem.offsetWidth / 2) * pxRatio, tolerance = 10 * pxRatio, area = div.type === "circle"
52
+ ? new engine_1.Circle(pos.x, pos.y, radius + tolerance)
53
+ : new engine_1.Rectangle(elem.offsetLeft * pxRatio - tolerance, elem.offsetTop * pxRatio - tolerance, elem.offsetWidth * pxRatio + tolerance * 2, elem.offsetHeight * pxRatio + tolerance * 2);
54
+ this._processBounce(pos, radius, area);
55
+ });
56
+ };
18
57
  }
19
58
  clear() {
20
59
  }
@@ -28,15 +67,14 @@
28
67
  async interact() {
29
68
  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;
30
69
  if (mouseMoveStatus && hoverEnabled && (0, engine_1.isInArray)("bounce", hoverMode)) {
31
- this.processMouseBounce();
70
+ this._processMouseBounce();
32
71
  }
33
72
  else {
34
- (0, engine_1.divModeExecute)("bounce", divs, (selector, div) => this.singleSelectorBounce(selector, div));
73
+ (0, engine_1.divModeExecute)("bounce", divs, (selector, div) => this._singleSelectorBounce(selector, div));
35
74
  }
36
75
  }
37
76
  isEnabled(particle) {
38
- var _a;
39
- const container = this.container, options = container.actualOptions, mouse = container.interactivity.mouse, events = ((_a = particle === null || particle === void 0 ? void 0 : particle.interactivity) !== null && _a !== void 0 ? _a : options.interactivity).events, divs = events.onDiv;
77
+ const container = this.container, options = container.actualOptions, mouse = container.interactivity.mouse, events = (particle?.interactivity ?? options.interactivity).events, divs = events.onDiv;
40
78
  return ((mouse.position && events.onHover.enable && (0, engine_1.isInArray)("bounce", events.onHover.mode)) ||
41
79
  (0, engine_1.isDivModeEnabled)("bounce", divs));
42
80
  }
@@ -45,50 +83,11 @@
45
83
  options.bounce = new Bounce_1.Bounce();
46
84
  }
47
85
  for (const source of sources) {
48
- options.bounce.load(source === null || source === void 0 ? void 0 : source.bounce);
86
+ options.bounce.load(source?.bounce);
49
87
  }
50
88
  }
51
89
  reset() {
52
90
  }
53
- processBounce(position, radius, area) {
54
- const query = this.container.particles.quadTree.query(area, (p) => this.isEnabled(p));
55
- for (const particle of query) {
56
- if (area instanceof engine_1.Circle) {
57
- (0, engine_1.circleBounce)((0, engine_1.circleBounceDataFromParticle)(particle), {
58
- position,
59
- radius,
60
- mass: (radius ** 2 * Math.PI) / 2,
61
- velocity: engine_1.Vector.origin,
62
- factor: engine_1.Vector.origin,
63
- });
64
- }
65
- else if (area instanceof engine_1.Rectangle) {
66
- (0, engine_1.rectBounce)(particle, (0, engine_1.calculateBounds)(position, radius));
67
- }
68
- }
69
- }
70
- processMouseBounce() {
71
- const container = this.container, pxRatio = container.retina.pixelRatio, tolerance = 10 * pxRatio, mousePos = container.interactivity.mouse.position, radius = container.retina.bounceModeDistance;
72
- if (!radius || radius < 0 || !mousePos) {
73
- return;
74
- }
75
- this.processBounce(mousePos, radius, new engine_1.Circle(mousePos.x, mousePos.y, radius + tolerance));
76
- }
77
- singleSelectorBounce(selector, div) {
78
- const container = this.container, query = document.querySelectorAll(selector);
79
- if (!query.length) {
80
- return;
81
- }
82
- query.forEach((item) => {
83
- const elem = item, pxRatio = container.retina.pixelRatio, pos = {
84
- x: (elem.offsetLeft + elem.offsetWidth / 2) * pxRatio,
85
- y: (elem.offsetTop + elem.offsetHeight / 2) * pxRatio,
86
- }, radius = (elem.offsetWidth / 2) * pxRatio, tolerance = 10 * pxRatio, area = div.type === "circle"
87
- ? new engine_1.Circle(pos.x, pos.y, radius + tolerance)
88
- : new engine_1.Rectangle(elem.offsetLeft * pxRatio - tolerance, elem.offsetTop * pxRatio - tolerance, elem.offsetWidth * pxRatio + tolerance * 2, elem.offsetHeight * pxRatio + tolerance * 2);
89
- this.processBounce(pos, radius, area);
90
- });
91
- }
92
91
  }
93
92
  exports.Bouncer = Bouncer;
94
93
  });
package/umd/index.js CHANGED
@@ -25,8 +25,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.loadExternalBounceInteraction = void 0;
27
27
  const Bouncer_1 = require("./Bouncer");
28
- async function loadExternalBounceInteraction(engine) {
29
- await engine.addInteractor("externalBounce", (container) => new Bouncer_1.Bouncer(container));
28
+ async function loadExternalBounceInteraction(engine, refresh = true) {
29
+ await engine.addInteractor("externalBounce", (container) => new Bouncer_1.Bouncer(container), refresh);
30
30
  }
31
31
  exports.loadExternalBounceInteraction = loadExternalBounceInteraction;
32
32
  __exportStar(require("./Options/Classes/Bounce"), exports);