Sidebar.Geometry.PlaneGeometry.js 1.8 KB

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