Sidebar.Geometry.PlaneGeometry.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. */
  4. Sidebar.Geometry.PlaneGeometry = function ( editor, object ) {
  5. var strings = editor.strings;
  6. var signals = editor.signals;
  7. var container = new UI.Row();
  8. var geometry = object.geometry;
  9. var parameters = geometry.parameters;
  10. // width
  11. var widthRow = new UI.Row();
  12. var width = new UI.Number( parameters.width ).onChange( update );
  13. widthRow.add( new UI.Text( strings.getKey( 'sidebar/geometry/plane_geometry/width' ) ).setWidth( '90px' ) );
  14. widthRow.add( width );
  15. container.add( widthRow );
  16. // height
  17. var heightRow = new UI.Row();
  18. var height = new UI.Number( parameters.height ).onChange( update );
  19. heightRow.add( new UI.Text( strings.getKey( 'sidebar/geometry/plane_geometry/height' ) ).setWidth( '90px' ) );
  20. heightRow.add( height );
  21. container.add( heightRow );
  22. // widthSegments
  23. var widthSegmentsRow = new UI.Row();
  24. var widthSegments = new UI.Integer( parameters.widthSegments ).setRange( 1, Infinity ).onChange( update );
  25. widthSegmentsRow.add( new UI.Text( strings.getKey( 'sidebar/geometry/plane_geometry/widthsegments' ) ).setWidth( '90px' ) );
  26. widthSegmentsRow.add( widthSegments );
  27. container.add( widthSegmentsRow );
  28. // heightSegments
  29. var heightSegmentsRow = new UI.Row();
  30. var heightSegments = new UI.Integer( parameters.heightSegments ).setRange( 1, Infinity ).onChange( update );
  31. heightSegmentsRow.add( new UI.Text( strings.getKey( 'sidebar/geometry/plane_geometry/heightsegments' ) ).setWidth( '90px' ) );
  32. heightSegmentsRow.add( heightSegments );
  33. container.add( heightSegmentsRow );
  34. //
  35. function update() {
  36. editor.execute( new SetGeometryCommand( object, new THREE[ geometry.type ](
  37. width.getValue(),
  38. height.getValue(),
  39. widthSegments.getValue(),
  40. heightSegments.getValue()
  41. ) ) );
  42. }
  43. return container;
  44. };
  45. Sidebar.Geometry.PlaneBufferGeometry = Sidebar.Geometry.PlaneGeometry;