PositionEditor.js 676 B

123456789101112131415161718192021222324252627282930
  1. import { ObjectNode, SelectInput, LabelElement } from '../../libs/flow.module.js';
  2. import { PositionNode } from '../../renderers/nodes/Nodes.js';
  3. export class PositionEditor extends ObjectNode {
  4. constructor() {
  5. const node = new PositionNode();
  6. super( 'Position', 3, node, 250 );
  7. this.title.setStyle( 'red' );
  8. const optionsField = new SelectInput( [
  9. { name: 'Local', value: PositionNode.LOCAL },
  10. { name: 'World', value: PositionNode.WORLD },
  11. { name: 'View', value: PositionNode.VIEW }
  12. ] ).onChange( () => {
  13. node.scope = optionsField.getValue();
  14. this.invalidate();
  15. } );
  16. this.add( new LabelElement( 'Scope' ).add( optionsField ) );
  17. }
  18. }