Vector4Editor.js 867 B

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