Sidebar.Geometry.CylinderGeometry.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. */
  4. Sidebar.Geometry.CylinderGeometry = function ( editor, object ) {
  5. var signals = editor.signals;
  6. var container = new UI.Row();
  7. var parameters = object.geometry.parameters;
  8. // radiusTop
  9. var radiusTopRow = new UI.Row();
  10. var radiusTop = new UI.Number( parameters.radiusTop ).onChange( update );
  11. radiusTopRow.add( new UI.Text( 'Radius top' ).setWidth( '90px' ) );
  12. radiusTopRow.add( radiusTop );
  13. container.add( radiusTopRow );
  14. // radiusBottom
  15. var radiusBottomRow = new UI.Row();
  16. var radiusBottom = new UI.Number( parameters.radiusBottom ).onChange( update );
  17. radiusBottomRow.add( new UI.Text( 'Radius bottom' ).setWidth( '90px' ) );
  18. radiusBottomRow.add( radiusBottom );
  19. container.add( radiusBottomRow );
  20. // height
  21. var heightRow = new UI.Row();
  22. var height = new UI.Number( parameters.height ).onChange( update );
  23. heightRow.add( new UI.Text( 'Height' ).setWidth( '90px' ) );
  24. heightRow.add( height );
  25. container.add( heightRow );
  26. // radialSegments
  27. var radialSegmentsRow = new UI.Row();
  28. var radialSegments = new UI.Integer( parameters.radialSegments ).setRange( 1, Infinity ).onChange( update );
  29. radialSegmentsRow.add( new UI.Text( 'Radial segments' ).setWidth( '90px' ) );
  30. radialSegmentsRow.add( radialSegments );
  31. container.add( radialSegmentsRow );
  32. // heightSegments
  33. var heightSegmentsRow = new UI.Row();
  34. var heightSegments = new UI.Integer( parameters.heightSegments ).setRange( 1, Infinity ).onChange( update );
  35. heightSegmentsRow.add( new UI.Text( 'Height segments' ).setWidth( '90px' ) );
  36. heightSegmentsRow.add( heightSegments );
  37. container.add( heightSegmentsRow );
  38. // openEnded
  39. var openEndedRow = new UI.Row();
  40. var openEnded = new UI.Checkbox( parameters.openEnded ).onChange( update );
  41. openEndedRow.add( new UI.Text( 'Open ended' ).setWidth( '90px' ) );
  42. openEndedRow.add( openEnded );
  43. container.add( openEndedRow );
  44. //
  45. function update() {
  46. editor.execute( new SetGeometryCommand( object, new THREE.CylinderGeometry(
  47. radiusTop.getValue(),
  48. radiusBottom.getValue(),
  49. height.getValue(),
  50. radialSegments.getValue(),
  51. heightSegments.getValue(),
  52. openEnded.getValue()
  53. ) ) );
  54. }
  55. return container;
  56. }