1、添加显示隐藏网格选项。

2、删除网格事件。
This commit is contained in:
liteng 2018-08-22 21:32:07 +08:00
parent 95247b092b
commit fda9201bcb
5 changed files with 14 additions and 37 deletions

View File

@ -186,6 +186,17 @@ OptionsWindow.prototype.render = function () {
style: {
display: (scene.fog && scene.fog instanceof THREE.FogExp2) ? '' : 'none'
}
}, {
xtype: 'row',
children: [{
xtype: 'label',
text: '网格'
}, {
xtype: 'boolean',
id: 'showGrid',
scope: this.id,
value: this.app.editor.grid.visible
}]
}]
}, { // 渲染器选项卡
xtype: 'div',
@ -352,6 +363,9 @@ OptionsWindow.prototype.save = function () {
break;
}
var showGrid = UI.get('showGrid', this.id).getValue();
this.app.editor.grid.visible = showGrid;
// 渲染器
var shadowMapType = parseInt(UI.get('shadowMapType').getValue());
var gammaInput = UI.get('gammaInput').getValue();

View File

@ -110,7 +110,6 @@ import SidebarEvent from './sideBar/SidebarEvent';
import TransformControlsEvent from './viewport/TransformControlsEvent';
import UpdateSceneStatusEvent from './statusBar/UpdateSceneStatusEvent';
import RenderEvent from './viewport/RenderEvent';
import ShowGridChangedEvent from './viewport/ShowGridChangedEvent';
import ObjectEvent from './viewport/ObjectEvent';
import PickEvent from './viewport/PickEvent';
import WindowResizeEvent from './viewport/WindowResizeEvent';
@ -242,7 +241,6 @@ function EventDispatcher(app) {
new TransformControlsEvent(this.app),
new UpdateSceneStatusEvent(this.app),
new RenderEvent(this.app),
new ShowGridChangedEvent(this.app),
new ObjectEvent(this.app),
new PickEvent(this.app),
new WindowResizeEvent(this.app),

View File

@ -140,7 +140,6 @@ var EventList = [
'scriptChanged', // 脚本改变事件
'scriptRemoved', // 脚本移除事件
'showGridChanged', // 网格显示隐藏改变
'refreshSidebarObject3D', // 刷新Object3D侧边栏事件
'historyChanged', // 历史改变事件
'refreshScriptEditor', // 刷新脚本编辑器事件

View File

@ -30,7 +30,6 @@ GridChangeEvent.prototype.onGridChange = function (statusBar) {
this.app.call('snapChanged', this, snap.getValue() === true ? grid.getValue() : null);
this.app.call('spaceChanged', this, local.getValue() === true ? 'local' : 'world');
this.app.call('showGridChanged', this, showGrid.getValue());
};
export default GridChangeEvent;

View File

@ -1,33 +0,0 @@
import BaseEvent from '../BaseEvent';
/**
* 显示隐藏网格事件
* @param {*} app
*/
function ShowGridChangedEvent(app) {
BaseEvent.call(this, app);
}
ShowGridChangedEvent.prototype = Object.create(BaseEvent.prototype);
ShowGridChangedEvent.prototype.constructor = ShowGridChangedEvent;
ShowGridChangedEvent.prototype.start = function () {
var _this = this;
this.app.on('showGridChanged.' + this.id, function (showGrid) {
_this.onShowGridChanged(showGrid);
});
};
ShowGridChangedEvent.prototype.stop = function () {
this.app.on('showGridChanged.' + this.id, null);
};
ShowGridChangedEvent.prototype.onShowGridChanged = function (showGrid) {
var grid = this.app.editor.grid;
grid.visible = showGrid;
this.app.call('render');
};
export default ShowGridChangedEvent;