]>
git.r.bdr.sh - rbdr/lissajous/blob - lib/systems/camera_adjuster.js
9182343c54122348c451597717300d1f5e3a741d
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({
38 id: `camera-adjuster-${i}-slider-radius`,
44 get: () => node
.radius
.radius
.toString(),
45 set: (value
) => (node
.radius
.radius
= parseFloat(value
))
48 ['x', 'y', 'z'].forEach(key
=> {
49 nodeElement
.appendChild(slider({
50 id: `camera-adjuster-${i}-slider-${key}`,
54 label: internals
.symbols
[key
],
55 className: `rotation-${key}`,
56 get: () => node
.velocity
[key
].toString(),
57 set: (value
) => (node
.velocity
[key
] = parseFloat(value
))
61 this.adjusterContainer
.appendChild(nodeElement
);
65 this.container
.appendChild(this.adjusterContainer
);
70 this.container
.removeChild(this.adjusterContainer
);
71 delete this.adjusterContainer
;