@tsparticles/interaction-external-repulse 3.9.0 → 4.0.0-alpha.0
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/176.min.js +2 -0
- package/176.min.js.LICENSE.txt +1 -0
- package/browser/Repulser.js +9 -15
- package/browser/index.js +8 -9
- package/cjs/Options/Classes/Repulse.js +7 -11
- package/cjs/Options/Classes/RepulseBase.js +4 -8
- package/cjs/Options/Classes/RepulseDiv.js +4 -8
- package/cjs/Options/Classes/RepulseOptions.js +1 -2
- package/cjs/Options/Interfaces/IRepulse.js +1 -2
- package/cjs/Options/Interfaces/IRepulseBase.js +1 -2
- package/cjs/Options/Interfaces/IRepulseDiv.js +1 -2
- package/cjs/Repulser.js +25 -35
- package/cjs/Types.js +1 -2
- package/cjs/index.js +11 -29
- package/dist_browser_Repulser_js.js +30 -0
- package/esm/Repulser.js +9 -15
- package/esm/index.js +8 -9
- package/package.json +4 -3
- package/report.html +5 -4
- package/tsparticles.interaction.external.repulse.js +221 -42
- package/tsparticles.interaction.external.repulse.min.js +1 -1
- package/tsparticles.interaction.external.repulse.min.js.LICENSE.txt +1 -1
- package/types/index.d.ts +4 -4
- package/umd/Repulser.js +8 -14
- package/umd/index.js +32 -10
|
@@ -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
|
-
*
|
|
7
|
+
* v4.0.0-alpha.0
|
|
8
8
|
*/
|
|
9
9
|
/*
|
|
10
10
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
@@ -28,65 +28,55 @@ return /******/ (() => { // webpackBootstrap
|
|
|
28
28
|
/******/ "use strict";
|
|
29
29
|
/******/ var __webpack_modules__ = ({
|
|
30
30
|
|
|
31
|
-
/***/ "./dist/browser/Options/Classes/Repulse.js"
|
|
31
|
+
/***/ "./dist/browser/Options/Classes/Repulse.js"
|
|
32
32
|
/*!*************************************************!*\
|
|
33
33
|
!*** ./dist/browser/Options/Classes/Repulse.js ***!
|
|
34
34
|
\*************************************************/
|
|
35
|
-
|
|
35
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
36
36
|
|
|
37
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Repulse: () => (/* binding */ Repulse)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var
|
|
37
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Repulse: () => (/* binding */ Repulse)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _RepulseBase_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./RepulseBase.js */ \"./dist/browser/Options/Classes/RepulseBase.js\");\n/* harmony import */ var _RepulseDiv_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./RepulseDiv.js */ \"./dist/browser/Options/Classes/RepulseDiv.js\");\n\n\n\nclass Repulse extends _RepulseBase_js__WEBPACK_IMPORTED_MODULE_1__.RepulseBase {\n load(data) {\n super.load(data);\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n this.divs = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.executeOnSingleOrMultiple)(data.divs, div => {\n const tmp = new _RepulseDiv_js__WEBPACK_IMPORTED_MODULE_2__.RepulseDiv();\n tmp.load(div);\n return tmp;\n });\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-repulse/./dist/browser/Options/Classes/Repulse.js?\n}");
|
|
38
38
|
|
|
39
|
-
/***/ }
|
|
39
|
+
/***/ },
|
|
40
40
|
|
|
41
|
-
/***/ "./dist/browser/Options/Classes/RepulseBase.js"
|
|
41
|
+
/***/ "./dist/browser/Options/Classes/RepulseBase.js"
|
|
42
42
|
/*!*****************************************************!*\
|
|
43
43
|
!*** ./dist/browser/Options/Classes/RepulseBase.js ***!
|
|
44
44
|
\*****************************************************/
|
|
45
|
-
|
|
45
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
46
46
|
|
|
47
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RepulseBase: () => (/* binding */ RepulseBase)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n
|
|
47
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RepulseBase: () => (/* binding */ RepulseBase)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass RepulseBase {\n constructor() {\n this.distance = 200;\n this.duration = 0.4;\n this.factor = 100;\n this.speed = 1;\n this.maxSpeed = 50;\n this.easing = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.EasingType.easeOutQuad;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.distance !== undefined) {\n this.distance = data.distance;\n }\n if (data.duration !== undefined) {\n this.duration = data.duration;\n }\n if (data.easing !== undefined) {\n this.easing = data.easing;\n }\n if (data.factor !== undefined) {\n this.factor = data.factor;\n }\n if (data.speed !== undefined) {\n this.speed = data.speed;\n }\n if (data.maxSpeed !== undefined) {\n this.maxSpeed = data.maxSpeed;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-repulse/./dist/browser/Options/Classes/RepulseBase.js?\n}");
|
|
48
48
|
|
|
49
|
-
/***/ }
|
|
49
|
+
/***/ },
|
|
50
50
|
|
|
51
|
-
/***/ "./dist/browser/Options/Classes/RepulseDiv.js"
|
|
51
|
+
/***/ "./dist/browser/Options/Classes/RepulseDiv.js"
|
|
52
52
|
/*!****************************************************!*\
|
|
53
53
|
!*** ./dist/browser/Options/Classes/RepulseDiv.js ***!
|
|
54
54
|
\****************************************************/
|
|
55
|
-
|
|
55
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
56
56
|
|
|
57
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RepulseDiv: () => (/* binding */ RepulseDiv)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var
|
|
57
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RepulseDiv: () => (/* binding */ RepulseDiv)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _RepulseBase_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./RepulseBase.js */ \"./dist/browser/Options/Classes/RepulseBase.js\");\n\n\nclass RepulseDiv extends _RepulseBase_js__WEBPACK_IMPORTED_MODULE_1__.RepulseBase {\n constructor() {\n super();\n this.selectors = [];\n }\n load(data) {\n super.load(data);\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.selectors !== undefined) {\n this.selectors = data.selectors;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-repulse/./dist/browser/Options/Classes/RepulseDiv.js?\n}");
|
|
58
58
|
|
|
59
|
-
/***/ }
|
|
59
|
+
/***/ },
|
|
60
60
|
|
|
61
|
-
/***/ "./dist/browser/
|
|
62
|
-
/*!**********************************!*\
|
|
63
|
-
!*** ./dist/browser/Repulser.js ***!
|
|
64
|
-
\**********************************/
|
|
65
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
66
|
-
|
|
67
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Repulser: () => (/* binding */ Repulser)\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_Repulse_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/Repulse.js */ \"./dist/browser/Options/Classes/Repulse.js\");\n\n\nconst repulseMode = \"repulse\",\n minDistance = 0,\n repulseRadiusFactor = 6,\n repulseRadiusPower = 3,\n squarePower = 2,\n minRadius = 0,\n minSpeed = 0,\n easingOffset = 1,\n half = 0.5;\nclass Repulser extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ExternalInteractorBase {\n constructor(engine, container) {\n super(container);\n this._clickRepulse = () => {\n const container = this.container,\n repulseOptions = container.actualOptions.interactivity.modes.repulse;\n if (!repulseOptions) {\n return;\n }\n const repulse = container.repulse ?? {\n particles: []\n };\n if (!repulse.finish) {\n if (!repulse.count) {\n repulse.count = 0;\n }\n repulse.count++;\n if (repulse.count === container.particles.count) {\n repulse.finish = true;\n }\n }\n if (repulse.clicking) {\n const repulseDistance = container.retina.repulseModeDistance;\n if (!repulseDistance || repulseDistance < minDistance) {\n return;\n }\n const repulseRadius = Math.pow(repulseDistance / repulseRadiusFactor, repulseRadiusPower),\n mouseClickPos = container.interactivity.mouse.clickPosition;\n if (mouseClickPos === undefined) {\n return;\n }\n const range = new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Circle(mouseClickPos.x, mouseClickPos.y, repulseRadius),\n query = container.particles.quadTree.query(range, p => this.isEnabled(p));\n for (const particle of query) {\n const {\n dx,\n dy,\n distance\n } = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistances)(mouseClickPos, particle.position),\n d = distance ** squarePower,\n velocity = repulseOptions.speed,\n force = -repulseRadius * velocity / d;\n if (d <= repulseRadius) {\n repulse.particles.push(particle);\n const vect = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.create(dx, dy);\n vect.length = force;\n particle.velocity.setTo(vect);\n }\n }\n } else if (repulse.clicking === false) {\n for (const particle of repulse.particles) {\n particle.velocity.setTo(particle.initialVelocity);\n }\n repulse.particles = [];\n }\n };\n this._hoverRepulse = () => {\n const container = this.container,\n mousePos = container.interactivity.mouse.position,\n repulseRadius = container.retina.repulseModeDistance;\n if (!repulseRadius || repulseRadius < minRadius || !mousePos) {\n return;\n }\n this._processRepulse(mousePos, repulseRadius, new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Circle(mousePos.x, mousePos.y, repulseRadius));\n };\n this._processRepulse = (position, repulseRadius, area, divRepulse) => {\n const container = this.container,\n query = container.particles.quadTree.query(area, p => this.isEnabled(p)),\n repulseOptions = container.actualOptions.interactivity.modes.repulse;\n if (!repulseOptions) {\n return;\n }\n const {\n easing,\n speed,\n factor,\n maxSpeed\n } = repulseOptions,\n easingFunc = this._engine.getEasing(easing),\n velocity = (divRepulse?.speed ?? speed) * factor;\n for (const particle of query) {\n const {\n dx,\n dy,\n distance\n } = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getDistances)(particle.position, position),\n repulseFactor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.clamp)(easingFunc(easingOffset - distance / repulseRadius) * velocity, minSpeed, maxSpeed),\n normVec = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.create(!distance ? velocity : dx / distance * repulseFactor, !distance ? velocity : dy / distance * repulseFactor);\n particle.position.addTo(normVec);\n }\n };\n this._singleSelectorRepulse = (selector, div) => {\n const container = this.container,\n repulse = container.actualOptions.interactivity.modes.repulse;\n if (!repulse) {\n return;\n }\n const query = document.querySelectorAll(selector);\n if (!query.length) {\n return;\n }\n query.forEach(item => {\n const elem = item,\n pxRatio = container.retina.pixelRatio,\n pos = {\n x: (elem.offsetLeft + elem.offsetWidth * half) * pxRatio,\n y: (elem.offsetTop + elem.offsetHeight * half) * pxRatio\n },\n repulseRadius = elem.offsetWidth * half * pxRatio,\n area = div.type === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.DivType.circle ? new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Circle(pos.x, pos.y, repulseRadius) : new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Rectangle(elem.offsetLeft * pxRatio, elem.offsetTop * pxRatio, elem.offsetWidth * pxRatio, elem.offsetHeight * pxRatio),\n divs = repulse.divs,\n divRepulse = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.divMode)(divs, elem);\n this._processRepulse(pos, repulseRadius, area, divRepulse);\n });\n };\n this._engine = engine;\n if (!container.repulse) {\n container.repulse = {\n particles: []\n };\n }\n this.handleClickMode = mode => {\n const options = this.container.actualOptions,\n repulseOpts = options.interactivity.modes.repulse;\n if (!repulseOpts || mode !== repulseMode) {\n return;\n }\n if (!container.repulse) {\n container.repulse = {\n particles: []\n };\n }\n const repulse = container.repulse;\n repulse.clicking = true;\n repulse.count = 0;\n for (const particle of container.repulse.particles) {\n if (!this.isEnabled(particle)) {\n continue;\n }\n particle.velocity.setTo(particle.initialVelocity);\n }\n repulse.particles = [];\n repulse.finish = false;\n setTimeout(() => {\n if (container.destroyed) {\n return;\n }\n repulse.clicking = false;\n }, repulseOpts.duration * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.millisecondsToSeconds);\n };\n }\n clear() {}\n init() {\n const container = this.container,\n repulse = container.actualOptions.interactivity.modes.repulse;\n if (!repulse) {\n return;\n }\n container.retina.repulseModeDistance = repulse.distance * container.retina.pixelRatio;\n }\n interact() {\n const container = this.container,\n options = container.actualOptions,\n mouseMoveStatus = container.interactivity.status === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.mouseMoveEvent,\n events = options.interactivity.events,\n hover = events.onHover,\n hoverEnabled = hover.enable,\n hoverMode = hover.mode,\n click = events.onClick,\n clickEnabled = click.enable,\n clickMode = click.mode,\n divs = events.onDiv;\n if (mouseMoveStatus && hoverEnabled && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(repulseMode, hoverMode)) {\n this._hoverRepulse();\n } else if (clickEnabled && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(repulseMode, clickMode)) {\n this._clickRepulse();\n } else {\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.divModeExecute)(repulseMode, divs, (selector, div) => this._singleSelectorRepulse(selector, div));\n }\n }\n isEnabled(particle) {\n const container = this.container,\n options = container.actualOptions,\n mouse = container.interactivity.mouse,\n events = (particle?.interactivity ?? options.interactivity).events,\n divs = events.onDiv,\n hover = events.onHover,\n click = events.onClick,\n divRepulse = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isDivModeEnabled)(repulseMode, divs);\n if (!(divRepulse || hover.enable && !!mouse.position || click.enable && mouse.clickPosition)) {\n return false;\n }\n const hoverMode = hover.mode,\n clickMode = click.mode;\n return (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(repulseMode, hoverMode) || (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(repulseMode, clickMode) || divRepulse;\n }\n loadModeOptions(options, ...sources) {\n if (!options.repulse) {\n options.repulse = new _Options_Classes_Repulse_js__WEBPACK_IMPORTED_MODULE_1__.Repulse();\n }\n for (const source of sources) {\n options.repulse.load(source?.repulse);\n }\n }\n reset() {}\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-repulse/./dist/browser/Repulser.js?\n}");
|
|
68
|
-
|
|
69
|
-
/***/ }),
|
|
70
|
-
|
|
71
|
-
/***/ "./dist/browser/index.js":
|
|
61
|
+
/***/ "./dist/browser/index.js"
|
|
72
62
|
/*!*******************************!*\
|
|
73
63
|
!*** ./dist/browser/index.js ***!
|
|
74
64
|
\*******************************/
|
|
75
|
-
|
|
65
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
76
66
|
|
|
77
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Repulse: () => (/* reexport safe */
|
|
67
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Repulse: () => (/* reexport safe */ _Options_Classes_Repulse_js__WEBPACK_IMPORTED_MODULE_2__.Repulse),\n/* harmony export */ RepulseBase: () => (/* reexport safe */ _Options_Classes_RepulseBase_js__WEBPACK_IMPORTED_MODULE_0__.RepulseBase),\n/* harmony export */ RepulseDiv: () => (/* reexport safe */ _Options_Classes_RepulseDiv_js__WEBPACK_IMPORTED_MODULE_1__.RepulseDiv),\n/* harmony export */ loadExternalRepulseInteraction: () => (/* binding */ loadExternalRepulseInteraction)\n/* harmony export */ });\n/* harmony import */ var _Options_Classes_RepulseBase_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Options/Classes/RepulseBase.js */ \"./dist/browser/Options/Classes/RepulseBase.js\");\n/* harmony import */ var _Options_Classes_RepulseDiv_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/RepulseDiv.js */ \"./dist/browser/Options/Classes/RepulseDiv.js\");\n/* harmony import */ var _Options_Classes_Repulse_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/Repulse.js */ \"./dist/browser/Options/Classes/Repulse.js\");\nfunction loadExternalRepulseInteraction(engine) {\n engine.checkVersion(\"4.0.0-alpha.0\");\n engine.register(e => {\n e.addInteractor(\"externalRepulse\", async container => {\n const {\n Repulser\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_Repulser_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./Repulser.js */ \"./dist/browser/Repulser.js\"));\n return new Repulser(engine, container);\n });\n });\n}\n\n\n\n\n//# sourceURL=webpack://@tsparticles/interaction-external-repulse/./dist/browser/index.js?\n}");
|
|
78
68
|
|
|
79
|
-
/***/ }
|
|
69
|
+
/***/ },
|
|
80
70
|
|
|
81
|
-
/***/ "@tsparticles/engine"
|
|
71
|
+
/***/ "@tsparticles/engine"
|
|
82
72
|
/*!*********************************************************************************************************************************!*\
|
|
83
73
|
!*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
|
|
84
74
|
\*********************************************************************************************************************************/
|
|
85
|
-
|
|
75
|
+
(module) {
|
|
86
76
|
|
|
87
77
|
module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
88
78
|
|
|
89
|
-
/***/ }
|
|
79
|
+
/***/ }
|
|
90
80
|
|
|
91
81
|
/******/ });
|
|
92
82
|
/************************************************************************/
|
|
@@ -100,6 +90,12 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
100
90
|
/******/ if (cachedModule !== undefined) {
|
|
101
91
|
/******/ return cachedModule.exports;
|
|
102
92
|
/******/ }
|
|
93
|
+
/******/ // Check if module exists (development only)
|
|
94
|
+
/******/ if (__webpack_modules__[moduleId] === undefined) {
|
|
95
|
+
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
|
|
96
|
+
/******/ e.code = 'MODULE_NOT_FOUND';
|
|
97
|
+
/******/ throw e;
|
|
98
|
+
/******/ }
|
|
103
99
|
/******/ // Create a new module (and put it into the cache)
|
|
104
100
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
105
101
|
/******/ // no module.id needed
|
|
@@ -114,19 +110,10 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
114
110
|
/******/ return module.exports;
|
|
115
111
|
/******/ }
|
|
116
112
|
/******/
|
|
117
|
-
|
|
118
|
-
/******/
|
|
119
|
-
/******/ (() => {
|
|
120
|
-
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
121
|
-
/******/ __webpack_require__.n = (module) => {
|
|
122
|
-
/******/ var getter = module && module.__esModule ?
|
|
123
|
-
/******/ () => (module['default']) :
|
|
124
|
-
/******/ () => (module);
|
|
125
|
-
/******/ __webpack_require__.d(getter, { a: getter });
|
|
126
|
-
/******/ return getter;
|
|
127
|
-
/******/ };
|
|
128
|
-
/******/ })();
|
|
113
|
+
/******/ // expose the modules object (__webpack_modules__)
|
|
114
|
+
/******/ __webpack_require__.m = __webpack_modules__;
|
|
129
115
|
/******/
|
|
116
|
+
/************************************************************************/
|
|
130
117
|
/******/ /* webpack/runtime/define property getters */
|
|
131
118
|
/******/ (() => {
|
|
132
119
|
/******/ // define getter functions for harmony exports
|
|
@@ -139,11 +126,90 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
139
126
|
/******/ };
|
|
140
127
|
/******/ })();
|
|
141
128
|
/******/
|
|
129
|
+
/******/ /* webpack/runtime/ensure chunk */
|
|
130
|
+
/******/ (() => {
|
|
131
|
+
/******/ __webpack_require__.f = {};
|
|
132
|
+
/******/ // This file contains only the entry chunk.
|
|
133
|
+
/******/ // The chunk loading function for additional chunks
|
|
134
|
+
/******/ __webpack_require__.e = (chunkId) => {
|
|
135
|
+
/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
|
|
136
|
+
/******/ __webpack_require__.f[key](chunkId, promises);
|
|
137
|
+
/******/ return promises;
|
|
138
|
+
/******/ }, []));
|
|
139
|
+
/******/ };
|
|
140
|
+
/******/ })();
|
|
141
|
+
/******/
|
|
142
|
+
/******/ /* webpack/runtime/get javascript chunk filename */
|
|
143
|
+
/******/ (() => {
|
|
144
|
+
/******/ // This function allow to reference async chunks
|
|
145
|
+
/******/ __webpack_require__.u = (chunkId) => {
|
|
146
|
+
/******/ // return url for filenames based on template
|
|
147
|
+
/******/ return "" + chunkId + ".js";
|
|
148
|
+
/******/ };
|
|
149
|
+
/******/ })();
|
|
150
|
+
/******/
|
|
151
|
+
/******/ /* webpack/runtime/global */
|
|
152
|
+
/******/ (() => {
|
|
153
|
+
/******/ __webpack_require__.g = (function() {
|
|
154
|
+
/******/ if (typeof globalThis === 'object') return globalThis;
|
|
155
|
+
/******/ try {
|
|
156
|
+
/******/ return this || new Function('return this')();
|
|
157
|
+
/******/ } catch (e) {
|
|
158
|
+
/******/ if (typeof window === 'object') return window;
|
|
159
|
+
/******/ }
|
|
160
|
+
/******/ })();
|
|
161
|
+
/******/ })();
|
|
162
|
+
/******/
|
|
142
163
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
143
164
|
/******/ (() => {
|
|
144
165
|
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
145
166
|
/******/ })();
|
|
146
167
|
/******/
|
|
168
|
+
/******/ /* webpack/runtime/load script */
|
|
169
|
+
/******/ (() => {
|
|
170
|
+
/******/ var inProgress = {};
|
|
171
|
+
/******/ var dataWebpackPrefix = "@tsparticles/interaction-external-repulse:";
|
|
172
|
+
/******/ // loadScript function to load a script via script tag
|
|
173
|
+
/******/ __webpack_require__.l = (url, done, key, chunkId) => {
|
|
174
|
+
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
|
|
175
|
+
/******/ var script, needAttach;
|
|
176
|
+
/******/ if(key !== undefined) {
|
|
177
|
+
/******/ var scripts = document.getElementsByTagName("script");
|
|
178
|
+
/******/ for(var i = 0; i < scripts.length; i++) {
|
|
179
|
+
/******/ var s = scripts[i];
|
|
180
|
+
/******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
|
|
181
|
+
/******/ }
|
|
182
|
+
/******/ }
|
|
183
|
+
/******/ if(!script) {
|
|
184
|
+
/******/ needAttach = true;
|
|
185
|
+
/******/ script = document.createElement('script');
|
|
186
|
+
/******/
|
|
187
|
+
/******/ script.charset = 'utf-8';
|
|
188
|
+
/******/ if (__webpack_require__.nc) {
|
|
189
|
+
/******/ script.setAttribute("nonce", __webpack_require__.nc);
|
|
190
|
+
/******/ }
|
|
191
|
+
/******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
|
|
192
|
+
/******/
|
|
193
|
+
/******/ script.src = url;
|
|
194
|
+
/******/ }
|
|
195
|
+
/******/ inProgress[url] = [done];
|
|
196
|
+
/******/ var onScriptComplete = (prev, event) => {
|
|
197
|
+
/******/ // avoid mem leaks in IE.
|
|
198
|
+
/******/ script.onerror = script.onload = null;
|
|
199
|
+
/******/ clearTimeout(timeout);
|
|
200
|
+
/******/ var doneFns = inProgress[url];
|
|
201
|
+
/******/ delete inProgress[url];
|
|
202
|
+
/******/ script.parentNode && script.parentNode.removeChild(script);
|
|
203
|
+
/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
|
|
204
|
+
/******/ if(prev) return prev(event);
|
|
205
|
+
/******/ }
|
|
206
|
+
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
|
|
207
|
+
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
|
|
208
|
+
/******/ script.onload = onScriptComplete.bind(null, script.onload);
|
|
209
|
+
/******/ needAttach && document.head.appendChild(script);
|
|
210
|
+
/******/ };
|
|
211
|
+
/******/ })();
|
|
212
|
+
/******/
|
|
147
213
|
/******/ /* webpack/runtime/make namespace object */
|
|
148
214
|
/******/ (() => {
|
|
149
215
|
/******/ // define __esModule on exports
|
|
@@ -155,6 +221,119 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
155
221
|
/******/ };
|
|
156
222
|
/******/ })();
|
|
157
223
|
/******/
|
|
224
|
+
/******/ /* webpack/runtime/publicPath */
|
|
225
|
+
/******/ (() => {
|
|
226
|
+
/******/ var scriptUrl;
|
|
227
|
+
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
|
|
228
|
+
/******/ var document = __webpack_require__.g.document;
|
|
229
|
+
/******/ if (!scriptUrl && document) {
|
|
230
|
+
/******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
|
|
231
|
+
/******/ scriptUrl = document.currentScript.src;
|
|
232
|
+
/******/ if (!scriptUrl) {
|
|
233
|
+
/******/ var scripts = document.getElementsByTagName("script");
|
|
234
|
+
/******/ if(scripts.length) {
|
|
235
|
+
/******/ var i = scripts.length - 1;
|
|
236
|
+
/******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
|
|
237
|
+
/******/ }
|
|
238
|
+
/******/ }
|
|
239
|
+
/******/ }
|
|
240
|
+
/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
|
|
241
|
+
/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
|
|
242
|
+
/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
|
|
243
|
+
/******/ scriptUrl = scriptUrl.replace(/^blob:/, "").replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
|
|
244
|
+
/******/ __webpack_require__.p = scriptUrl;
|
|
245
|
+
/******/ })();
|
|
246
|
+
/******/
|
|
247
|
+
/******/ /* webpack/runtime/jsonp chunk loading */
|
|
248
|
+
/******/ (() => {
|
|
249
|
+
/******/ // no baseURI
|
|
250
|
+
/******/
|
|
251
|
+
/******/ // object to store loaded and loading chunks
|
|
252
|
+
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
|
253
|
+
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
|
|
254
|
+
/******/ var installedChunks = {
|
|
255
|
+
/******/ "tsparticles.interaction.external.repulse": 0
|
|
256
|
+
/******/ };
|
|
257
|
+
/******/
|
|
258
|
+
/******/ __webpack_require__.f.j = (chunkId, promises) => {
|
|
259
|
+
/******/ // JSONP chunk loading for javascript
|
|
260
|
+
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
|
|
261
|
+
/******/ if(installedChunkData !== 0) { // 0 means "already installed".
|
|
262
|
+
/******/
|
|
263
|
+
/******/ // a Promise means "currently loading".
|
|
264
|
+
/******/ if(installedChunkData) {
|
|
265
|
+
/******/ promises.push(installedChunkData[2]);
|
|
266
|
+
/******/ } else {
|
|
267
|
+
/******/ if(true) { // all chunks have JS
|
|
268
|
+
/******/ // setup Promise in chunk cache
|
|
269
|
+
/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
|
|
270
|
+
/******/ promises.push(installedChunkData[2] = promise);
|
|
271
|
+
/******/
|
|
272
|
+
/******/ // start chunk loading
|
|
273
|
+
/******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
|
|
274
|
+
/******/ // create error before stack unwound to get useful stacktrace later
|
|
275
|
+
/******/ var error = new Error();
|
|
276
|
+
/******/ var loadingEnded = (event) => {
|
|
277
|
+
/******/ if(__webpack_require__.o(installedChunks, chunkId)) {
|
|
278
|
+
/******/ installedChunkData = installedChunks[chunkId];
|
|
279
|
+
/******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
|
|
280
|
+
/******/ if(installedChunkData) {
|
|
281
|
+
/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
|
|
282
|
+
/******/ var realSrc = event && event.target && event.target.src;
|
|
283
|
+
/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
|
|
284
|
+
/******/ error.name = 'ChunkLoadError';
|
|
285
|
+
/******/ error.type = errorType;
|
|
286
|
+
/******/ error.request = realSrc;
|
|
287
|
+
/******/ installedChunkData[1](error);
|
|
288
|
+
/******/ }
|
|
289
|
+
/******/ }
|
|
290
|
+
/******/ };
|
|
291
|
+
/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
|
|
292
|
+
/******/ }
|
|
293
|
+
/******/ }
|
|
294
|
+
/******/ }
|
|
295
|
+
/******/ };
|
|
296
|
+
/******/
|
|
297
|
+
/******/ // no prefetching
|
|
298
|
+
/******/
|
|
299
|
+
/******/ // no preloaded
|
|
300
|
+
/******/
|
|
301
|
+
/******/ // no HMR
|
|
302
|
+
/******/
|
|
303
|
+
/******/ // no HMR manifest
|
|
304
|
+
/******/
|
|
305
|
+
/******/ // no on chunks loaded
|
|
306
|
+
/******/
|
|
307
|
+
/******/ // install a JSONP callback for chunk loading
|
|
308
|
+
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
|
|
309
|
+
/******/ var [chunkIds, moreModules, runtime] = data;
|
|
310
|
+
/******/ // add "moreModules" to the modules object,
|
|
311
|
+
/******/ // then flag all "chunkIds" as loaded and fire callback
|
|
312
|
+
/******/ var moduleId, chunkId, i = 0;
|
|
313
|
+
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
|
|
314
|
+
/******/ for(moduleId in moreModules) {
|
|
315
|
+
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
|
|
316
|
+
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
|
|
317
|
+
/******/ }
|
|
318
|
+
/******/ }
|
|
319
|
+
/******/ if(runtime) var result = runtime(__webpack_require__);
|
|
320
|
+
/******/ }
|
|
321
|
+
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
|
|
322
|
+
/******/ for(;i < chunkIds.length; i++) {
|
|
323
|
+
/******/ chunkId = chunkIds[i];
|
|
324
|
+
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
|
|
325
|
+
/******/ installedChunks[chunkId][0]();
|
|
326
|
+
/******/ }
|
|
327
|
+
/******/ installedChunks[chunkId] = 0;
|
|
328
|
+
/******/ }
|
|
329
|
+
/******/
|
|
330
|
+
/******/ }
|
|
331
|
+
/******/
|
|
332
|
+
/******/ var chunkLoadingGlobal = this["webpackChunk_tsparticles_interaction_external_repulse"] = this["webpackChunk_tsparticles_interaction_external_repulse"] || [];
|
|
333
|
+
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
|
|
334
|
+
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
|
|
335
|
+
/******/ })();
|
|
336
|
+
/******/
|
|
158
337
|
/************************************************************************/
|
|
159
338
|
/******/
|
|
160
339
|
/******/ // startup
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.interaction.external.repulse.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
|
|
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 r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var i in r)("object"==typeof exports?exports:e)[i]=r[i]}}(this,(e=>(()=>{var t,r,i={39(e,t,r){r.d(t,{W:()=>n});var i=r(303),o=r(447);class n extends o._{constructor(){super(),this.selectors=[]}load(e){super.load(e),(0,i.isNull)(e)||void 0!==e.selectors&&(this.selectors=e.selectors)}}},246(e,t,r){r.d(t,{Z:()=>s});var i=r(303),o=r(447),n=r(39);class s extends o._{load(e){super.load(e),(0,i.isNull)(e)||(this.divs=(0,i.executeOnSingleOrMultiple)(e.divs,(e=>{const t=new n.W;return t.load(e),t})))}}},303(t){t.exports=e},447(e,t,r){r.d(t,{_:()=>o});var i=r(303);class o{constructor(){this.distance=200,this.duration=.4,this.factor=100,this.speed=1,this.maxSpeed=50,this.easing=i.EasingType.easeOutQuad}load(e){(0,i.isNull)(e)||(void 0!==e.distance&&(this.distance=e.distance),void 0!==e.duration&&(this.duration=e.duration),void 0!==e.easing&&(this.easing=e.easing),void 0!==e.factor&&(this.factor=e.factor),void 0!==e.speed&&(this.speed=e.speed),void 0!==e.maxSpeed&&(this.maxSpeed=e.maxSpeed))}}}},o={};function n(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}};return i[e](r,r.exports,n),r.exports}n.m=i,n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce(((t,r)=>(n.f[r](e,t),t)),[])),n.u=e=>e+".min.js",n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},r="@tsparticles/interaction-external-repulse:",n.l=(e,i,o,s)=>{if(t[e])t[e].push(i);else{var a,l;if(void 0!==o)for(var c=document.getElementsByTagName("script"),d=0;d<c.length;d++){var p=c[d];if(p.getAttribute("src")==e||p.getAttribute("data-webpack")==r+o){a=p;break}}a||(l=!0,(a=document.createElement("script")).charset="utf-8",n.nc&&a.setAttribute("nonce",n.nc),a.setAttribute("data-webpack",r+o),a.src=e),t[e]=[i];var u=(r,i)=>{a.onerror=a.onload=null,clearTimeout(f);var o=t[e];if(delete t[e],a.parentNode&&a.parentNode.removeChild(a),o&&o.forEach((e=>e(i))),r)return r(i)},f=setTimeout(u.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=u.bind(null,a.onerror),a.onload=u.bind(null,a.onload),l&&document.head.appendChild(a)}},n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var i=r.length-1;i>-1&&(!e||!/^http(s?):/.test(e));)e=r[i--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),(()=>{var e={64:0};n.f.j=(t,r)=>{var i=n.o(e,t)?e[t]:void 0;if(0!==i)if(i)r.push(i[2]);else{var o=new Promise(((r,o)=>i=e[t]=[r,o]));r.push(i[2]=o);var s=n.p+n.u(t),a=new Error;n.l(s,(r=>{if(n.o(e,t)&&(0!==(i=e[t])&&(e[t]=void 0),i)){var o=r&&("load"===r.type?"missing":r.type),s=r&&r.target&&r.target.src;a.message="Loading chunk "+t+" failed.\n("+o+": "+s+")",a.name="ChunkLoadError",a.type=o,a.request=s,i[1](a)}}),"chunk-"+t,t)}};var t=(t,r)=>{var i,o,[s,a,l]=r,c=0;if(s.some((t=>0!==e[t]))){for(i in a)n.o(a,i)&&(n.m[i]=a[i]);if(l)l(n)}for(t&&t(r);c<s.length;c++)o=s[c],n.o(e,o)&&e[o]&&e[o][0](),e[o]=0},r=this.webpackChunk_tsparticles_interaction_external_repulse=this.webpackChunk_tsparticles_interaction_external_repulse||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var s={};n.r(s),n.d(s,{Repulse:()=>c.Z,RepulseBase:()=>a._,RepulseDiv:()=>l.W,loadExternalRepulseInteraction:()=>d});var a=n(447),l=n(39),c=n(246);function d(e){e.checkVersion("4.0.0-alpha.0"),e.register((t=>{t.addInteractor("externalRepulse",(async t=>{const{Repulser:r}=await n.e(176).then(n.bind(n,176));return new r(e,t)}))}))}return s})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Repulse External Interaction
|
|
1
|
+
/*! tsParticles Repulse External Interaction v4.0.0-alpha.0 by Matteo Bruni */
|
package/types/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type Engine } from "@tsparticles/engine";
|
|
2
|
-
export declare function loadExternalRepulseInteraction(engine: Engine
|
|
2
|
+
export declare function loadExternalRepulseInteraction(engine: Engine): void;
|
|
3
3
|
export * from "./Options/Classes/RepulseBase.js";
|
|
4
4
|
export * from "./Options/Classes/RepulseDiv.js";
|
|
5
5
|
export * from "./Options/Classes/Repulse.js";
|
|
6
|
-
export * from "./Options/Interfaces/IRepulseBase.js";
|
|
7
|
-
export * from "./Options/Interfaces/IRepulseDiv.js";
|
|
8
|
-
export * from "./Options/Interfaces/IRepulse.js";
|
|
6
|
+
export type * from "./Options/Interfaces/IRepulseBase.js";
|
|
7
|
+
export type * from "./Options/Interfaces/IRepulseDiv.js";
|
|
8
|
+
export type * from "./Options/Interfaces/IRepulse.js";
|
package/umd/Repulser.js
CHANGED
|
@@ -23,9 +23,7 @@
|
|
|
23
23
|
}
|
|
24
24
|
const repulse = container.repulse ?? { particles: [] };
|
|
25
25
|
if (!repulse.finish) {
|
|
26
|
-
|
|
27
|
-
repulse.count = 0;
|
|
28
|
-
}
|
|
26
|
+
repulse.count ??= 0;
|
|
29
27
|
repulse.count++;
|
|
30
28
|
if (repulse.count === container.particles.count) {
|
|
31
29
|
repulse.finish = true;
|
|
@@ -81,7 +79,7 @@
|
|
|
81
79
|
if (!repulse) {
|
|
82
80
|
return;
|
|
83
81
|
}
|
|
84
|
-
const query =
|
|
82
|
+
const query = (0, engine_1.safeDocument)().querySelectorAll(selector);
|
|
85
83
|
if (!query.length) {
|
|
86
84
|
return;
|
|
87
85
|
}
|
|
@@ -96,17 +94,13 @@
|
|
|
96
94
|
});
|
|
97
95
|
};
|
|
98
96
|
this._engine = engine;
|
|
99
|
-
|
|
100
|
-
container.repulse = { particles: [] };
|
|
101
|
-
}
|
|
97
|
+
container.repulse ??= { particles: [] };
|
|
102
98
|
this.handleClickMode = (mode) => {
|
|
103
99
|
const options = this.container.actualOptions, repulseOpts = options.interactivity.modes.repulse;
|
|
104
100
|
if (!repulseOpts || mode !== repulseMode) {
|
|
105
101
|
return;
|
|
106
102
|
}
|
|
107
|
-
|
|
108
|
-
container.repulse = { particles: [] };
|
|
109
|
-
}
|
|
103
|
+
container.repulse ??= { particles: [] };
|
|
110
104
|
const repulse = container.repulse;
|
|
111
105
|
repulse.clicking = true;
|
|
112
106
|
repulse.count = 0;
|
|
@@ -144,7 +138,9 @@
|
|
|
144
138
|
this._clickRepulse();
|
|
145
139
|
}
|
|
146
140
|
else {
|
|
147
|
-
(0, engine_1.divModeExecute)(repulseMode, divs, (selector, div) =>
|
|
141
|
+
(0, engine_1.divModeExecute)(repulseMode, divs, (selector, div) => {
|
|
142
|
+
this._singleSelectorRepulse(selector, div);
|
|
143
|
+
});
|
|
148
144
|
}
|
|
149
145
|
}
|
|
150
146
|
isEnabled(particle) {
|
|
@@ -156,9 +152,7 @@
|
|
|
156
152
|
return (0, engine_1.isInArray)(repulseMode, hoverMode) || (0, engine_1.isInArray)(repulseMode, clickMode) || divRepulse;
|
|
157
153
|
}
|
|
158
154
|
loadModeOptions(options, ...sources) {
|
|
159
|
-
|
|
160
|
-
options.repulse = new Repulse_js_1.Repulse();
|
|
161
|
-
}
|
|
155
|
+
options.repulse ??= new Repulse_js_1.Repulse();
|
|
162
156
|
for (const source of sources) {
|
|
163
157
|
options.repulse.load(source?.repulse);
|
|
164
158
|
}
|
package/umd/index.js
CHANGED
|
@@ -9,6 +9,28 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
9
9
|
if (k2 === undefined) k2 = k;
|
|
10
10
|
o[k2] = m[k];
|
|
11
11
|
}));
|
|
12
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
13
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
14
|
+
}) : function(o, v) {
|
|
15
|
+
o["default"] = v;
|
|
16
|
+
});
|
|
17
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
18
|
+
var ownKeys = function(o) {
|
|
19
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
20
|
+
var ar = [];
|
|
21
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
22
|
+
return ar;
|
|
23
|
+
};
|
|
24
|
+
return ownKeys(o);
|
|
25
|
+
};
|
|
26
|
+
return function (mod) {
|
|
27
|
+
if (mod && mod.__esModule) return mod;
|
|
28
|
+
var result = {};
|
|
29
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
30
|
+
__setModuleDefault(result, mod);
|
|
31
|
+
return result;
|
|
32
|
+
};
|
|
33
|
+
})();
|
|
12
34
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
13
35
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
14
36
|
};
|
|
@@ -18,23 +40,23 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
18
40
|
if (v !== undefined) module.exports = v;
|
|
19
41
|
}
|
|
20
42
|
else if (typeof define === "function" && define.amd) {
|
|
21
|
-
define(["require", "exports", "./
|
|
43
|
+
define(["require", "exports", "./Options/Classes/RepulseBase.js", "./Options/Classes/RepulseDiv.js", "./Options/Classes/Repulse.js"], factory);
|
|
22
44
|
}
|
|
23
45
|
})(function (require, exports) {
|
|
24
46
|
"use strict";
|
|
47
|
+
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
|
|
25
48
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
49
|
exports.loadExternalRepulseInteraction = loadExternalRepulseInteraction;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
engine.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
50
|
+
function loadExternalRepulseInteraction(engine) {
|
|
51
|
+
engine.checkVersion("4.0.0-alpha.0");
|
|
52
|
+
engine.register(e => {
|
|
53
|
+
e.addInteractor("externalRepulse", async (container) => {
|
|
54
|
+
const { Repulser } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./Repulser.js"))) : new Promise((resolve_1, reject_1) => { require(["./Repulser.js"], resolve_1, reject_1); }).then(__importStar));
|
|
55
|
+
return new Repulser(engine, container);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
33
58
|
}
|
|
34
59
|
__exportStar(require("./Options/Classes/RepulseBase.js"), exports);
|
|
35
60
|
__exportStar(require("./Options/Classes/RepulseDiv.js"), exports);
|
|
36
61
|
__exportStar(require("./Options/Classes/Repulse.js"), exports);
|
|
37
|
-
__exportStar(require("./Options/Interfaces/IRepulseBase.js"), exports);
|
|
38
|
-
__exportStar(require("./Options/Interfaces/IRepulseDiv.js"), exports);
|
|
39
|
-
__exportStar(require("./Options/Interfaces/IRepulse.js"), exports);
|
|
40
62
|
});
|