From fda9201bcb0e005dc7ec6ac463fb0c84ca2c956b Mon Sep 17 00:00:00 2001 From: liteng <930372551@qq.com> Date: Wed, 22 Aug 2018 21:32:07 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=B7=BB=E5=8A=A0=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=9A=90=E8=97=8F=E7=BD=91=E6=A0=BC=E9=80=89=E9=A1=B9=E3=80=82?= =?UTF-8?q?=202=E3=80=81=E5=88=A0=E9=99=A4=E7=BD=91=E6=A0=BC=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/editor/window/OptionsWindow.js | 14 ++++++++ ShadowEditor.Web/src/event/EventDispatcher.js | 2 -- ShadowEditor.Web/src/event/EventList.js | 1 - .../src/event/statusBar/GridChangeEvent.js | 1 - .../event/viewport/ShowGridChangedEvent.js | 33 ------------------- 5 files changed, 14 insertions(+), 37 deletions(-) delete mode 100644 ShadowEditor.Web/src/event/viewport/ShowGridChangedEvent.js diff --git a/ShadowEditor.Web/src/editor/window/OptionsWindow.js b/ShadowEditor.Web/src/editor/window/OptionsWindow.js index db2fe469..5758e7a4 100644 --- a/ShadowEditor.Web/src/editor/window/OptionsWindow.js +++ b/ShadowEditor.Web/src/editor/window/OptionsWindow.js @@ -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(); diff --git a/ShadowEditor.Web/src/event/EventDispatcher.js b/ShadowEditor.Web/src/event/EventDispatcher.js index b66bf1bf..2bac32a7 100644 --- a/ShadowEditor.Web/src/event/EventDispatcher.js +++ b/ShadowEditor.Web/src/event/EventDispatcher.js @@ -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), diff --git a/ShadowEditor.Web/src/event/EventList.js b/ShadowEditor.Web/src/event/EventList.js index c4aacfda..19547d8a 100644 --- a/ShadowEditor.Web/src/event/EventList.js +++ b/ShadowEditor.Web/src/event/EventList.js @@ -140,7 +140,6 @@ var EventList = [ 'scriptChanged', // 脚本改变事件 'scriptRemoved', // 脚本移除事件 - 'showGridChanged', // 网格显示隐藏改变 'refreshSidebarObject3D', // 刷新Object3D侧边栏事件 'historyChanged', // 历史改变事件 'refreshScriptEditor', // 刷新脚本编辑器事件 diff --git a/ShadowEditor.Web/src/event/statusBar/GridChangeEvent.js b/ShadowEditor.Web/src/event/statusBar/GridChangeEvent.js index f9c65653..0238ab8e 100644 --- a/ShadowEditor.Web/src/event/statusBar/GridChangeEvent.js +++ b/ShadowEditor.Web/src/event/statusBar/GridChangeEvent.js @@ -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; \ No newline at end of file diff --git a/ShadowEditor.Web/src/event/viewport/ShowGridChangedEvent.js b/ShadowEditor.Web/src/event/viewport/ShowGridChangedEvent.js deleted file mode 100644 index e2eff2c1..00000000 --- a/ShadowEditor.Web/src/event/viewport/ShowGridChangedEvent.js +++ /dev/null @@ -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; \ No newline at end of file