1、Application中各大子模块由传editor改为传app。

2、删除没用处的Modal。
This commit is contained in:
liteng 2018-06-17 21:14:36 +08:00
parent d96e046387
commit da460d6faa
11 changed files with 53 additions and 29 deletions

View File

@ -25,26 +25,29 @@ function Application(container, options) {
// 编辑器
this.editor = new Editor(this);
var viewport = new Viewport(this.editor);
this.container.appendChild(viewport.dom);
// 编辑区
this.viewport = new Viewport(this);
this.container.appendChild(this.viewport.dom);
var script = new Script(this.editor);
this.container.appendChild(script.dom);
// 脚本编辑窗口
this.script = new Script(this);
this.container.appendChild(this.script.dom);
var player = new Player(this.editor);
this.container.appendChild(player.dom);
// 启动窗口
this.player = new Player(this);
this.container.appendChild(this.player.dom);
var toolbar = new Toolbar(this.editor);
this.container.appendChild(toolbar.dom);
// 底部状态栏
this.toolbar = new Toolbar(this);
this.container.appendChild(this.toolbar.dom);
var menubar = new Menubar(this.editor);
this.container.appendChild(menubar.dom);
// 菜单栏
this.menubar = new Menubar(this);
this.container.appendChild(this.menubar.dom);
var sidebar = new Panel(this.editor);
this.container.appendChild(sidebar.dom);
var modal = new UI.Modal();
this.container.appendChild(modal.dom);
// 侧边栏
this.sidebar = new Panel(this);
this.container.appendChild(this.sidebar.dom);
// 是否从文件中加载场景从文件中加载场景的url格式是index.html#file=xxx
this.isLoadingFromHash = false;

View File

@ -4,7 +4,9 @@ import UI from '../ui/UI';
* @author mrdoob / http://mrdoob.com/
*/
function Player(editor) {
function Player(app) {
this.app = app;
var editor = this.app.editor;
var signals = editor.signals;

View File

@ -5,7 +5,9 @@ import SetScriptValueCommand from '../command/SetScriptValueCommand';
* @author mrdoob / http://mrdoob.com/
*/
function Script(editor) {
function Script(app) {
this.app = app;
var editor = this.app.editor;
var signals = editor.signals;

View File

@ -16,10 +16,6 @@ function Signal() {
this.enteredVR = new signals.Signal();
this.exitedVR = new signals.Signal();
// actions
this.showModal = new signals.Signal();
// notifications
this.editorCleared = new signals.Signal();

View File

@ -4,7 +4,9 @@
* @author mrdoob / http://mrdoob.com/
*/
function Toolbar(editor) {
function Toolbar(app) {
this.app = app;
var editor = this.app.editor;
var signals = editor.signals;

View File

@ -8,7 +8,9 @@ import UI from '../ui/UI';
* @author mrdoob / http://mrdoob.com/
*/
function Viewport(editor) {
function Viewport(app) {
this.app = app;
var editor = this.app.editor;
var signals = editor.signals;

View File

@ -15,7 +15,6 @@ AutoSaveEvent.prototype.constructor = AutoSaveEvent;
AutoSaveEvent.prototype.start = function () {
var signals = this.app.editor.signals;
var modal = this.app.modal;
var _this = this;
signals.geometryChanged.add(function () {
@ -48,9 +47,6 @@ AutoSaveEvent.prototype.start = function () {
signals.historyChanged.add(function () {
_this.SaveState();
});
signals.showModal.add(function (content) {
modal.show(content);
});
};
AutoSaveEvent.prototype.stop = function () {

View File

@ -37,6 +37,13 @@ SetSceneEvent.prototype.onSetScene = function (scene) {
editor.signals.sceneGraphChanged.active = false;
// // 当纹理为base64编码时如果不设置complete=true则three.js认为纹理未下载完成会报错。
// scene.traverse(function (n) {
// if (n instanceof THREE.Mesh && n.material.map != null && n.material.map.image != null) {
// n.material.map.image.complete = true;
// }
// });
while (scene.children.length > 0) {
editor.addObject(scene.children[0]);

View File

@ -13,7 +13,9 @@ import UI from '../ui/UI';
* @author mrdoob / http://mrdoob.com/
*/
function Menubar(editor) {
function Menubar(app) {
this.app = app;
var editor = this.app.editor;
var container = new UI.Panel();
container.setId('menubar');

View File

@ -11,7 +11,9 @@ import UI from '../ui/UI';
* @author mrdoob / http://mrdoob.com/
*/
function Panel(editor) {
function Panel(app) {
this.app = app;
var editor = this.app.editor;
var container = new UI.Panel();
container.setId('sidebar');

View File

@ -0,0 +1,10 @@
import Modal from './Modal';
function Window() {
Modal.call(this);
}
Window.prototype = Object.create(Modal.prototype);
Window.prototype.constructor = Window;
export default Window;