删除menu文件夹,菜单改造完成。

This commit is contained in:
liteng 2018-06-23 12:13:33 +08:00
parent eb1fce8847
commit 4cabe18101
7 changed files with 20 additions and 54 deletions

View File

@ -5,7 +5,7 @@ import Viewport from './editor/Viewport';
import Script from './core/Script';
import Player from './core/Player';
import StatusBar from './editor/StatusBar';
import Menubar from './menu/Menubar';
import Menubar from './editor/Menubar';
import Sidebar from './panel/Sidebar';
/**

View File

@ -361,7 +361,11 @@ function Menubar(app) {
var autosave = new UI2.Boolean({
text: '自动保存',
value: this.app.editor.config.getKey('autosave'),
style: 'color: #888 !important;'
style: 'color: #888 !important;',
onChange: function (e) {
_this.app.editor.config.setKey('autosave', e.target.checked);
_this.app.call('sceneGraphChanged', _this);
}
});
statusMenu.add(autosave);
@ -375,6 +379,14 @@ function Menubar(app) {
this.dom.add(statusMenu);
this.dom.render();
this.app.on('savingStarted.StatusMenu', function () {
autosave.span.style.textDecoration = 'underline';
});
this.app.on('savingFinished.StatusMenu', function () {
autosave.span.style.textDecoration = 'none';
});
};
export default Menubar;

View File

@ -1,4 +1,5 @@
export { default as ViewportInfo } from './ViewportInfo';
export { default as Viewport } from './Viewport';
export { default as Menubar } from './Menubar';
export { default as StatusBar } from './StatusBar';
export { default as Editor } from './Editor';

View File

@ -6,7 +6,6 @@ export * from './core/index';
export * from './command/index';
export * from './ui/index';
export * from './ui/index';
export * from './menu/index';
export * from './panel/index';
export * from './editor/index';
export * from './utils/index';

View File

@ -1,50 +0,0 @@
import UI from '../ui/UI';
/**
* @author mrdoob / http://mrdoob.com/
*/
function StatusMenu(editor) {
this.app = editor.app;
var container = new UI.Panel();
container.setClass('menu right');
var autosave = new UI.Boolean(editor.config.getKey('autosave'), '自动保存');
autosave.text.setColor('#888');
var _this = this;
autosave.onChange(function () {
var value = this.getValue();
editor.config.setKey('autosave', value);
if (value === true) {
_this.app.call('sceneGraphChanged', _this);
}
});
container.add(autosave);
this.app.on('savingStarted.StatusMenu', function () {
autosave.text.setTextDecoration('underline');
});
this.app.on('savingFinished.StatusMenu', function () {
autosave.text.setTextDecoration('none');
});
var version = new UI.Text('r' + THREE.REVISION);
version.setClass('title');
version.setOpacity(0.5);
container.add(version);
return container;
};
export default StatusMenu;

View File

@ -1 +0,0 @@
export { default as Menubar } from './Menubar';

View File

@ -12,6 +12,7 @@ function Boolean(options) {
this.id = options.ID || 'Boolean' + ID--;
this.text = options.text || 'Boolean';
this.value = options.value || false;
this.onChange = options.onChange || null;
};
Boolean.prototype = Object.create(Control.prototype);
@ -35,6 +36,10 @@ Boolean.prototype.render = function () {
this.dom.appendChild(this.span);
this.setValue(this.value);
if (typeof (this.onChange) === 'function') {
this.input.addEventListener('change', this.onChange.bind(this), false);
}
};
Boolean.prototype.getValue = function () {