添加模型菜单。

This commit is contained in:
liteng 2018-07-29 13:04:43 +08:00
parent fa8559ad3b
commit 83d2b896f2
5 changed files with 47 additions and 1 deletions

View File

@ -27,9 +27,17 @@ AssetMenu.prototype.render = function () {
xtype: 'div',
cls: 'options',
children: [{
xtype: 'div',
id: 'mAddAsset',
html: '添加模型',
cls: 'option',
onClick: function () {
_this.app.call('mAddAsset');
}
}, {
xtype: 'div',
id: 'mImportAsset',
html: '导入',
html: '导入模型',
cls: 'option',
onClick: function () {
_this.app.call('mImportAsset');

View File

@ -78,6 +78,7 @@ import AddHemisphereLightEvent from './menu/add/AddHemisphereLightEvent';
import AddAmbientLightEvent from './menu/add/AddAmbientLightEvent';
import AddPerspectiveCameraEvent from './menu/add/AddPerspectiveCameraEvent';
import AddAssetEvent from './menu/asset/AddAssetEvent';
import ImportAssetEvent from './menu/asset/ImportAssetEvent';
import ExportGeometryEvent from './menu/asset/ExportGeometryEvent';
import ExportObjectEvent from './menu/asset/ExportObjectEvent';
@ -222,6 +223,7 @@ function EventDispatcher(app) {
new AddAmbientLightEvent(this.app),
new AddPerspectiveCameraEvent(this.app),
new AddAssetEvent(this.app),
new ImportAssetEvent(this.app),
new ExportGeometryEvent(this.app),
new ExportObjectEvent(this.app),

View File

@ -56,6 +56,7 @@ var EventList = [
'mAddAmbientLight', // 添加环境光
'mAddPerspectiveCamera', // 添加透视相机
'mAddAsset', // 添加模型
'mImportAsset', // 导入资源
'mExportGeometry', // 导出几何体
'mExportObject', // 导出物体

View File

@ -0,0 +1,32 @@
import MenuEvent from '../MenuEvent';
/**
* 添加资源事件
* @param {*} app
*/
function AddAssetEvent(app) {
MenuEvent.call(this, app);
}
AddAssetEvent.prototype = Object.create(MenuEvent.prototype);
AddAssetEvent.prototype.constructor = AddAssetEvent;
AddAssetEvent.prototype.start = function () {
var _this = this;
this.app.on('mAddAsset.' + this.id, function () {
_this.onAddAsset();
});
};
AddAssetEvent.prototype.stop = function () {
this.app.on('mAddAsset.' + this.id, null);
};
AddAssetEvent.prototype.onAddAsset = function () {
var btn = UI.get('modelBtn');
if (btn) {
btn.dom.click();
}
};
export default AddAssetEvent;

View File

@ -63,6 +63,9 @@ ImageList.prototype.render = function () {
obj.onClick = onClick.bind(this);
obj.render();
obj.dom.dataIndex = i; // 序号
obj.img.dataIndex = i;
obj.editBtn.dom.dataIndex = i;
obj.deleteBtn.dom.dataIndex = i;
// 说明
var description = document.createElement('div');