2
0

Sidebar.Settings.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. */
  4. import { UIPanel, UIRow, UISelect, UIText, UIInteger } from './libs/ui.js';
  5. import { SidebarSettingsViewport } from './Sidebar.Settings.Viewport.js';
  6. import { SidebarSettingsShortcuts } from './Sidebar.Settings.Shortcuts.js';
  7. var SidebarSettings = function ( editor ) {
  8. var config = editor.config;
  9. var strings = editor.strings;
  10. var container = new UIPanel();
  11. container.setBorderTop( '0' );
  12. container.setPaddingTop( '20px' );
  13. container.setPaddingBottom( '20px' );
  14. // language
  15. var options = {
  16. en: 'English',
  17. fr: 'Français',
  18. zh: '中文'
  19. };
  20. var languageRow = new UIRow();
  21. var language = new UISelect().setWidth( '150px' );
  22. language.setOptions( options );
  23. if ( config.getKey( 'language' ) !== undefined ) {
  24. language.setValue( config.getKey( 'language' ) );
  25. }
  26. language.onChange( function () {
  27. var value = this.getValue();
  28. editor.config.setKey( 'language', value );
  29. } );
  30. languageRow.add( new UIText( strings.getKey( 'sidebar/settings/language' ) ).setWidth( '90px' ) );
  31. languageRow.add( language );
  32. container.add( languageRow );
  33. // export precision
  34. var exportPrecisionRow = new UIRow();
  35. var exportPrecision = new UIInteger( config.getKey( 'exportPrecision' ) ).setRange( 2, Infinity );
  36. exportPrecision.onChange( function () {
  37. var value = this.getValue();
  38. editor.config.setKey( 'exportPrecision', value );
  39. } );
  40. exportPrecisionRow.add( new UIText( strings.getKey( 'sidebar/settings/exportPrecision' ) ).setWidth( '90px' ) );
  41. exportPrecisionRow.add( exportPrecision );
  42. container.add( exportPrecisionRow );
  43. //
  44. container.add( new SidebarSettingsShortcuts( editor ) );
  45. container.add( new SidebarSettingsViewport( editor ) );
  46. return container;
  47. };
  48. export { SidebarSettings };