]>
git.r.bdr.sh - rbdr/lissajous/blob - lib/systems/global_adjuster.js
f7433ca1e3c58e2867452ad990ea019dcaf05f20
1 import { System
} from '@serpentity/serpentity';
2 import Frequent
from '../nodes/configurable';
3 import { settingsContainer
, slider
} from '../factories/ui';
5 export default class GlobalAdjuster
extends System
{
7 constructor(container
) {
10 this.container
= container
;
15 this.nodes
= engine
.getNodes(Frequent
);
16 const container
= document
.getElementById('settings');
17 this.adjusterContainer
= settingsContainer({
18 id: 'global-adjuster',
23 for (const node
of this.nodes
) {
24 const nodeElement
= settingsContainer({
25 id: `global-adjuster-${i}`,
30 nodeElement
.appendChild(slider({
31 id: `global-adjuster-${i}-slider`,
36 className: 'lineLength',
37 get: () => node
.configuration
.lineLength
.toString(),
38 set: (value
) => (node
.configuration
.lineLength
= parseFloat(value
))
41 this.adjusterContainer
.appendChild(nodeElement
);
45 this.container
.appendChild(this.adjusterContainer
);
50 this.container
.removeChild(this.adjusterContainer
);
51 delete this.adjusterContainer
;