Sidebar.Geometry.Modifiers.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import { UIDiv, UIButton, UIRow } from './libs/ui.js';
  2. function SidebarGeometryModifiers( editor, object ) {
  3. const strings = editor.strings;
  4. const signals = editor.signals;
  5. const container = new UIDiv().setPaddingLeft( '90px' );
  6. const geometry = object.geometry;
  7. // Compute Vertex Normals
  8. const computeVertexNormalsButton = new UIButton( strings.getKey( 'sidebar/geometry/compute_vertex_normals' ) );
  9. computeVertexNormalsButton.onClick( function () {
  10. geometry.computeVertexNormals();
  11. signals.geometryChanged.dispatch( object );
  12. } );
  13. const computeVertexNormalsRow = new UIRow();
  14. computeVertexNormalsRow.add( computeVertexNormalsButton );
  15. container.add( computeVertexNormalsRow );
  16. // Center Geometry
  17. const centerButton = new UIButton( strings.getKey( 'sidebar/geometry/center' ) );
  18. centerButton.onClick( function () {
  19. geometry.center();
  20. signals.geometryChanged.dispatch( object );
  21. } );
  22. const centerRow = new UIRow();
  23. centerRow.add( centerButton );
  24. container.add( centerRow );
  25. //
  26. return container;
  27. }
  28. export { SidebarGeometryModifiers };