Sidebar.Geometry.PlaneGeometry.js 1.5 KB

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