UVEditor.js 580 B

1234567891011121314151617181920212223242526272829
  1. import { SelectInput, LabelElement } from 'flow';
  2. import { BaseNodeEditor } from '../BaseNodeEditor.js';
  3. import { uv } from 'three/nodes';
  4. export class UVEditor extends BaseNodeEditor {
  5. constructor() {
  6. const node = uv();
  7. super( 'UV', node, 200 );
  8. this.setOutputLength( 2 );
  9. const options = Array.from( Array( 4 ).keys() ).map( String );
  10. const optionsField = new SelectInput( options, 0 ).onChange( () => {
  11. node.index = Number( optionsField.getValue() );
  12. this.invalidate();
  13. } );
  14. this.add( new LabelElement( 'Channel' ).add( optionsField ) );
  15. }
  16. }