Sidebar.Geometry.DodecahedronGeometry.js 1.2 KB

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