123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- /**
- * @author mrdoob / http://mrdoob.com/
- */
- import * as THREE from '../../build/three.module.js';
- import { UIRow, UIText, UIInteger, UICheckbox, UINumber } from './libs/ui.js';
- import { SetGeometryCommand } from './commands/SetGeometryCommand.js';
- var SidebarGeometryCylinderGeometry = function ( editor, object ) {
- var strings = editor.strings;
- var container = new UIRow();
- var geometry = object.geometry;
- var parameters = geometry.parameters;
- // radiusTop
- var radiusTopRow = new UIRow();
- var radiusTop = new UINumber( parameters.radiusTop ).onChange( update );
- radiusTopRow.add( new UIText( strings.getKey( 'sidebar/geometry/cylinder_geometry/radiustop' ) ).setWidth( '90px' ) );
- radiusTopRow.add( radiusTop );
- container.add( radiusTopRow );
- // radiusBottom
- var radiusBottomRow = new UIRow();
- var radiusBottom = new UINumber( parameters.radiusBottom ).onChange( update );
- radiusBottomRow.add( new UIText( strings.getKey( 'sidebar/geometry/cylinder_geometry/radiusbottom' ) ).setWidth( '90px' ) );
- radiusBottomRow.add( radiusBottom );
- container.add( radiusBottomRow );
- // height
- var heightRow = new UIRow();
- var height = new UINumber( parameters.height ).onChange( update );
- heightRow.add( new UIText( strings.getKey( 'sidebar/geometry/cylinder_geometry/height' ) ).setWidth( '90px' ) );
- heightRow.add( height );
- container.add( heightRow );
- // radialSegments
- var radialSegmentsRow = new UIRow();
- var radialSegments = new UIInteger( parameters.radialSegments ).setRange( 1, Infinity ).onChange( update );
- radialSegmentsRow.add( new UIText( strings.getKey( 'sidebar/geometry/cylinder_geometry/radialsegments' ) ).setWidth( '90px' ) );
- radialSegmentsRow.add( radialSegments );
- container.add( radialSegmentsRow );
- // heightSegments
- var heightSegmentsRow = new UIRow();
- var heightSegments = new UIInteger( parameters.heightSegments ).setRange( 1, Infinity ).onChange( update );
- heightSegmentsRow.add( new UIText( strings.getKey( 'sidebar/geometry/cylinder_geometry/heightsegments' ) ).setWidth( '90px' ) );
- heightSegmentsRow.add( heightSegments );
- container.add( heightSegmentsRow );
- // openEnded
- var openEndedRow = new UIRow();
- var openEnded = new UICheckbox( parameters.openEnded ).onChange( update );
- openEndedRow.add( new UIText( strings.getKey( 'sidebar/geometry/cylinder_geometry/openended' ) ).setWidth( '90px' ) );
- openEndedRow.add( openEnded );
- container.add( openEndedRow );
- //
- function update() {
- editor.execute( new SetGeometryCommand( editor, object, new THREE.CylinderBufferGeometry(
- radiusTop.getValue(),
- radiusBottom.getValue(),
- height.getValue(),
- radialSegments.getValue(),
- heightSegments.getValue(),
- openEnded.getValue()
- ) ) );
- }
- return container;
- };
- export { SidebarGeometryCylinderGeometry };
|