@tsparticles/interaction-external-connect 3.2.2 → 3.4.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/browser/Connector.js +2 -3
- package/browser/Utils.js +1 -1
- package/browser/index.js +3 -3
- package/cjs/Connector.js +2 -3
- package/cjs/Utils.js +1 -1
- package/cjs/index.js +3 -15
- package/esm/Connector.js +2 -3
- package/esm/Utils.js +1 -1
- package/esm/index.js +3 -3
- package/package.json +2 -2
- package/report.html +1 -1
- package/tsparticles.interaction.external.connect.js +22 -200
- package/tsparticles.interaction.external.connect.min.js +1 -1
- package/tsparticles.interaction.external.connect.min.js.LICENSE.txt +1 -1
- package/types/Connector.d.ts +1 -1
- package/umd/Connector.js +2 -3
- package/umd/Utils.js +1 -1
- package/umd/index.js +4 -17
- package/810.min.js +0 -2
- package/810.min.js.LICENSE.txt +0 -1
- package/dist_browser_Connector_js.js +0 -40
package/browser/Connector.js
CHANGED
|
@@ -16,7 +16,7 @@ export class Connector extends ExternalInteractorBase {
|
|
|
16
16
|
container.retina.connectModeDistance = connect.distance * container.retina.pixelRatio;
|
|
17
17
|
container.retina.connectModeRadius = connect.radius * container.retina.pixelRatio;
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
interact() {
|
|
20
20
|
const container = this.container, options = container.actualOptions;
|
|
21
21
|
if (options.interactivity.events.onHover.enable && container.interactivity.status === "pointermove") {
|
|
22
22
|
const mousePos = container.interactivity.mouse.position, { connectModeDistance, connectModeRadius } = container.retina;
|
|
@@ -27,7 +27,7 @@ export class Connector extends ExternalInteractorBase {
|
|
|
27
27
|
!mousePos) {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
const distance = Math.abs(connectModeRadius), query = container.particles.quadTree.queryCircle(mousePos, distance,
|
|
30
|
+
const distance = Math.abs(connectModeRadius), query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(p));
|
|
31
31
|
query.forEach((p1, i) => {
|
|
32
32
|
const pos1 = p1.getPosition(), indexOffset = 1;
|
|
33
33
|
for (const p2 of query.slice(i + indexOffset)) {
|
|
@@ -38,7 +38,6 @@ export class Connector extends ExternalInteractorBase {
|
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
await Promise.resolve();
|
|
42
41
|
}
|
|
43
42
|
isEnabled(particle) {
|
|
44
43
|
const container = this.container, mouse = container.interactivity.mouse, events = (particle?.interactivity ?? container.actualOptions.interactivity).events;
|
package/browser/Utils.js
CHANGED
|
@@ -25,7 +25,7 @@ export function lineStyle(container, ctx, p1, p2) {
|
|
|
25
25
|
return gradient(ctx, p1, p2, connectOptions.links.opacity);
|
|
26
26
|
}
|
|
27
27
|
export function drawConnection(container, p1, p2) {
|
|
28
|
-
container.canvas.draw(
|
|
28
|
+
container.canvas.draw(ctx => {
|
|
29
29
|
const ls = lineStyle(container, ctx, p1, p2);
|
|
30
30
|
if (!ls) {
|
|
31
31
|
return;
|
package/browser/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { Connector } from "./Connector.js";
|
|
1
2
|
export async function loadExternalConnectInteraction(engine, refresh = true) {
|
|
2
|
-
await engine.addInteractor("externalConnect",
|
|
3
|
-
|
|
4
|
-
return new Connector(container);
|
|
3
|
+
await engine.addInteractor("externalConnect", container => {
|
|
4
|
+
return Promise.resolve(new Connector(container));
|
|
5
5
|
}, refresh);
|
|
6
6
|
}
|
|
7
7
|
export * from "./Options/Classes/Connect.js";
|
package/cjs/Connector.js
CHANGED
|
@@ -19,7 +19,7 @@ class Connector extends engine_1.ExternalInteractorBase {
|
|
|
19
19
|
container.retina.connectModeDistance = connect.distance * container.retina.pixelRatio;
|
|
20
20
|
container.retina.connectModeRadius = connect.radius * container.retina.pixelRatio;
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
interact() {
|
|
23
23
|
const container = this.container, options = container.actualOptions;
|
|
24
24
|
if (options.interactivity.events.onHover.enable && container.interactivity.status === "pointermove") {
|
|
25
25
|
const mousePos = container.interactivity.mouse.position, { connectModeDistance, connectModeRadius } = container.retina;
|
|
@@ -30,7 +30,7 @@ class Connector extends engine_1.ExternalInteractorBase {
|
|
|
30
30
|
!mousePos) {
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
const distance = Math.abs(connectModeRadius), query = container.particles.quadTree.queryCircle(mousePos, distance,
|
|
33
|
+
const distance = Math.abs(connectModeRadius), query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(p));
|
|
34
34
|
query.forEach((p1, i) => {
|
|
35
35
|
const pos1 = p1.getPosition(), indexOffset = 1;
|
|
36
36
|
for (const p2 of query.slice(i + indexOffset)) {
|
|
@@ -41,7 +41,6 @@ class Connector extends engine_1.ExternalInteractorBase {
|
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
-
await Promise.resolve();
|
|
45
44
|
}
|
|
46
45
|
isEnabled(particle) {
|
|
47
46
|
const container = this.container, mouse = container.interactivity.mouse, events = (particle?.interactivity ?? container.actualOptions.interactivity).events;
|
package/cjs/Utils.js
CHANGED
|
@@ -31,7 +31,7 @@ function lineStyle(container, ctx, p1, p2) {
|
|
|
31
31
|
}
|
|
32
32
|
exports.lineStyle = lineStyle;
|
|
33
33
|
function drawConnection(container, p1, p2) {
|
|
34
|
-
container.canvas.draw(
|
|
34
|
+
container.canvas.draw(ctx => {
|
|
35
35
|
const ls = lineStyle(container, ctx, p1, p2);
|
|
36
36
|
if (!ls) {
|
|
37
37
|
return;
|
package/cjs/index.js
CHANGED
|
@@ -10,27 +10,15 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
11
|
o[k2] = m[k];
|
|
12
12
|
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
15
|
};
|
|
28
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
17
|
exports.loadExternalConnectInteraction = void 0;
|
|
18
|
+
const Connector_js_1 = require("./Connector.js");
|
|
30
19
|
async function loadExternalConnectInteraction(engine, refresh = true) {
|
|
31
|
-
await engine.addInteractor("externalConnect",
|
|
32
|
-
|
|
33
|
-
return new Connector(container);
|
|
20
|
+
await engine.addInteractor("externalConnect", container => {
|
|
21
|
+
return Promise.resolve(new Connector_js_1.Connector(container));
|
|
34
22
|
}, refresh);
|
|
35
23
|
}
|
|
36
24
|
exports.loadExternalConnectInteraction = loadExternalConnectInteraction;
|
package/esm/Connector.js
CHANGED
|
@@ -16,7 +16,7 @@ export class Connector extends ExternalInteractorBase {
|
|
|
16
16
|
container.retina.connectModeDistance = connect.distance * container.retina.pixelRatio;
|
|
17
17
|
container.retina.connectModeRadius = connect.radius * container.retina.pixelRatio;
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
interact() {
|
|
20
20
|
const container = this.container, options = container.actualOptions;
|
|
21
21
|
if (options.interactivity.events.onHover.enable && container.interactivity.status === "pointermove") {
|
|
22
22
|
const mousePos = container.interactivity.mouse.position, { connectModeDistance, connectModeRadius } = container.retina;
|
|
@@ -27,7 +27,7 @@ export class Connector extends ExternalInteractorBase {
|
|
|
27
27
|
!mousePos) {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
const distance = Math.abs(connectModeRadius), query = container.particles.quadTree.queryCircle(mousePos, distance,
|
|
30
|
+
const distance = Math.abs(connectModeRadius), query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(p));
|
|
31
31
|
query.forEach((p1, i) => {
|
|
32
32
|
const pos1 = p1.getPosition(), indexOffset = 1;
|
|
33
33
|
for (const p2 of query.slice(i + indexOffset)) {
|
|
@@ -38,7 +38,6 @@ export class Connector extends ExternalInteractorBase {
|
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
await Promise.resolve();
|
|
42
41
|
}
|
|
43
42
|
isEnabled(particle) {
|
|
44
43
|
const container = this.container, mouse = container.interactivity.mouse, events = (particle?.interactivity ?? container.actualOptions.interactivity).events;
|
package/esm/Utils.js
CHANGED
|
@@ -25,7 +25,7 @@ export function lineStyle(container, ctx, p1, p2) {
|
|
|
25
25
|
return gradient(ctx, p1, p2, connectOptions.links.opacity);
|
|
26
26
|
}
|
|
27
27
|
export function drawConnection(container, p1, p2) {
|
|
28
|
-
container.canvas.draw(
|
|
28
|
+
container.canvas.draw(ctx => {
|
|
29
29
|
const ls = lineStyle(container, ctx, p1, p2);
|
|
30
30
|
if (!ls) {
|
|
31
31
|
return;
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { Connector } from "./Connector.js";
|
|
1
2
|
export async function loadExternalConnectInteraction(engine, refresh = true) {
|
|
2
|
-
await engine.addInteractor("externalConnect",
|
|
3
|
-
|
|
4
|
-
return new Connector(container);
|
|
3
|
+
await engine.addInteractor("externalConnect", container => {
|
|
4
|
+
return Promise.resolve(new Connector(container));
|
|
5
5
|
}, refresh);
|
|
6
6
|
}
|
|
7
7
|
export * from "./Options/Classes/Connect.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/interaction-external-connect",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "tsParticles connect external interaction",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"./package.json": "./package.json"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@tsparticles/engine": "^3.
|
|
90
|
+
"@tsparticles/engine": "^3.4.0"
|
|
91
91
|
},
|
|
92
92
|
"publishConfig": {
|
|
93
93
|
"access": "public"
|
package/report.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8"/>
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
6
|
-
<title>@tsparticles/interaction-external-connect [
|
|
6
|
+
<title>@tsparticles/interaction-external-connect [13 May 2024 at 00:06]</title>
|
|
7
7
|
<link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABrVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+O1foceMD///+J0/qK1Pr7/v8Xdr/9///W8P4UdL7L7P0Scr2r4Pyj3vwad8D5/f/2/f+55f3E6f34+/2H0/ojfMKpzOd0rNgQcb3F3O/j9f7c8v6g3Pz0/P/w+v/q+P7n9v6T1/uQ1vuE0vqLut/y+v+Z2fvt+f+15Pzv9fuc2/vR7v2V2Pvd6/bg9P7I6/285/2y4/yp3/zp8vk8i8kqgMT7/P31+fyv4vxGkcz6/P6/6P3j7vfS5PNnpNUxhcbO7f7F6v3O4vHK3/DA2u631Ouy0eqXweKJud5wqthfoNMMbLvY8f73+v2dxeR8sNtTmdDx9/zX6PSjyeaCtd1YnNGX2PuQveCGt95Nls42h8dLlM3F4vBtAAAAM3RSTlMAAyOx0/sKBvik8opWGBMOAe3l1snDm2E9LSb06eHcu5JpHbarfHZCN9CBb08zzkdNS0kYaptYAAAFV0lEQVRYw92X51/aYBDHHS2O2qqttVbrqNq9m+TJIAYIShBkWwqIiCgoWvfeq7Z2/s29hyQNyUcR7LveGwVyXy6XH8/9rqxglLfUPLxVduUor3h0rfp2TYvpivk37929TkG037hffoX0+peVtZQc1589rigVUdXS/ABSAyEmGIO/1XfvldSK8vs3OqB6u3m0nxmIrvgB0dj7rr7Y9IbuF68hnfFaiHA/sxqm0wciIG43P60qKv9WXWc1RXGh/mFESFABTSBi0sNAKzqet17eCtOb3kZIDwxEEU0oAIJGYxNBDhBND29e0rtXXbcpuPmED9IhEAAQ/AXEaF8EPmnrrKsv0LvWR3fg5sWDNAFZOgAgaKvZDogHNU9MFwnnYROkc56RD5CjAbQX9Ow4g7upCsvYu55aSI/Nj0H1akgKQEUM94dwK65hYRmFU9MIcH/fqJYOZYcnuJSU/waKDgTOEVaVKhwrTRP5XzgSpAITYzom7UvkhFX5VutmxeNnWDjjswTKTyfgluNDGbUpWissXhF3s7mlSml+czWkg3D0l1nNjGNjz3myOQOa1KM/jOS6ebdbAVTCi4gljHSFrviza7tOgRWcS0MOUX9zdNgag5w7rRqA44Lzw0hr1WqES36dFliSJFlh2rXIae3FFcDDgKdxrUIDePr8jGcSClV1u7A9xeN0ModY/pHMxmR1EzRh8TJiwqsHmKW0l4FCEZI+jHio+JdPPE9qwQtTRxku2D8sIeRL2LnxWSllANCQGOIiqVHAz2ye2JR0DcH+HoxDkaADLjgxjKQ+AwCX/g0+DNgdG0ukYCONAe+dbc2IAc6fwt1ARoDSezNHxV2Cmzwv3O6lDMV55edBGwGK9n1+x2F8EDfAGCxug8MhpsMEcTEAWf3rx2vZhe/LAmtIn/6apE6PN0ULKgywD9mmdxbmFl3OvD5AS5fW5zLbv/YHmcsBTjf/afDz3MaZTVCfAP9z6/Bw6ycv8EUBWJIn9zYcoAWWlW9+OzO3vkTy8H+RANLmdrpOuYWdZYEXpo+TlCJrW5EARb7fF+bWdqf3hhyZI1nWJQHgznErZhbjoEsWqi8dQNoE294aldzFurwSABL2XXMf9+H1VQGke9exw5P/AnA5Pv5ngMul7LOvO922iwACu8WkCwLCafvM4CeWPxfA8lNHcWZSoi8EwMAIciKX2Z4SWCMAa3snCZ/G4EA8D6CMLNFsGQhkkz/gQNEBbPCbWsxGUpYVu3z8IyNAknwJkfPMEhLyrdi5RTyUVACkw4GSFRNWJNEW+fgPGwHD8/JxnRuLabN4CGNRkAE23na2+VmEAUmrYymSGjMAYqH84YUIyzgzs3XC7gNgH36Vcc4zKY9o9fgPBXUAiHHwVboBHGLiX6Zcjp1f2wu4tvzZKo0ecPnDtQYDQvJXaBeNzce45Fp28ZQLrEZVuFqgBwOalArKXnW1UzlnSusQKJqKYNuz4tOnI6sZG4zanpemv+7ySU2jbA9h6uhcgpfy6G2PahirDZ6zvq6zDduMVFTKvzw8wgyEdelwY9in3XkEPs3osJuwRQ4qTkfzifndg9Gfc4pdsu82+tTnHZTBa2EAMrqr2t43pguc8tNm7JQVQ2S0ukj2d22dhXYP0/veWtwKrCkNoNimAN5+Xr/oLrxswKbVJjteWrX7eR63o4j9q0GxnaBdWgGA5VStpanIjQmEhV0/nVt5VOFUvix6awJhPcAaTEShgrG+iGyvb5a0Ndb1YGHFPEwoqAinoaykaID1o1pdPNu7XsnCKQ3R+hwWIIhGvORcJUBYXe3Xa3vq/mF/N9V13ugufMkfXn+KHsRD0B8AAAAASUVORK5CYII=" type="image/x-icon" />
|
|
8
8
|
|
|
9
9
|
<script>
|
|
@@ -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.
|
|
7
|
+
* v3.4.0
|
|
8
8
|
*/
|
|
9
9
|
/*
|
|
10
10
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
@@ -28,6 +28,16 @@ return /******/ (() => { // webpackBootstrap
|
|
|
28
28
|
/******/ "use strict";
|
|
29
29
|
/******/ var __webpack_modules__ = ({
|
|
30
30
|
|
|
31
|
+
/***/ "./dist/browser/Connector.js":
|
|
32
|
+
/*!***********************************!*\
|
|
33
|
+
!*** ./dist/browser/Connector.js ***!
|
|
34
|
+
\***********************************/
|
|
35
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
36
|
+
|
|
37
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Connector: () => (/* binding */ Connector)\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_Connect_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/Connect.js */ \"./dist/browser/Options/Classes/Connect.js\");\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\n\nconst connectMode = \"connect\",\n minDistance = 0;\nclass Connector 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 connect = container.actualOptions.interactivity.modes.connect;\n if (!connect) {\n return;\n }\n container.retina.connectModeDistance = connect.distance * container.retina.pixelRatio;\n container.retina.connectModeRadius = connect.radius * container.retina.pixelRatio;\n }\n interact() {\n const container = this.container,\n options = container.actualOptions;\n if (options.interactivity.events.onHover.enable && container.interactivity.status === \"pointermove\") {\n const mousePos = container.interactivity.mouse.position,\n {\n connectModeDistance,\n connectModeRadius\n } = container.retina;\n if (!connectModeDistance || connectModeDistance < minDistance || !connectModeRadius || connectModeRadius < minDistance || !mousePos) {\n return;\n }\n const distance = Math.abs(connectModeRadius),\n query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(p));\n query.forEach((p1, i) => {\n const pos1 = p1.getPosition(),\n indexOffset = 1;\n for (const p2 of query.slice(i + indexOffset)) {\n const pos2 = p2.getPosition(),\n distMax = Math.abs(connectModeDistance),\n xDiff = Math.abs(pos1.x - pos2.x),\n yDiff = Math.abs(pos1.y - pos2.y);\n if (xDiff < distMax && yDiff < distMax) {\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.drawConnection)(container, p1, p2);\n }\n }\n });\n }\n }\n isEnabled(particle) {\n const container = this.container,\n mouse = container.interactivity.mouse,\n events = (particle?.interactivity ?? container.actualOptions.interactivity).events;\n if (!(events.onHover.enable && mouse.position)) {\n return false;\n }\n return (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(connectMode, events.onHover.mode);\n }\n loadModeOptions(options, ...sources) {\n if (!options.connect) {\n options.connect = new _Options_Classes_Connect_js__WEBPACK_IMPORTED_MODULE_2__.Connect();\n }\n for (const source of sources) {\n options.connect.load(source?.connect);\n }\n }\n reset() {}\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-connect/./dist/browser/Connector.js?");
|
|
38
|
+
|
|
39
|
+
/***/ }),
|
|
40
|
+
|
|
31
41
|
/***/ "./dist/browser/Options/Classes/Connect.js":
|
|
32
42
|
/*!*************************************************!*\
|
|
33
43
|
!*** ./dist/browser/Options/Classes/Connect.js ***!
|
|
@@ -48,13 +58,23 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
48
58
|
|
|
49
59
|
/***/ }),
|
|
50
60
|
|
|
61
|
+
/***/ "./dist/browser/Utils.js":
|
|
62
|
+
/*!*******************************!*\
|
|
63
|
+
!*** ./dist/browser/Utils.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 */ drawConnectLine: () => (/* binding */ drawConnectLine),\n/* harmony export */ drawConnection: () => (/* binding */ drawConnection),\n/* harmony export */ gradient: () => (/* binding */ gradient),\n/* harmony export */ lineStyle: () => (/* binding */ lineStyle)\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\nconst gradientMin = 0,\n gradientMax = 1,\n defaultLinksWidth = 0;\nfunction gradient(context, p1, p2, opacity) {\n const gradStop = Math.floor(p2.getRadius() / p1.getRadius()),\n color1 = p1.getFillColor(),\n color2 = p2.getFillColor();\n if (!color1 || !color2) {\n return;\n }\n const sourcePos = p1.getPosition(),\n destPos = p2.getPosition(),\n midRgb = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.colorMix)(color1, color2, p1.getRadius(), p2.getRadius()),\n grad = context.createLinearGradient(sourcePos.x, sourcePos.y, destPos.x, destPos.y);\n grad.addColorStop(gradientMin, (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getStyleFromHsl)(color1, opacity));\n grad.addColorStop((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.clamp)(gradStop, gradientMin, gradientMax), (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getStyleFromRgb)(midRgb, opacity));\n grad.addColorStop(gradientMax, (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getStyleFromHsl)(color2, opacity));\n return grad;\n}\nfunction drawConnectLine(context, width, lineStyle, begin, end) {\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.drawLine)(context, begin, end);\n context.lineWidth = width;\n context.strokeStyle = lineStyle;\n context.stroke();\n}\nfunction lineStyle(container, ctx, p1, p2) {\n const options = container.actualOptions,\n connectOptions = options.interactivity.modes.connect;\n if (!connectOptions) {\n return;\n }\n return gradient(ctx, p1, p2, connectOptions.links.opacity);\n}\nfunction drawConnection(container, p1, p2) {\n container.canvas.draw(ctx => {\n const ls = lineStyle(container, ctx, p1, p2);\n if (!ls) {\n return;\n }\n const pos1 = p1.getPosition(),\n pos2 = p2.getPosition();\n drawConnectLine(ctx, p1.retina.linksWidth ?? defaultLinksWidth, ls, pos1, pos2);\n });\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-connect/./dist/browser/Utils.js?");
|
|
68
|
+
|
|
69
|
+
/***/ }),
|
|
70
|
+
|
|
51
71
|
/***/ "./dist/browser/index.js":
|
|
52
72
|
/*!*******************************!*\
|
|
53
73
|
!*** ./dist/browser/index.js ***!
|
|
54
74
|
\*******************************/
|
|
55
75
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
56
76
|
|
|
57
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Connect: () => (/* reexport safe */
|
|
77
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Connect: () => (/* reexport safe */ _Options_Classes_Connect_js__WEBPACK_IMPORTED_MODULE_1__.Connect),\n/* harmony export */ ConnectLinks: () => (/* reexport safe */ _Options_Classes_ConnectLinks_js__WEBPACK_IMPORTED_MODULE_2__.ConnectLinks),\n/* harmony export */ loadExternalConnectInteraction: () => (/* binding */ loadExternalConnectInteraction)\n/* harmony export */ });\n/* harmony import */ var _Connector_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Connector.js */ \"./dist/browser/Connector.js\");\n/* harmony import */ var _Options_Classes_Connect_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/Connect.js */ \"./dist/browser/Options/Classes/Connect.js\");\n/* harmony import */ var _Options_Classes_ConnectLinks_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/ConnectLinks.js */ \"./dist/browser/Options/Classes/ConnectLinks.js\");\n\nasync function loadExternalConnectInteraction(engine, refresh = true) {\n await engine.addInteractor(\"externalConnect\", container => {\n return Promise.resolve(new _Connector_js__WEBPACK_IMPORTED_MODULE_0__.Connector(container));\n }, refresh);\n}\n\n\n\n\n\n//# sourceURL=webpack://@tsparticles/interaction-external-connect/./dist/browser/index.js?");
|
|
58
78
|
|
|
59
79
|
/***/ }),
|
|
60
80
|
|
|
@@ -94,9 +114,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
94
114
|
/******/ return module.exports;
|
|
95
115
|
/******/ }
|
|
96
116
|
/******/
|
|
97
|
-
/******/ // expose the modules object (__webpack_modules__)
|
|
98
|
-
/******/ __webpack_require__.m = __webpack_modules__;
|
|
99
|
-
/******/
|
|
100
117
|
/************************************************************************/
|
|
101
118
|
/******/ /* webpack/runtime/compat get default export */
|
|
102
119
|
/******/ (() => {
|
|
@@ -122,91 +139,11 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
122
139
|
/******/ };
|
|
123
140
|
/******/ })();
|
|
124
141
|
/******/
|
|
125
|
-
/******/ /* webpack/runtime/ensure chunk */
|
|
126
|
-
/******/ (() => {
|
|
127
|
-
/******/ __webpack_require__.f = {};
|
|
128
|
-
/******/ // This file contains only the entry chunk.
|
|
129
|
-
/******/ // The chunk loading function for additional chunks
|
|
130
|
-
/******/ __webpack_require__.e = (chunkId) => {
|
|
131
|
-
/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
|
|
132
|
-
/******/ __webpack_require__.f[key](chunkId, promises);
|
|
133
|
-
/******/ return promises;
|
|
134
|
-
/******/ }, []));
|
|
135
|
-
/******/ };
|
|
136
|
-
/******/ })();
|
|
137
|
-
/******/
|
|
138
|
-
/******/ /* webpack/runtime/get javascript chunk filename */
|
|
139
|
-
/******/ (() => {
|
|
140
|
-
/******/ // This function allow to reference async chunks
|
|
141
|
-
/******/ __webpack_require__.u = (chunkId) => {
|
|
142
|
-
/******/ // return url for filenames based on template
|
|
143
|
-
/******/ return "" + chunkId + ".js";
|
|
144
|
-
/******/ };
|
|
145
|
-
/******/ })();
|
|
146
|
-
/******/
|
|
147
|
-
/******/ /* webpack/runtime/global */
|
|
148
|
-
/******/ (() => {
|
|
149
|
-
/******/ __webpack_require__.g = (function() {
|
|
150
|
-
/******/ if (typeof globalThis === 'object') return globalThis;
|
|
151
|
-
/******/ try {
|
|
152
|
-
/******/ return this || new Function('return this')();
|
|
153
|
-
/******/ } catch (e) {
|
|
154
|
-
/******/ if (typeof window === 'object') return window;
|
|
155
|
-
/******/ }
|
|
156
|
-
/******/ })();
|
|
157
|
-
/******/ })();
|
|
158
|
-
/******/
|
|
159
142
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
160
143
|
/******/ (() => {
|
|
161
144
|
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
162
145
|
/******/ })();
|
|
163
146
|
/******/
|
|
164
|
-
/******/ /* webpack/runtime/load script */
|
|
165
|
-
/******/ (() => {
|
|
166
|
-
/******/ var inProgress = {};
|
|
167
|
-
/******/ var dataWebpackPrefix = "@tsparticles/interaction-external-connect:";
|
|
168
|
-
/******/ // loadScript function to load a script via script tag
|
|
169
|
-
/******/ __webpack_require__.l = (url, done, key, chunkId) => {
|
|
170
|
-
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
|
|
171
|
-
/******/ var script, needAttach;
|
|
172
|
-
/******/ if(key !== undefined) {
|
|
173
|
-
/******/ var scripts = document.getElementsByTagName("script");
|
|
174
|
-
/******/ for(var i = 0; i < scripts.length; i++) {
|
|
175
|
-
/******/ var s = scripts[i];
|
|
176
|
-
/******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
|
|
177
|
-
/******/ }
|
|
178
|
-
/******/ }
|
|
179
|
-
/******/ if(!script) {
|
|
180
|
-
/******/ needAttach = true;
|
|
181
|
-
/******/ script = document.createElement('script');
|
|
182
|
-
/******/
|
|
183
|
-
/******/ script.charset = 'utf-8';
|
|
184
|
-
/******/ script.timeout = 120;
|
|
185
|
-
/******/ if (__webpack_require__.nc) {
|
|
186
|
-
/******/ script.setAttribute("nonce", __webpack_require__.nc);
|
|
187
|
-
/******/ }
|
|
188
|
-
/******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
|
|
189
|
-
/******/
|
|
190
|
-
/******/ script.src = url;
|
|
191
|
-
/******/ }
|
|
192
|
-
/******/ inProgress[url] = [done];
|
|
193
|
-
/******/ var onScriptComplete = (prev, event) => {
|
|
194
|
-
/******/ // avoid mem leaks in IE.
|
|
195
|
-
/******/ script.onerror = script.onload = null;
|
|
196
|
-
/******/ clearTimeout(timeout);
|
|
197
|
-
/******/ var doneFns = inProgress[url];
|
|
198
|
-
/******/ delete inProgress[url];
|
|
199
|
-
/******/ script.parentNode && script.parentNode.removeChild(script);
|
|
200
|
-
/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
|
|
201
|
-
/******/ if(prev) return prev(event);
|
|
202
|
-
/******/ }
|
|
203
|
-
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
|
|
204
|
-
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
|
|
205
|
-
/******/ script.onload = onScriptComplete.bind(null, script.onload);
|
|
206
|
-
/******/ needAttach && document.head.appendChild(script);
|
|
207
|
-
/******/ };
|
|
208
|
-
/******/ })();
|
|
209
|
-
/******/
|
|
210
147
|
/******/ /* webpack/runtime/make namespace object */
|
|
211
148
|
/******/ (() => {
|
|
212
149
|
/******/ // define __esModule on exports
|
|
@@ -218,121 +155,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
|
218
155
|
/******/ };
|
|
219
156
|
/******/ })();
|
|
220
157
|
/******/
|
|
221
|
-
/******/ /* webpack/runtime/publicPath */
|
|
222
|
-
/******/ (() => {
|
|
223
|
-
/******/ var scriptUrl;
|
|
224
|
-
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
|
|
225
|
-
/******/ var document = __webpack_require__.g.document;
|
|
226
|
-
/******/ if (!scriptUrl && document) {
|
|
227
|
-
/******/ if (document.currentScript)
|
|
228
|
-
/******/ scriptUrl = document.currentScript.src;
|
|
229
|
-
/******/ if (!scriptUrl) {
|
|
230
|
-
/******/ var scripts = document.getElementsByTagName("script");
|
|
231
|
-
/******/ if(scripts.length) {
|
|
232
|
-
/******/ var i = scripts.length - 1;
|
|
233
|
-
/******/ while (i > -1 && !scriptUrl) scriptUrl = scripts[i--].src;
|
|
234
|
-
/******/ }
|
|
235
|
-
/******/ }
|
|
236
|
-
/******/ }
|
|
237
|
-
/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
|
|
238
|
-
/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
|
|
239
|
-
/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
|
|
240
|
-
/******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
|
|
241
|
-
/******/ __webpack_require__.p = scriptUrl;
|
|
242
|
-
/******/ })();
|
|
243
|
-
/******/
|
|
244
|
-
/******/ /* webpack/runtime/jsonp chunk loading */
|
|
245
|
-
/******/ (() => {
|
|
246
|
-
/******/ // no baseURI
|
|
247
|
-
/******/
|
|
248
|
-
/******/ // object to store loaded and loading chunks
|
|
249
|
-
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
|
|
250
|
-
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
|
|
251
|
-
/******/ var installedChunks = {
|
|
252
|
-
/******/ "tsparticles.interaction.external.connect": 0
|
|
253
|
-
/******/ };
|
|
254
|
-
/******/
|
|
255
|
-
/******/ __webpack_require__.f.j = (chunkId, promises) => {
|
|
256
|
-
/******/ // JSONP chunk loading for javascript
|
|
257
|
-
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
|
|
258
|
-
/******/ if(installedChunkData !== 0) { // 0 means "already installed".
|
|
259
|
-
/******/
|
|
260
|
-
/******/ // a Promise means "currently loading".
|
|
261
|
-
/******/ if(installedChunkData) {
|
|
262
|
-
/******/ promises.push(installedChunkData[2]);
|
|
263
|
-
/******/ } else {
|
|
264
|
-
/******/ if(true) { // all chunks have JS
|
|
265
|
-
/******/ // setup Promise in chunk cache
|
|
266
|
-
/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
|
|
267
|
-
/******/ promises.push(installedChunkData[2] = promise);
|
|
268
|
-
/******/
|
|
269
|
-
/******/ // start chunk loading
|
|
270
|
-
/******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
|
|
271
|
-
/******/ // create error before stack unwound to get useful stacktrace later
|
|
272
|
-
/******/ var error = new Error();
|
|
273
|
-
/******/ var loadingEnded = (event) => {
|
|
274
|
-
/******/ if(__webpack_require__.o(installedChunks, chunkId)) {
|
|
275
|
-
/******/ installedChunkData = installedChunks[chunkId];
|
|
276
|
-
/******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
|
|
277
|
-
/******/ if(installedChunkData) {
|
|
278
|
-
/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
|
|
279
|
-
/******/ var realSrc = event && event.target && event.target.src;
|
|
280
|
-
/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
|
|
281
|
-
/******/ error.name = 'ChunkLoadError';
|
|
282
|
-
/******/ error.type = errorType;
|
|
283
|
-
/******/ error.request = realSrc;
|
|
284
|
-
/******/ installedChunkData[1](error);
|
|
285
|
-
/******/ }
|
|
286
|
-
/******/ }
|
|
287
|
-
/******/ };
|
|
288
|
-
/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
|
|
289
|
-
/******/ }
|
|
290
|
-
/******/ }
|
|
291
|
-
/******/ }
|
|
292
|
-
/******/ };
|
|
293
|
-
/******/
|
|
294
|
-
/******/ // no prefetching
|
|
295
|
-
/******/
|
|
296
|
-
/******/ // no preloaded
|
|
297
|
-
/******/
|
|
298
|
-
/******/ // no HMR
|
|
299
|
-
/******/
|
|
300
|
-
/******/ // no HMR manifest
|
|
301
|
-
/******/
|
|
302
|
-
/******/ // no on chunks loaded
|
|
303
|
-
/******/
|
|
304
|
-
/******/ // install a JSONP callback for chunk loading
|
|
305
|
-
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
|
|
306
|
-
/******/ var chunkIds = data[0];
|
|
307
|
-
/******/ var moreModules = data[1];
|
|
308
|
-
/******/ var runtime = data[2];
|
|
309
|
-
/******/ // add "moreModules" to the modules object,
|
|
310
|
-
/******/ // then flag all "chunkIds" as loaded and fire callback
|
|
311
|
-
/******/ var moduleId, chunkId, i = 0;
|
|
312
|
-
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
|
|
313
|
-
/******/ for(moduleId in moreModules) {
|
|
314
|
-
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
|
|
315
|
-
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
|
|
316
|
-
/******/ }
|
|
317
|
-
/******/ }
|
|
318
|
-
/******/ if(runtime) var result = runtime(__webpack_require__);
|
|
319
|
-
/******/ }
|
|
320
|
-
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
|
|
321
|
-
/******/ for(;i < chunkIds.length; i++) {
|
|
322
|
-
/******/ chunkId = chunkIds[i];
|
|
323
|
-
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
|
|
324
|
-
/******/ installedChunks[chunkId][0]();
|
|
325
|
-
/******/ }
|
|
326
|
-
/******/ installedChunks[chunkId] = 0;
|
|
327
|
-
/******/ }
|
|
328
|
-
/******/
|
|
329
|
-
/******/ }
|
|
330
|
-
/******/
|
|
331
|
-
/******/ var chunkLoadingGlobal = this["webpackChunk_tsparticles_interaction_external_connect"] = this["webpackChunk_tsparticles_interaction_external_connect"] || [];
|
|
332
|
-
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
|
|
333
|
-
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
|
|
334
|
-
/******/ })();
|
|
335
|
-
/******/
|
|
336
158
|
/************************************************************************/
|
|
337
159
|
/******/
|
|
338
160
|
/******/ // startup
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.interaction.external.connect.min.js.LICENSE.txt */
|
|
2
|
-
!function(e
|
|
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 n in o)("object"==typeof exports?exports:t)[n]=o[n]}}(this,(t=>(()=>{var e={303:e=>{e.exports=t}},o={};function n(t){var i=o[t];if(void 0!==i)return i.exports;var r=o[t]={exports:{}};return e[t](r,r.exports,n),r.exports}n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{n.r(i),n.d(i,{Connect:()=>o,ConnectLinks:()=>e,loadExternalConnectInteraction:()=>d});var t=n(303);class e{constructor(){this.opacity=.5}load(t){t&&void 0!==t.opacity&&(this.opacity=t.opacity)}}class o{constructor(){this.distance=80,this.links=new e,this.radius=60}load(t){t&&(void 0!==t.distance&&(this.distance=t.distance),this.links.load(t.links),void 0!==t.radius&&(this.radius=t.radius))}}const r=0,s=1;function a(e,o,n,i){const a=e.actualOptions.interactivity.modes.connect;if(a)return function(e,o,n,i){const a=Math.floor(n.getRadius()/o.getRadius()),c=o.getFillColor(),l=n.getFillColor();if(!c||!l)return;const d=o.getPosition(),u=n.getPosition(),p=(0,t.colorMix)(c,l,o.getRadius(),n.getRadius()),y=e.createLinearGradient(d.x,d.y,u.x,u.y);return y.addColorStop(r,(0,t.getStyleFromHsl)(c,i)),y.addColorStop((0,t.clamp)(a,r,s),(0,t.getStyleFromRgb)(p,i)),y.addColorStop(s,(0,t.getStyleFromHsl)(l,i)),y}(o,n,i,a.links.opacity)}function c(e,o,n){e.canvas.draw((i=>{const r=a(e,i,o,n);if(!r)return;const s=o.getPosition(),c=n.getPosition();!function(e,o,n,i,r){(0,t.drawLine)(e,i,r),e.lineWidth=o,e.strokeStyle=n,e.stroke()}(i,o.retina.linksWidth??0,r,s,c)}))}class l extends t.ExternalInteractorBase{constructor(t){super(t)}clear(){}init(){const t=this.container,e=t.actualOptions.interactivity.modes.connect;e&&(t.retina.connectModeDistance=e.distance*t.retina.pixelRatio,t.retina.connectModeRadius=e.radius*t.retina.pixelRatio)}interact(){const t=this.container;if(t.actualOptions.interactivity.events.onHover.enable&&"pointermove"===t.interactivity.status){const e=t.interactivity.mouse.position,{connectModeDistance:o,connectModeRadius:n}=t.retina;if(!o||o<0||!n||n<0||!e)return;const i=Math.abs(n),r=t.particles.quadTree.queryCircle(e,i,(t=>this.isEnabled(t)));r.forEach(((e,n)=>{const i=e.getPosition();for(const s of r.slice(n+1)){const n=s.getPosition(),r=Math.abs(o),a=Math.abs(i.x-n.x),l=Math.abs(i.y-n.y);a<r&&l<r&&c(t,e,s)}}))}}isEnabled(e){const o=this.container,n=o.interactivity.mouse,i=(e?.interactivity??o.actualOptions.interactivity).events;return!(!i.onHover.enable||!n.position)&&(0,t.isInArray)("connect",i.onHover.mode)}loadModeOptions(t,...e){t.connect||(t.connect=new o);for(const o of e)t.connect.load(o?.connect)}reset(){}}async function d(t,e=!0){await t.addInteractor("externalConnect",(t=>Promise.resolve(new l(t))),e)}})(),i})()));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! tsParticles Connect External Interaction v3.
|
|
1
|
+
/*! tsParticles Connect External Interaction v3.4.0 by Matteo Bruni */
|
package/types/Connector.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export declare class Connector extends ExternalInteractorBase<ConnectContainer>
|
|
|
4
4
|
constructor(container: ConnectContainer);
|
|
5
5
|
clear(): void;
|
|
6
6
|
init(): void;
|
|
7
|
-
interact():
|
|
7
|
+
interact(): void;
|
|
8
8
|
isEnabled(particle?: Particle): boolean;
|
|
9
9
|
loadModeOptions(options: Modes & ConnectMode, ...sources: RecursivePartial<(IModes & IConnectMode) | undefined>[]): void;
|
|
10
10
|
reset(): void;
|
package/umd/Connector.js
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
container.retina.connectModeDistance = connect.distance * container.retina.pixelRatio;
|
|
29
29
|
container.retina.connectModeRadius = connect.radius * container.retina.pixelRatio;
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
interact() {
|
|
32
32
|
const container = this.container, options = container.actualOptions;
|
|
33
33
|
if (options.interactivity.events.onHover.enable && container.interactivity.status === "pointermove") {
|
|
34
34
|
const mousePos = container.interactivity.mouse.position, { connectModeDistance, connectModeRadius } = container.retina;
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
!mousePos) {
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
const distance = Math.abs(connectModeRadius), query = container.particles.quadTree.queryCircle(mousePos, distance,
|
|
42
|
+
const distance = Math.abs(connectModeRadius), query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(p));
|
|
43
43
|
query.forEach((p1, i) => {
|
|
44
44
|
const pos1 = p1.getPosition(), indexOffset = 1;
|
|
45
45
|
for (const p2 of query.slice(i + indexOffset)) {
|
|
@@ -50,7 +50,6 @@
|
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
await Promise.resolve();
|
|
54
53
|
}
|
|
55
54
|
isEnabled(particle) {
|
|
56
55
|
const container = this.container, mouse = container.interactivity.mouse, events = (particle?.interactivity ?? container.actualOptions.interactivity).events;
|
package/umd/Utils.js
CHANGED
package/umd/index.js
CHANGED
|
@@ -9,18 +9,6 @@ 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 (mod) {
|
|
18
|
-
if (mod && mod.__esModule) return mod;
|
|
19
|
-
var result = {};
|
|
20
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
21
|
-
__setModuleDefault(result, mod);
|
|
22
|
-
return result;
|
|
23
|
-
};
|
|
24
12
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
25
13
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
26
14
|
};
|
|
@@ -30,17 +18,16 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
30
18
|
if (v !== undefined) module.exports = v;
|
|
31
19
|
}
|
|
32
20
|
else if (typeof define === "function" && define.amd) {
|
|
33
|
-
define(["require", "exports", "./Options/Classes/Connect.js", "./Options/Classes/ConnectLinks.js", "./Options/Interfaces/IConnect.js", "./Options/Interfaces/IConnectLinks.js"], factory);
|
|
21
|
+
define(["require", "exports", "./Connector.js", "./Options/Classes/Connect.js", "./Options/Classes/ConnectLinks.js", "./Options/Interfaces/IConnect.js", "./Options/Interfaces/IConnectLinks.js"], factory);
|
|
34
22
|
}
|
|
35
23
|
})(function (require, exports) {
|
|
36
24
|
"use strict";
|
|
37
|
-
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
|
|
38
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
26
|
exports.loadExternalConnectInteraction = void 0;
|
|
27
|
+
const Connector_js_1 = require("./Connector.js");
|
|
40
28
|
async function loadExternalConnectInteraction(engine, refresh = true) {
|
|
41
|
-
await engine.addInteractor("externalConnect",
|
|
42
|
-
|
|
43
|
-
return new Connector(container);
|
|
29
|
+
await engine.addInteractor("externalConnect", container => {
|
|
30
|
+
return Promise.resolve(new Connector_js_1.Connector(container));
|
|
44
31
|
}, refresh);
|
|
45
32
|
}
|
|
46
33
|
exports.loadExternalConnectInteraction = loadExternalConnectInteraction;
|
package/810.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 810.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_interaction_external_connect=this.webpackChunk_tsparticles_interaction_external_connect||[]).push([[810],{810:(t,n,e)=>{e.d(n,{Connector:()=>l});var o=e(533),i=e(646);const a=0,c=1;function s(t,n,e,i){const s=t.actualOptions.interactivity.modes.connect;if(s)return function(t,n,e,i){const s=Math.floor(e.getRadius()/n.getRadius()),r=n.getFillColor(),l=e.getFillColor();if(!r||!l)return;const d=n.getPosition(),u=e.getPosition(),p=(0,o.colorMix)(r,l,n.getRadius(),e.getRadius()),y=t.createLinearGradient(d.x,d.y,u.x,u.y);return y.addColorStop(a,(0,o.getStyleFromHsl)(r,i)),y.addColorStop((0,o.clamp)(s,a,c),(0,o.getStyleFromRgb)(p,i)),y.addColorStop(c,(0,o.getStyleFromHsl)(l,i)),y}(n,e,i,s.links.opacity)}function r(t,n,e){t.canvas.draw((i=>{const a=s(t,i,n,e);if(!a)return;const c=n.getPosition(),r=e.getPosition();!function(t,n,e,i,a){(0,o.drawLine)(t,i,a),t.lineWidth=n,t.strokeStyle=e,t.stroke()}(i,n.retina.linksWidth??0,a,c,r)}))}class l extends o.ExternalInteractorBase{constructor(t){super(t)}clear(){}init(){const t=this.container,n=t.actualOptions.interactivity.modes.connect;n&&(t.retina.connectModeDistance=n.distance*t.retina.pixelRatio,t.retina.connectModeRadius=n.radius*t.retina.pixelRatio)}async interact(){const t=this.container;if(t.actualOptions.interactivity.events.onHover.enable&&"pointermove"===t.interactivity.status){const n=t.interactivity.mouse.position,{connectModeDistance:e,connectModeRadius:o}=t.retina;if(!e||e<0||!o||o<0||!n)return;const i=Math.abs(o),a=t.particles.quadTree.queryCircle(n,i,(t=>this.isEnabled(t)));a.forEach(((n,o)=>{const i=n.getPosition();for(const c of a.slice(o+1)){const o=c.getPosition(),a=Math.abs(e),s=Math.abs(i.x-o.x),l=Math.abs(i.y-o.y);s<a&&l<a&&r(t,n,c)}}))}await Promise.resolve()}isEnabled(t){const n=this.container,e=n.interactivity.mouse,i=(t?.interactivity??n.actualOptions.interactivity).events;return!(!i.onHover.enable||!e.position)&&(0,o.isInArray)("connect",i.onHover.mode)}loadModeOptions(t,...n){t.connect||(t.connect=new i.l);for(const e of n)t.connect.load(e?.connect)}reset(){}}}}]);
|
package/810.min.js.LICENSE.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Connect External Interaction v3.2.2 by Matteo Bruni */
|
|
@@ -1,40 +0,0 @@
|
|
|
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.2.2
|
|
8
|
-
*/
|
|
9
|
-
"use strict";
|
|
10
|
-
/*
|
|
11
|
-
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
12
|
-
* This devtool is neither made for production nor for readable output files.
|
|
13
|
-
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
14
|
-
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
15
|
-
* or disable the default devtool with "devtool: false".
|
|
16
|
-
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
17
|
-
*/
|
|
18
|
-
(this["webpackChunk_tsparticles_interaction_external_connect"] = this["webpackChunk_tsparticles_interaction_external_connect"] || []).push([["dist_browser_Connector_js"],{
|
|
19
|
-
|
|
20
|
-
/***/ "./dist/browser/Connector.js":
|
|
21
|
-
/*!***********************************!*\
|
|
22
|
-
!*** ./dist/browser/Connector.js ***!
|
|
23
|
-
\***********************************/
|
|
24
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
25
|
-
|
|
26
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Connector: () => (/* binding */ Connector)\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_Connect_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Options/Classes/Connect.js */ \"./dist/browser/Options/Classes/Connect.js\");\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\n\nconst connectMode = \"connect\",\n minDistance = 0;\nclass Connector 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 connect = container.actualOptions.interactivity.modes.connect;\n if (!connect) {\n return;\n }\n container.retina.connectModeDistance = connect.distance * container.retina.pixelRatio;\n container.retina.connectModeRadius = connect.radius * container.retina.pixelRatio;\n }\n async interact() {\n const container = this.container,\n options = container.actualOptions;\n if (options.interactivity.events.onHover.enable && container.interactivity.status === \"pointermove\") {\n const mousePos = container.interactivity.mouse.position,\n {\n connectModeDistance,\n connectModeRadius\n } = container.retina;\n if (!connectModeDistance || connectModeDistance < minDistance || !connectModeRadius || connectModeRadius < minDistance || !mousePos) {\n return;\n }\n const distance = Math.abs(connectModeRadius),\n query = container.particles.quadTree.queryCircle(mousePos, distance, p => this.isEnabled(p));\n query.forEach((p1, i) => {\n const pos1 = p1.getPosition(),\n indexOffset = 1;\n for (const p2 of query.slice(i + indexOffset)) {\n const pos2 = p2.getPosition(),\n distMax = Math.abs(connectModeDistance),\n xDiff = Math.abs(pos1.x - pos2.x),\n yDiff = Math.abs(pos1.y - pos2.y);\n if (xDiff < distMax && yDiff < distMax) {\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.drawConnection)(container, p1, p2);\n }\n }\n });\n }\n await Promise.resolve();\n }\n isEnabled(particle) {\n const container = this.container,\n mouse = container.interactivity.mouse,\n events = (particle?.interactivity ?? container.actualOptions.interactivity).events;\n if (!(events.onHover.enable && mouse.position)) {\n return false;\n }\n return (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isInArray)(connectMode, events.onHover.mode);\n }\n loadModeOptions(options, ...sources) {\n if (!options.connect) {\n options.connect = new _Options_Classes_Connect_js__WEBPACK_IMPORTED_MODULE_2__.Connect();\n }\n for (const source of sources) {\n options.connect.load(source?.connect);\n }\n }\n reset() {}\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-connect/./dist/browser/Connector.js?");
|
|
27
|
-
|
|
28
|
-
/***/ }),
|
|
29
|
-
|
|
30
|
-
/***/ "./dist/browser/Utils.js":
|
|
31
|
-
/*!*******************************!*\
|
|
32
|
-
!*** ./dist/browser/Utils.js ***!
|
|
33
|
-
\*******************************/
|
|
34
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
35
|
-
|
|
36
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ drawConnectLine: () => (/* binding */ drawConnectLine),\n/* harmony export */ drawConnection: () => (/* binding */ drawConnection),\n/* harmony export */ gradient: () => (/* binding */ gradient),\n/* harmony export */ lineStyle: () => (/* binding */ lineStyle)\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\nconst gradientMin = 0,\n gradientMax = 1,\n defaultLinksWidth = 0;\nfunction gradient(context, p1, p2, opacity) {\n const gradStop = Math.floor(p2.getRadius() / p1.getRadius()),\n color1 = p1.getFillColor(),\n color2 = p2.getFillColor();\n if (!color1 || !color2) {\n return;\n }\n const sourcePos = p1.getPosition(),\n destPos = p2.getPosition(),\n midRgb = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.colorMix)(color1, color2, p1.getRadius(), p2.getRadius()),\n grad = context.createLinearGradient(sourcePos.x, sourcePos.y, destPos.x, destPos.y);\n grad.addColorStop(gradientMin, (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getStyleFromHsl)(color1, opacity));\n grad.addColorStop((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.clamp)(gradStop, gradientMin, gradientMax), (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getStyleFromRgb)(midRgb, opacity));\n grad.addColorStop(gradientMax, (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getStyleFromHsl)(color2, opacity));\n return grad;\n}\nfunction drawConnectLine(context, width, lineStyle, begin, end) {\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.drawLine)(context, begin, end);\n context.lineWidth = width;\n context.strokeStyle = lineStyle;\n context.stroke();\n}\nfunction lineStyle(container, ctx, p1, p2) {\n const options = container.actualOptions,\n connectOptions = options.interactivity.modes.connect;\n if (!connectOptions) {\n return;\n }\n return gradient(ctx, p1, p2, connectOptions.links.opacity);\n}\nfunction drawConnection(container, p1, p2) {\n container.canvas.draw(ctx => {\n const ls = lineStyle(container, ctx, p1, p2);\n if (!ls) {\n return;\n }\n const pos1 = p1.getPosition(),\n pos2 = p2.getPosition();\n drawConnectLine(ctx, p1.retina.linksWidth ?? defaultLinksWidth, ls, pos1, pos2);\n });\n}\n\n//# sourceURL=webpack://@tsparticles/interaction-external-connect/./dist/browser/Utils.js?");
|
|
37
|
-
|
|
38
|
-
/***/ })
|
|
39
|
-
|
|
40
|
-
}]);
|