@tsparticles/interaction-particles-links 3.3.0 → 3.5.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/LinkInstance.js +5 -5
- package/browser/Linker.js +3 -3
- package/browser/LinksPlugin.js +3 -3
- package/browser/Utils.js +1 -1
- package/browser/index.js +2 -1
- package/browser/interaction.js +2 -2
- package/browser/plugin.js +2 -1
- package/cjs/LinkInstance.js +5 -5
- package/cjs/Linker.js +3 -3
- package/cjs/LinksPlugin.js +3 -3
- package/cjs/Utils.js +6 -7
- package/cjs/index.js +5 -5
- package/cjs/interaction.js +3 -4
- package/cjs/plugin.js +3 -3
- package/esm/LinkInstance.js +5 -5
- package/esm/Linker.js +3 -3
- package/esm/LinksPlugin.js +3 -3
- package/esm/Utils.js +1 -1
- package/esm/index.js +2 -1
- package/esm/interaction.js +2 -2
- package/esm/plugin.js +2 -1
- package/package.json +2 -2
- package/report.html +1 -1
- package/tsparticles.interaction.particles.links.js +72 -200
- package/tsparticles.interaction.particles.links.min.js +1 -1
- package/tsparticles.interaction.particles.links.min.js.LICENSE.txt +1 -1
- package/types/LinksPlugin.d.ts +1 -1
- package/umd/LinkInstance.js +5 -5
- package/umd/Linker.js +3 -3
- package/umd/LinksPlugin.js +4 -28
- package/umd/Utils.js +6 -7
- package/umd/index.js +6 -19
- package/umd/interaction.js +4 -29
- package/umd/plugin.js +4 -28
- package/33.min.js +0 -2
- package/33.min.js.LICENSE.txt +0 -1
- package/38.min.js +0 -2
- package/38.min.js.LICENSE.txt +0 -1
- package/572.min.js +0 -2
- package/572.min.js.LICENSE.txt +0 -1
- package/905.min.js +0 -2
- package/905.min.js.LICENSE.txt +0 -1
- package/958.min.js +0 -2
- package/958.min.js.LICENSE.txt +0 -1
- package/dist_browser_LinkInstance_js.js +0 -40
- package/dist_browser_Linker_js.js +0 -40
- package/dist_browser_LinksPlugin_js.js +0 -30
- package/dist_browser_interaction_js.js +0 -30
- package/dist_browser_plugin_js.js +0 -30
package/browser/LinkInstance.js
CHANGED
|
@@ -11,7 +11,7 @@ export class LinkInstance {
|
|
|
11
11
|
}
|
|
12
12
|
const container = this.container, options = container.actualOptions, p2 = link.destination, pos1 = p1.getPosition(), pos2 = p2.getPosition();
|
|
13
13
|
let opacity = link.opacity;
|
|
14
|
-
container.canvas.draw(
|
|
14
|
+
container.canvas.draw(ctx => {
|
|
15
15
|
let colorLine;
|
|
16
16
|
const twinkle = p1.options.twinkle?.lines;
|
|
17
17
|
if (twinkle?.enable) {
|
|
@@ -58,7 +58,7 @@ export class LinkInstance {
|
|
|
58
58
|
if (opacityTriangle <= minOpacity) {
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
|
-
container.canvas.draw(
|
|
61
|
+
container.canvas.draw(ctx => {
|
|
62
62
|
const pos1 = p1.getPosition(), pos2 = p2.getPosition(), pos3 = p3.getPosition(), linksDistance = p1.retina.linksDistance ?? minDistance;
|
|
63
63
|
if (getDistance(pos1, pos2) > linksDistance ||
|
|
64
64
|
getDistance(pos3, pos2) > linksDistance ||
|
|
@@ -91,11 +91,11 @@ export class LinkInstance {
|
|
|
91
91
|
if (!(options.links?.triangles.enable && p2.options.links?.triangles.enable)) {
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
|
-
const vertices = p2.links?.filter(
|
|
94
|
+
const vertices = p2.links?.filter(t => {
|
|
95
95
|
const linkFreq = this._getLinkFrequency(p2, t.destination), minCount = 0;
|
|
96
96
|
return (p2.options.links &&
|
|
97
97
|
linkFreq <= p2.options.links.frequency &&
|
|
98
|
-
p1Links.findIndex(
|
|
98
|
+
p1Links.findIndex(l => l.destination === t.destination) >= minCount);
|
|
99
99
|
});
|
|
100
100
|
if (!vertices?.length) {
|
|
101
101
|
return;
|
|
@@ -124,7 +124,7 @@ export class LinkInstance {
|
|
|
124
124
|
if (!links?.length) {
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
|
-
const p1Links = links.filter(
|
|
127
|
+
const p1Links = links.filter(l => options.links &&
|
|
128
128
|
(options.links.frequency >= maxFrequency ||
|
|
129
129
|
this._getLinkFrequency(particle, l.destination) <= options.links.frequency));
|
|
130
130
|
for (const link of p1Links) {
|
package/browser/Linker.js
CHANGED
|
@@ -22,7 +22,7 @@ function getLinkDistance(pos1, pos2, optDistance, canvasSize, warp) {
|
|
|
22
22
|
export class Linker extends ParticlesInteractorBase {
|
|
23
23
|
constructor(container) {
|
|
24
24
|
super(container);
|
|
25
|
-
this._setColor =
|
|
25
|
+
this._setColor = p1 => {
|
|
26
26
|
if (!p1.options.links) {
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
@@ -76,8 +76,8 @@ export class Linker extends ParticlesInteractorBase {
|
|
|
76
76
|
p2.spawning ||
|
|
77
77
|
p2.destroyed ||
|
|
78
78
|
!p2.links ||
|
|
79
|
-
p1.links.some(
|
|
80
|
-
p2.links.some(
|
|
79
|
+
p1.links.some(t => t.destination === p2) ||
|
|
80
|
+
p2.links.some(t => t.destination === p1)) {
|
|
81
81
|
continue;
|
|
82
82
|
}
|
|
83
83
|
const pos2 = p2.getPosition();
|
package/browser/LinksPlugin.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { LinkInstance } from "./LinkInstance.js";
|
|
1
2
|
export class LinksPlugin {
|
|
2
3
|
constructor() {
|
|
3
4
|
this.id = "links";
|
|
4
5
|
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return new LinkInstance(container);
|
|
6
|
+
getPlugin(container) {
|
|
7
|
+
return Promise.resolve(new LinkInstance(container));
|
|
8
8
|
}
|
|
9
9
|
loadOptions() {
|
|
10
10
|
}
|
package/browser/Utils.js
CHANGED
|
@@ -90,7 +90,7 @@ export function getLinkKey(ids) {
|
|
|
90
90
|
return ids.join("_");
|
|
91
91
|
}
|
|
92
92
|
export function setLinkFrequency(particles, dictionary) {
|
|
93
|
-
const key = getLinkKey(particles.map(
|
|
93
|
+
const key = getLinkKey(particles.map(t => t.id));
|
|
94
94
|
let res = dictionary.get(key);
|
|
95
95
|
if (res === undefined) {
|
|
96
96
|
res = getRandom();
|
package/browser/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { loadLinksInteraction } from "./interaction.js";
|
|
2
|
+
import { loadLinksPlugin } from "./plugin.js";
|
|
1
3
|
export async function loadParticlesLinksInteraction(engine, refresh = true) {
|
|
2
|
-
const { loadLinksInteraction } = await import("./interaction.js"), { loadLinksPlugin } = await import("./plugin.js");
|
|
3
4
|
await loadLinksInteraction(engine, refresh);
|
|
4
5
|
await loadLinksPlugin(engine, refresh);
|
|
5
6
|
}
|
package/browser/interaction.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Linker } from "./Linker.js";
|
|
1
2
|
export async function loadLinksInteraction(engine, refresh = true) {
|
|
2
3
|
await engine.addInteractor("particlesLinks", async (container) => {
|
|
3
|
-
|
|
4
|
-
return new Linker(container);
|
|
4
|
+
return Promise.resolve(new Linker(container));
|
|
5
5
|
}, refresh);
|
|
6
6
|
}
|
package/browser/plugin.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { LinksPlugin } from "./LinksPlugin.js";
|
|
1
2
|
export async function loadLinksPlugin(engine, refresh = true) {
|
|
2
|
-
const
|
|
3
|
+
const plugin = new LinksPlugin();
|
|
3
4
|
await engine.addPlugin(plugin, refresh);
|
|
4
5
|
}
|
package/cjs/LinkInstance.js
CHANGED
|
@@ -14,7 +14,7 @@ class LinkInstance {
|
|
|
14
14
|
}
|
|
15
15
|
const container = this.container, options = container.actualOptions, p2 = link.destination, pos1 = p1.getPosition(), pos2 = p2.getPosition();
|
|
16
16
|
let opacity = link.opacity;
|
|
17
|
-
container.canvas.draw(
|
|
17
|
+
container.canvas.draw(ctx => {
|
|
18
18
|
let colorLine;
|
|
19
19
|
const twinkle = p1.options.twinkle?.lines;
|
|
20
20
|
if (twinkle?.enable) {
|
|
@@ -61,7 +61,7 @@ class LinkInstance {
|
|
|
61
61
|
if (opacityTriangle <= minOpacity) {
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
|
-
container.canvas.draw(
|
|
64
|
+
container.canvas.draw(ctx => {
|
|
65
65
|
const pos1 = p1.getPosition(), pos2 = p2.getPosition(), pos3 = p3.getPosition(), linksDistance = p1.retina.linksDistance ?? minDistance;
|
|
66
66
|
if ((0, engine_1.getDistance)(pos1, pos2) > linksDistance ||
|
|
67
67
|
(0, engine_1.getDistance)(pos3, pos2) > linksDistance ||
|
|
@@ -94,11 +94,11 @@ class LinkInstance {
|
|
|
94
94
|
if (!(options.links?.triangles.enable && p2.options.links?.triangles.enable)) {
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
|
-
const vertices = p2.links?.filter(
|
|
97
|
+
const vertices = p2.links?.filter(t => {
|
|
98
98
|
const linkFreq = this._getLinkFrequency(p2, t.destination), minCount = 0;
|
|
99
99
|
return (p2.options.links &&
|
|
100
100
|
linkFreq <= p2.options.links.frequency &&
|
|
101
|
-
p1Links.findIndex(
|
|
101
|
+
p1Links.findIndex(l => l.destination === t.destination) >= minCount);
|
|
102
102
|
});
|
|
103
103
|
if (!vertices?.length) {
|
|
104
104
|
return;
|
|
@@ -127,7 +127,7 @@ class LinkInstance {
|
|
|
127
127
|
if (!links?.length) {
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
130
|
-
const p1Links = links.filter(
|
|
130
|
+
const p1Links = links.filter(l => options.links &&
|
|
131
131
|
(options.links.frequency >= maxFrequency ||
|
|
132
132
|
this._getLinkFrequency(particle, l.destination) <= options.links.frequency));
|
|
133
133
|
for (const link of p1Links) {
|
package/cjs/Linker.js
CHANGED
|
@@ -25,7 +25,7 @@ function getLinkDistance(pos1, pos2, optDistance, canvasSize, warp) {
|
|
|
25
25
|
class Linker extends engine_1.ParticlesInteractorBase {
|
|
26
26
|
constructor(container) {
|
|
27
27
|
super(container);
|
|
28
|
-
this._setColor =
|
|
28
|
+
this._setColor = p1 => {
|
|
29
29
|
if (!p1.options.links) {
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
@@ -79,8 +79,8 @@ class Linker extends engine_1.ParticlesInteractorBase {
|
|
|
79
79
|
p2.spawning ||
|
|
80
80
|
p2.destroyed ||
|
|
81
81
|
!p2.links ||
|
|
82
|
-
p1.links.some(
|
|
83
|
-
p2.links.some(
|
|
82
|
+
p1.links.some(t => t.destination === p2) ||
|
|
83
|
+
p2.links.some(t => t.destination === p1)) {
|
|
84
84
|
continue;
|
|
85
85
|
}
|
|
86
86
|
const pos2 = p2.getPosition();
|
package/cjs/LinksPlugin.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LinksPlugin = void 0;
|
|
4
|
+
const LinkInstance_js_1 = require("./LinkInstance.js");
|
|
4
5
|
class LinksPlugin {
|
|
5
6
|
constructor() {
|
|
6
7
|
this.id = "links";
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return new LinkInstance(container);
|
|
9
|
+
getPlugin(container) {
|
|
10
|
+
return Promise.resolve(new LinkInstance_js_1.LinkInstance(container));
|
|
11
11
|
}
|
|
12
12
|
loadOptions() {
|
|
13
13
|
}
|
package/cjs/Utils.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.drawTriangle = drawTriangle;
|
|
4
|
+
exports.drawLinkLine = drawLinkLine;
|
|
5
|
+
exports.drawLinkTriangle = drawLinkTriangle;
|
|
6
|
+
exports.getLinkKey = getLinkKey;
|
|
7
|
+
exports.setLinkFrequency = setLinkFrequency;
|
|
4
8
|
const engine_1 = require("@tsparticles/engine");
|
|
5
9
|
function drawTriangle(context, p1, p2, p3) {
|
|
6
10
|
context.beginPath();
|
|
@@ -9,7 +13,6 @@ function drawTriangle(context, p1, p2, p3) {
|
|
|
9
13
|
context.lineTo(p3.x, p3.y);
|
|
10
14
|
context.closePath();
|
|
11
15
|
}
|
|
12
|
-
exports.drawTriangle = drawTriangle;
|
|
13
16
|
function drawLinkLine(params) {
|
|
14
17
|
let drawn = false;
|
|
15
18
|
const { begin, end, maxDistance, context, canvasSize, width, backgroundMask, colorLine, opacity, links } = params;
|
|
@@ -80,7 +83,6 @@ function drawLinkLine(params) {
|
|
|
80
83
|
}
|
|
81
84
|
context.stroke();
|
|
82
85
|
}
|
|
83
|
-
exports.drawLinkLine = drawLinkLine;
|
|
84
86
|
function drawLinkTriangle(params) {
|
|
85
87
|
const { context, pos1, pos2, pos3, backgroundMask, colorTriangle, opacityTriangle } = params;
|
|
86
88
|
drawTriangle(context, pos1, pos2, pos3);
|
|
@@ -90,14 +92,12 @@ function drawLinkTriangle(params) {
|
|
|
90
92
|
context.fillStyle = (0, engine_1.getStyleFromRgb)(colorTriangle, opacityTriangle);
|
|
91
93
|
context.fill();
|
|
92
94
|
}
|
|
93
|
-
exports.drawLinkTriangle = drawLinkTriangle;
|
|
94
95
|
function getLinkKey(ids) {
|
|
95
96
|
ids.sort((a, b) => a - b);
|
|
96
97
|
return ids.join("_");
|
|
97
98
|
}
|
|
98
|
-
exports.getLinkKey = getLinkKey;
|
|
99
99
|
function setLinkFrequency(particles, dictionary) {
|
|
100
|
-
const key = getLinkKey(particles.map(
|
|
100
|
+
const key = getLinkKey(particles.map(t => t.id));
|
|
101
101
|
let res = dictionary.get(key);
|
|
102
102
|
if (res === undefined) {
|
|
103
103
|
res = (0, engine_1.getRandom)();
|
|
@@ -105,4 +105,3 @@ function setLinkFrequency(particles, dictionary) {
|
|
|
105
105
|
}
|
|
106
106
|
return res;
|
|
107
107
|
}
|
|
108
|
-
exports.setLinkFrequency = setLinkFrequency;
|
package/cjs/index.js
CHANGED
|
@@ -14,13 +14,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.loadParticlesLinksInteraction =
|
|
17
|
+
exports.loadParticlesLinksInteraction = loadParticlesLinksInteraction;
|
|
18
|
+
const interaction_js_1 = require("./interaction.js");
|
|
19
|
+
const plugin_js_1 = require("./plugin.js");
|
|
18
20
|
async function loadParticlesLinksInteraction(engine, refresh = true) {
|
|
19
|
-
|
|
20
|
-
await
|
|
21
|
-
await loadLinksPlugin(engine, refresh);
|
|
21
|
+
await (0, interaction_js_1.loadLinksInteraction)(engine, refresh);
|
|
22
|
+
await (0, plugin_js_1.loadLinksPlugin)(engine, refresh);
|
|
22
23
|
}
|
|
23
|
-
exports.loadParticlesLinksInteraction = loadParticlesLinksInteraction;
|
|
24
24
|
__exportStar(require("./Options/Classes/Links.js"), exports);
|
|
25
25
|
__exportStar(require("./Options/Classes/LinksShadow.js"), exports);
|
|
26
26
|
__exportStar(require("./Options/Classes/LinksTriangle.js"), exports);
|
package/cjs/interaction.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.loadLinksInteraction =
|
|
3
|
+
exports.loadLinksInteraction = loadLinksInteraction;
|
|
4
|
+
const Linker_js_1 = require("./Linker.js");
|
|
4
5
|
async function loadLinksInteraction(engine, refresh = true) {
|
|
5
6
|
await engine.addInteractor("particlesLinks", async (container) => {
|
|
6
|
-
|
|
7
|
-
return new Linker(container);
|
|
7
|
+
return Promise.resolve(new Linker_js_1.Linker(container));
|
|
8
8
|
}, refresh);
|
|
9
9
|
}
|
|
10
|
-
exports.loadLinksInteraction = loadLinksInteraction;
|
package/cjs/plugin.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.loadLinksPlugin =
|
|
3
|
+
exports.loadLinksPlugin = loadLinksPlugin;
|
|
4
|
+
const LinksPlugin_js_1 = require("./LinksPlugin.js");
|
|
4
5
|
async function loadLinksPlugin(engine, refresh = true) {
|
|
5
|
-
const
|
|
6
|
+
const plugin = new LinksPlugin_js_1.LinksPlugin();
|
|
6
7
|
await engine.addPlugin(plugin, refresh);
|
|
7
8
|
}
|
|
8
|
-
exports.loadLinksPlugin = loadLinksPlugin;
|
package/esm/LinkInstance.js
CHANGED
|
@@ -11,7 +11,7 @@ export class LinkInstance {
|
|
|
11
11
|
}
|
|
12
12
|
const container = this.container, options = container.actualOptions, p2 = link.destination, pos1 = p1.getPosition(), pos2 = p2.getPosition();
|
|
13
13
|
let opacity = link.opacity;
|
|
14
|
-
container.canvas.draw(
|
|
14
|
+
container.canvas.draw(ctx => {
|
|
15
15
|
let colorLine;
|
|
16
16
|
const twinkle = p1.options.twinkle?.lines;
|
|
17
17
|
if (twinkle?.enable) {
|
|
@@ -58,7 +58,7 @@ export class LinkInstance {
|
|
|
58
58
|
if (opacityTriangle <= minOpacity) {
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
|
-
container.canvas.draw(
|
|
61
|
+
container.canvas.draw(ctx => {
|
|
62
62
|
const pos1 = p1.getPosition(), pos2 = p2.getPosition(), pos3 = p3.getPosition(), linksDistance = p1.retina.linksDistance ?? minDistance;
|
|
63
63
|
if (getDistance(pos1, pos2) > linksDistance ||
|
|
64
64
|
getDistance(pos3, pos2) > linksDistance ||
|
|
@@ -91,11 +91,11 @@ export class LinkInstance {
|
|
|
91
91
|
if (!(options.links?.triangles.enable && p2.options.links?.triangles.enable)) {
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
|
-
const vertices = p2.links?.filter(
|
|
94
|
+
const vertices = p2.links?.filter(t => {
|
|
95
95
|
const linkFreq = this._getLinkFrequency(p2, t.destination), minCount = 0;
|
|
96
96
|
return (p2.options.links &&
|
|
97
97
|
linkFreq <= p2.options.links.frequency &&
|
|
98
|
-
p1Links.findIndex(
|
|
98
|
+
p1Links.findIndex(l => l.destination === t.destination) >= minCount);
|
|
99
99
|
});
|
|
100
100
|
if (!vertices?.length) {
|
|
101
101
|
return;
|
|
@@ -124,7 +124,7 @@ export class LinkInstance {
|
|
|
124
124
|
if (!links?.length) {
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
|
-
const p1Links = links.filter(
|
|
127
|
+
const p1Links = links.filter(l => options.links &&
|
|
128
128
|
(options.links.frequency >= maxFrequency ||
|
|
129
129
|
this._getLinkFrequency(particle, l.destination) <= options.links.frequency));
|
|
130
130
|
for (const link of p1Links) {
|
package/esm/Linker.js
CHANGED
|
@@ -22,7 +22,7 @@ function getLinkDistance(pos1, pos2, optDistance, canvasSize, warp) {
|
|
|
22
22
|
export class Linker extends ParticlesInteractorBase {
|
|
23
23
|
constructor(container) {
|
|
24
24
|
super(container);
|
|
25
|
-
this._setColor =
|
|
25
|
+
this._setColor = p1 => {
|
|
26
26
|
if (!p1.options.links) {
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
@@ -76,8 +76,8 @@ export class Linker extends ParticlesInteractorBase {
|
|
|
76
76
|
p2.spawning ||
|
|
77
77
|
p2.destroyed ||
|
|
78
78
|
!p2.links ||
|
|
79
|
-
p1.links.some(
|
|
80
|
-
p2.links.some(
|
|
79
|
+
p1.links.some(t => t.destination === p2) ||
|
|
80
|
+
p2.links.some(t => t.destination === p1)) {
|
|
81
81
|
continue;
|
|
82
82
|
}
|
|
83
83
|
const pos2 = p2.getPosition();
|
package/esm/LinksPlugin.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { LinkInstance } from "./LinkInstance.js";
|
|
1
2
|
export class LinksPlugin {
|
|
2
3
|
constructor() {
|
|
3
4
|
this.id = "links";
|
|
4
5
|
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return new LinkInstance(container);
|
|
6
|
+
getPlugin(container) {
|
|
7
|
+
return Promise.resolve(new LinkInstance(container));
|
|
8
8
|
}
|
|
9
9
|
loadOptions() {
|
|
10
10
|
}
|
package/esm/Utils.js
CHANGED
|
@@ -90,7 +90,7 @@ export function getLinkKey(ids) {
|
|
|
90
90
|
return ids.join("_");
|
|
91
91
|
}
|
|
92
92
|
export function setLinkFrequency(particles, dictionary) {
|
|
93
|
-
const key = getLinkKey(particles.map(
|
|
93
|
+
const key = getLinkKey(particles.map(t => t.id));
|
|
94
94
|
let res = dictionary.get(key);
|
|
95
95
|
if (res === undefined) {
|
|
96
96
|
res = getRandom();
|
package/esm/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { loadLinksInteraction } from "./interaction.js";
|
|
2
|
+
import { loadLinksPlugin } from "./plugin.js";
|
|
1
3
|
export async function loadParticlesLinksInteraction(engine, refresh = true) {
|
|
2
|
-
const { loadLinksInteraction } = await import("./interaction.js"), { loadLinksPlugin } = await import("./plugin.js");
|
|
3
4
|
await loadLinksInteraction(engine, refresh);
|
|
4
5
|
await loadLinksPlugin(engine, refresh);
|
|
5
6
|
}
|
package/esm/interaction.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Linker } from "./Linker.js";
|
|
1
2
|
export async function loadLinksInteraction(engine, refresh = true) {
|
|
2
3
|
await engine.addInteractor("particlesLinks", async (container) => {
|
|
3
|
-
|
|
4
|
-
return new Linker(container);
|
|
4
|
+
return Promise.resolve(new Linker(container));
|
|
5
5
|
}, refresh);
|
|
6
6
|
}
|
package/esm/plugin.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { LinksPlugin } from "./LinksPlugin.js";
|
|
1
2
|
export async function loadLinksPlugin(engine, refresh = true) {
|
|
2
|
-
const
|
|
3
|
+
const plugin = new LinksPlugin();
|
|
3
4
|
await engine.addPlugin(plugin, refresh);
|
|
4
5
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/interaction-particles-links",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "tsParticles links particles 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.5.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-particles-links [
|
|
6
|
+
<title>@tsparticles/interaction-particles-links [1 Jul 2024 at 09:17]</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/sKBvik8opWGBMOAe3l1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