]>
git.r.bdr.sh - rbdr/lissajous/blob - lib/systems/camera_adjuster.js
3b6ea41afe194e7d825426da1a3805f5601f24ab
1 import { System
} from '@serpentity/serpentity';
2 import Cameras
from '../nodes/cameras';
3 import { settingsContainer
, slider
} from '../factories/ui';
13 export default class CameraAdjuster
extends System
{
15 constructor(container
) {
18 this.container
= container
;
23 this.nodes
= engine
.getNodes(Cameras
);
24 this.adjusterContainer
= settingsContainer({
25 id: 'camera-adjuster',
30 for (const node
of this.nodes
) {
31 const nodeElement
= settingsContainer({
32 id: `camera-adjuster-${i}`,
37 nodeElement
.appendChild(slider({
43 get: () => node
.radius
.radius
.toString(),
44 set: (value
) => (node
.radius
.radius
= parseFloat(value
))
47 ['x', 'y', 'z'].forEach(key
=> {
48 nodeElement
.appendChild(slider({
52 label: internals
.symbols
[key
],
53 className: `rotation-${key}`,
54 get: () => node
.velocity
[key
].toString(),
55 set: (value
) => (node
.velocity
[key
] = parseFloat(value
))
59 this.adjusterContainer
.appendChild(nodeElement
);
63 this.container
.appendChild(this.adjusterContainer
);
68 this.container
.removeChild(this.adjusterContainer
);
69 delete this.adjusterContainer
;