Vector3Editor.js 741 B

123456789101112131415161718192021222324252627282930
  1. import { ObjectNode, NumberInput, LabelElement } from '../../libs/flow.module.js';
  2. import { Vector3Node } from '../../renderers/nodes/Nodes.js';
  3. export class Vector3Editor extends ObjectNode {
  4. constructor() {
  5. const node = new Vector3Node();
  6. super( 'Vector 3', 3, node );
  7. this.title.setIcon( 'ti ti-box-multiple-3' );
  8. const onUpdate = () => {
  9. node.value.x = fieldX.getValue();
  10. node.value.y = fieldY.getValue();
  11. node.value.z = fieldZ.getValue();
  12. };
  13. const fieldX = new NumberInput().onChange( onUpdate );
  14. const fieldY = new NumberInput().onChange( onUpdate );
  15. const fieldZ = new NumberInput().onChange( onUpdate );
  16. this.add( new LabelElement( 'Values' ).add( fieldX ).add( fieldY ).add( fieldZ ) );
  17. }
  18. }