You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
687 B

2 years ago
import { NumberInput, LabelElement } from '../../libs/flow.module.js';
import { BaseNode } from '../core/BaseNode.js';
import { Vector2 } from 'three';
import { UniformNode } from 'three/nodes';
export class Vector2Editor extends BaseNode {
constructor() {
const node = new UniformNode( new Vector2() );
super( 'Vector 2', 2, node );
const onUpdate = () => {
node.value.x = fieldX.getValue();
node.value.y = fieldY.getValue();
};
const fieldX = new NumberInput().setTagColor( 'red' ).onChange( onUpdate );
const fieldY = new NumberInput().setTagColor( 'green' ).onChange( onUpdate );
this.add( new LabelElement( 'XY' ).add( fieldX ).add( fieldY ) );
}
}