Menubar.Status.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import * as THREE from 'three';
  2. import { UIPanel, UIText } from './libs/ui.js';
  3. import { UIBoolean } from './libs/ui.three.js';
  4. function MenubarStatus( editor ) {
  5. const strings = editor.strings;
  6. const container = new UIPanel();
  7. container.setClass( 'menu right' );
  8. const autosave = new UIBoolean( editor.config.getKey( 'autosave' ), strings.getKey( 'menubar/status/autosave' ) );
  9. autosave.text.setColor( '#888' );
  10. autosave.onChange( function () {
  11. const value = this.getValue();
  12. editor.config.setKey( 'autosave', value );
  13. if ( value === true ) {
  14. editor.signals.sceneGraphChanged.dispatch();
  15. }
  16. } );
  17. container.add( autosave );
  18. editor.signals.savingStarted.add( function () {
  19. autosave.text.setTextDecoration( 'underline' );
  20. } );
  21. editor.signals.savingFinished.add( function () {
  22. autosave.text.setTextDecoration( 'none' );
  23. } );
  24. const version = new UIText( 'r' + THREE.REVISION );
  25. version.setClass( 'title' );
  26. version.setOpacity( 0.5 );
  27. container.add( version );
  28. return container;
  29. }
  30. export { MenubarStatus };