You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.0 KiB
52 lines
1.0 KiB
2 years ago
|
import * as THREE from 'three';
|
||
|
|
||
|
import { UIPanel, UIText } from '../libs/ui.js';
|
||
|
import { UIBoolean } from '../libs/ui.three.js';
|
||
|
|
||
|
function MenubarStatus( editor ) {
|
||
|
|
||
|
const strings = editor.strings;
|
||
|
|
||
|
const container = new UIPanel();
|
||
|
container.setClass( 'menu right' );
|
||
|
|
||
|
const autosave = new UIBoolean( editor.config.getKey( 'autosave' ), strings.getKey( 'menubar/status/autosave' ) );
|
||
|
autosave.text.setColor( '#888' );
|
||
|
autosave.onChange( function () {
|
||
|
|
||
|
const value = this.getValue();
|
||
|
|
||
|
editor.config.setKey( 'autosave', value );
|
||
|
|
||
|
if ( value === true ) {
|
||
|
|
||
|
editor.signals.sceneGraphChanged.dispatch();
|
||
|
|
||
|
}
|
||
|
|
||
|
} );
|
||
|
container.add( autosave );
|
||
|
|
||
|
editor.signals.savingStarted.add( function () {
|
||
|
|
||
|
autosave.text.setTextDecoration( 'underline' );
|
||
|
|
||
|
} );
|
||
|
|
||
|
editor.signals.savingFinished.add( function () {
|
||
|
|
||
|
autosave.text.setTextDecoration( 'none' );
|
||
|
|
||
|
} );
|
||
|
|
||
|
const version = new UIText( 'r' + THREE.REVISION );
|
||
|
version.setClass( 'title' );
|
||
|
version.setOpacity( 0.5 );
|
||
|
container.add( version );
|
||
|
|
||
|
return container;
|
||
|
|
||
|
}
|
||
|
|
||
|
export { MenubarStatus };
|