Sidebar.Geometry.CylinderGeometry.js 2.3 KB

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