123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- /**
- * @author mrdoob / http://mrdoob.com/
- */
- import { BoxBufferGeometry } from '../../build/three.module.js';
- import { UIRow, UIText, UINumber, UIInteger } from './libs/ui.js';
- import { SetGeometryCommand } from './commands/SetGeometryCommand.js';
- var SidebarGeometryBoxGeometry = function ( editor, object ) {
- var strings = editor.strings;
- var container = new UIRow();
- var geometry = object.geometry;
- var parameters = geometry.parameters;
- // width
- var widthRow = new UIRow();
- var width = new UINumber( parameters.width ).onChange( update );
- widthRow.add( new UIText( strings.getKey( 'sidebar/geometry/box_geometry/width' ) ).setWidth( '90px' ) );
- widthRow.add( width );
- container.add( widthRow );
- // height
- var heightRow = new UIRow();
- var height = new UINumber( parameters.height ).onChange( update );
- heightRow.add( new UIText( strings.getKey( 'sidebar/geometry/box_geometry/height' ) ).setWidth( '90px' ) );
- heightRow.add( height );
- container.add( heightRow );
- // depth
- var depthRow = new UIRow();
- var depth = new UINumber( parameters.depth ).onChange( update );
- depthRow.add( new UIText( strings.getKey( 'sidebar/geometry/box_geometry/depth' ) ).setWidth( '90px' ) );
- depthRow.add( depth );
- container.add( depthRow );
- // widthSegments
- var widthSegmentsRow = new UIRow();
- var widthSegments = new UIInteger( parameters.widthSegments ).setRange( 1, Infinity ).onChange( update );
- widthSegmentsRow.add( new UIText( strings.getKey( 'sidebar/geometry/box_geometry/widthseg' ) ).setWidth( '90px' ) );
- widthSegmentsRow.add( widthSegments );
- container.add( widthSegmentsRow );
- // heightSegments
- var heightSegmentsRow = new UIRow();
- var heightSegments = new UIInteger( parameters.heightSegments ).setRange( 1, Infinity ).onChange( update );
- heightSegmentsRow.add( new UIText( strings.getKey( 'sidebar/geometry/box_geometry/heightseg' ) ).setWidth( '90px' ) );
- heightSegmentsRow.add( heightSegments );
- container.add( heightSegmentsRow );
- // depthSegments
- var depthSegmentsRow = new UIRow();
- var depthSegments = new UIInteger( parameters.depthSegments ).setRange( 1, Infinity ).onChange( update );
- depthSegmentsRow.add( new UIText( strings.getKey( 'sidebar/geometry/box_geometry/depthseg' ) ).setWidth( '90px' ) );
- depthSegmentsRow.add( depthSegments );
- container.add( depthSegmentsRow );
- //
- function update() {
- editor.execute( new SetGeometryCommand( editor, object, new BoxBufferGeometry(
- width.getValue(),
- height.getValue(),
- depth.getValue(),
- widthSegments.getValue(),
- heightSegments.getValue(),
- depthSegments.getValue()
- ) ) );
- }
- return container;
- };
- export { SidebarGeometryBoxGeometry };
|