editor前端上切换模式

This commit is contained in:
YouWei Zhao committed 2018-03-08 19:00:20 +08:00
1 parent 05982bfaf4
commit a695dcd6cf
5 files changed
+66 -16

No files matched your search

+10 -3
View File
@@ -13,6 +13,13 @@
.leftTab > :first-child{margin-top:5px;}
.leftTab > :last-child{margin-bottom:5px;}
.leftTab {
left: 5px;
top: 10px;
width: 435px;
}
/*
#left1 {
left: 5px;
top: 650px;
@@ -42,7 +49,7 @@
top: 1290px;
width: 440px;
}
*/
#left6 {
left: 5px;
/* top: 1930px; */
@@ -74,13 +81,13 @@
height: 700px;
width: 940px;
}
/*
#left8 {
left: 900px;
top: 1290px;
width: 440px;
}
*/
.etable table,
.etable table td {
color: #000;
+2 -2
View File
@@ -363,7 +363,7 @@ editor.prototype.listen = function() {
if(!selectBox.isSelected) {
var loc = eToLoc(e);
var pos = locToPos(loc);
editor_mode.onmode('');//为了强制触发doAction
editor_mode.onmode('nextChange');//为了强制触发doAction
editor_mode.onmode('loc');
editor_mode.loc();
tip.whichShow = 1;
@@ -521,7 +521,7 @@ editor.prototype.listen = function() {
}
}
tip.infos = JSON.parse(JSON.stringify(editor.info));
editor_mode.onmode('');//为了强制触发doAction
editor_mode.onmode('nextChange');//为了强制触发doAction
editor_mode.onmode('emenyitem');
editor_mode.emenyitem();
}
+19 -1
View File
@@ -7,7 +7,10 @@ function editor_mode(){
'emenyitem':'left3',
'floor':'left4',
'tower':'left5',
'functions':'left8'
'functions':'left8',
'map':'left',
'appendpic':'left1',
}
this._ids={}
this.dom={}
@@ -179,11 +182,20 @@ editor_mode.prototype.onmode = function (mode) {
if (editor_mode.mode!=mode) {
console.log('change mode into : '+mode);
editor_mode.doActionList(editor_mode.mode,editor_mode.actionList);
if(editor_mode.mode==='nextChange' && mode)editor_mode.showMode(mode);
editor_mode.mode=mode;
editor_mode.actionList=[];
}
}
editor_mode.prototype.showMode = function (mode) {
for(var name in this.dom){
editor_mode.dom[name].style='z-index:-1;opacity: 0;';
}
editor_mode.dom[mode].style='';
document.getElementById('editModeSelect').value=mode;
}
editor_mode.prototype.loc = function(callback){
//editor.pos={x: 0, y: 0};
if (!core.isset(editor.pos))return;
@@ -448,6 +460,12 @@ editor_mode.prototype.listen = function(callback){
});
}
var editModeSelect = document.getElementById('editModeSelect');
editModeSelect.onchange = function(){
editor_mode.onmode('nextChange');
editor_mode.onmode(editModeSelect.value);
}
if (Boolean(callback))callback();
}
+14 -1
View File
@@ -1,7 +1,20 @@
// vue 相关处理
document.body.onmousedown = function(e){
selectBox.isSelected = false;
console.log(e);
var eid=[];
e.path.forEach(function(node){
if(!node.getAttribute)return;
var id_ = node.getAttribute('id');
if (id_){
if(['left','left1','left2','left3','left4','left5','left8'].indexOf(id_)!==-1)eid.push('edit');
eid.push(id_);
}
});
console.log(eid);
if(eid.indexOf('edit')===-1){
if(eid.indexOf('tip')===-1)selectBox.isSelected = false;
}
editor_mode.onmode('');
editor.info = {};
}