editor: copy event

改变复制事件的方向
This commit is contained in:
YouWei Zhao 2018-07-01 20:00:22 +08:00
parent 8e99a4ef83
commit a54029fbf3

View File

@ -674,8 +674,8 @@ editor.prototype.listen = function () {
var locStr='('+editor.lastRightButtonPos[1].x+','+editor.lastRightButtonPos[1].y+')'; var locStr='('+editor.lastRightButtonPos[1].x+','+editor.lastRightButtonPos[1].y+')';
var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft; var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop; var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
copyLoc.children[0].innerHTML='复制事件'+locStr; copyLoc.children[0].innerHTML='复制事件'+locStr+'到此处';
moveLoc.children[0].innerHTML='移动此事件到'+locStr; moveLoc.children[0].innerHTML='交换事件'+locStr+'与此事件的位置';
midMenu.style='top:'+(y+scrollTop)+'px;left:'+(x+scrollLeft)+'px;'; midMenu.style='top:'+(y+scrollTop)+'px;left:'+(x+scrollLeft)+'px;';
} }
editor.hideMidMenu=function(){midMenu.style='display:none';} editor.hideMidMenu=function(){midMenu.style='display:none';}
@ -730,21 +730,22 @@ editor.prototype.listen = function () {
e.stopPropagation(); e.stopPropagation();
preMapData = null; preMapData = null;
reDo = null; reDo = null;
var thisevent = editor.map[editor.pos.y][editor.pos.x];
if(thisevent==0){
editor.info = 0;
} else {
var ids=editor.indexs[thisevent.idnum];
ids=ids[0]?ids[0]:ids;
editor.info=editor.ids[ids];
}
editor_mode.onmode(''); editor_mode.onmode('');
var now = editor.pos; var now = editor.pos;
var last = editor.lastRightButtonPos[1]; var last = editor.lastRightButtonPos[1];
editor.map[last.y][last.x]=editor.info; var lastevent = editor.map[last.y][last.x];
var lastinfo = 0;
if(lastevent==0){
lastinfo = 0;
} else {
var ids=editor.indexs[lastevent.idnum];
ids=ids[0]?ids[0]:ids;
lastinfo=editor.ids[ids];
}
editor.map[now.y][now.x]=lastinfo;
editor.updateMap(); editor.updateMap();
fields.forEach(function(v){ fields.forEach(function(v){
editor.currentFloorData[v][last.x+','+last.y]=editor.currentFloorData[v][now.x+','+now.y] editor.currentFloorData[v][now.x+','+now.y]=editor.currentFloorData[v][last.x+','+last.y]
}) })
editor.file.saveFloorFile(function (err) { editor.file.saveFloorFile(function (err) {
if (err) { if (err) {