Sidebar.Geometry.DodecahedronGeometry.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. */
  4. import * as THREE from '../../build/three.module.js';
  5. import { UIRow, UIText, UIInteger, UINumber } from './libs/ui.js';
  6. import { SetGeometryCommand } from './commands/SetGeometryCommand.js';
  7. var SidebarGeometryDodecahedronGeometry = function ( editor, object ) {
  8. var strings = editor.strings;
  9. var container = new UIRow();
  10. var geometry = object.geometry;
  11. var parameters = geometry.parameters;
  12. // radius
  13. var radiusRow = new UIRow();
  14. var radius = new UINumber( parameters.radius ).onChange( update );
  15. radiusRow.add( new UIText( strings.getKey( 'sidebar/geometry/dodecahedron_geometry/radius' ) ).setWidth( '90px' ) );
  16. radiusRow.add( radius );
  17. container.add( radiusRow );
  18. // detail
  19. var detailRow = new UIRow();
  20. var detail = new UIInteger( parameters.detail ).setRange( 0, Infinity ).onChange( update );
  21. detailRow.add( new UIText( strings.getKey( 'sidebar/geometry/dodecahedron_geometry/detail' ) ).setWidth( '90px' ) );
  22. detailRow.add( detail );
  23. container.add( detailRow );
  24. //
  25. function update() {
  26. editor.execute( new SetGeometryCommand( editor, object, new THREE.DodecahedronBufferGeometry(
  27. radius.getValue(),
  28. detail.getValue()
  29. ) ) );
  30. }
  31. return container;
  32. };
  33. export { SidebarGeometryDodecahedronGeometry };