]> git.r.bdr.sh - rbdr/lissajous/blame - lib/systems/global_adjuster.js
Update mobile CSS
[rbdr/lissajous] / lib / systems / global_adjuster.js
CommitLineData
362f9116
RBR
1import { System } from '@serpentity/serpentity';
2import Frequent from '../nodes/configurable';
3import { settingsContainer, slider } from '../factories/ui';
4
5export default class GlobalAdjuster extends System {
6
7 constructor(container) {
8
9 super();
10 this.container = container;
11 }
12
13 added(engine){
14
15 this.nodes = engine.getNodes(Frequent);
16 const container = document.getElementById('settings');
17 this.adjusterContainer = settingsContainer({
18 id: 'global-adjuster',
19 label: 'Global'
20 });
21
22 let i = 0;
23 for (const node of this.nodes) {
24 const nodeElement = settingsContainer({
25 id: `global-adjuster-${i}`,
26 label: 'Line',
27 level: 3
28 });
29
30 nodeElement.appendChild(slider({
6a87c253 31 id: `global-adjuster-${i}-slider`,
362f9116 32 min: '5',
6a87c253
RBR
33 max: '1000',
34 step: '5',
362f9116
RBR
35 label: '𝜆',
36 className: 'lineLength',
37 get: () => node.configuration.lineLength.toString(),
38 set: (value) => (node.configuration.lineLength = parseFloat(value))
39 }));
40
41 this.adjusterContainer.appendChild(nodeElement);
42 ++i;
43 }
44
45 this.container.appendChild(this.adjusterContainer);
46 }
47
48 removed(){
49
50 this.container.removeChild(this.adjusterContainer);
51 delete this.adjusterContainer;
52 delete this.nodes;
53 }
54
55 update(){}
56};
57
58