mirror of
https://github.com/tengge1/ShadowEditor.git
synced 2026-02-01 16:08:17 +00:00
删除menu文件夹,菜单改造完成。
This commit is contained in:
parent
eb1fce8847
commit
4cabe18101
@ -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';
|
||||
|
||||
/**
|
||||
|
||||
@ -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;
|
||||
@ -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';
|
||||
@ -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';
|
||||
|
||||
@ -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;
|
||||
@ -1 +0,0 @@
|
||||
export { default as Menubar } from './Menubar';
|
||||
@ -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 () {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user