1 | import { Utils } from "../../Utils";
|
2 | import { HoverMode } from "../../Enums/Modes";
|
3 | export class Lighter {
|
4 | constructor(container) {
|
5 | this.container = container;
|
6 | }
|
7 | interact(particle) {
|
8 | const container = this.container;
|
9 | const options = container.actualOptions;
|
10 | if (options.interactivity.events.onHover.enable && container.interactivity.status === "mousemove") {
|
11 | const mousePos = this.container.interactivity.mouse.position;
|
12 | if (mousePos) {
|
13 | container.canvas.drawParticleShadow(particle, mousePos);
|
14 | }
|
15 | }
|
16 | }
|
17 | isEnabled() {
|
18 | const container = this.container;
|
19 | const mouse = container.interactivity.mouse;
|
20 | const events = container.actualOptions.interactivity.events;
|
21 | if (!(events.onHover.enable && mouse.position)) {
|
22 | return false;
|
23 | }
|
24 | const hoverMode = events.onHover.mode;
|
25 | return Utils.isInArray(HoverMode.light, hoverMode);
|
26 | }
|
27 | reset() {
|
28 | }
|
29 | }
|