forked from mrdoob/three.js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMenubar.Status.js
51 lines (30 loc) · 1.03 KB
/
Menubar.Status.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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 };