后退最近访问的楼层

This commit is contained in:
ckcz123 2020-06-12 14:41:09 +08:00
parent 508c7ba310
commit 1ceb496d2e
6 changed files with 20 additions and 0 deletions

View File

@ -53,6 +53,7 @@ function editor() {
lastUsedCtx: document.getElementById('lastUsed').getContext('2d'), lastUsedCtx: document.getElementById('lastUsed').getContext('2d'),
lockMode: document.getElementById('lockMode'), lockMode: document.getElementById('lockMode'),
gameInject: document.getElementById('gameInject'), gameInject: document.getElementById('gameInject'),
undoFloor: document.getElementById('undoFloor'),
maps: ['bgmap', 'fgmap', 'map'], maps: ['bgmap', 'fgmap', 'map'],
canvas: ['bg', 'fg'], canvas: ['bg', 'fg'],
}; };
@ -107,6 +108,9 @@ function editor() {
// 最近使用的图块 // 最近使用的图块
lastUsedType: null, lastUsedType: null,
lastUsed: [], lastUsed: [],
// 最近访问的楼层
recentFloors: []
}; };
window.onerror = function (msg, url, lineNo, columnNo, error) { window.onerror = function (msg, url, lineNo, columnNo, error) {

View File

@ -35,6 +35,7 @@ editor_listen_wrapper = function (editor) {
editor.dom.pasteLoc.onmouseup = editor.uifunctions.pasteLoc_click editor.dom.pasteLoc.onmouseup = editor.uifunctions.pasteLoc_click
editor.dom.clearEvent.onmouseup = editor.uifunctions.clearEvent_click editor.dom.clearEvent.onmouseup = editor.uifunctions.clearEvent_click
editor.dom.clearLoc.onmouseup = editor.uifunctions.clearLoc_click editor.dom.clearLoc.onmouseup = editor.uifunctions.clearLoc_click
editor.dom.undoFloor.onclick = editor.uifunctions.undoFloor_click
editor.dom.lastUsed.onmouseup = editor.uifunctions.lastUsed_click; editor.dom.lastUsed.onmouseup = editor.uifunctions.lastUsed_click;
editor.dom.lastUsed.oncontextmenu = function (e) { e.preventDefault(); } editor.dom.lastUsed.oncontextmenu = function (e) { e.preventDefault(); }

View File

@ -366,6 +366,7 @@ editor_mappanel_wrapper = function (editor) {
editor_mode.onmode('nextChange'); editor_mode.onmode('nextChange');
editor_mode.onmode('floor'); editor_mode.onmode('floor');
editor.dom.selectFloor.value = toId; editor.dom.selectFloor.value = toId;
editor.uivalues.recentFloors.push(editor.currentFloorId);
editor.changeFloor(toId); editor.changeFloor(toId);
} }
@ -381,6 +382,16 @@ editor_mappanel_wrapper = function (editor) {
return false; return false;
} }
editor.uifunctions.undoFloor_click = function () {
var toId = editor.uivalues.recentFloors.pop();
if (toId == null || toId == editor.currentFloorId) return;
editor_mode.onmode('nextChange');
editor_mode.onmode('floor');
editor.dom.selectFloor.value = toId;
editor.changeFloor(toId);
}
/** /**
* 显示右键菜单 * 显示右键菜单
*/ */
@ -809,6 +820,7 @@ editor_mappanel_wrapper = function (editor) {
selectFloor.onchange = function () { selectFloor.onchange = function () {
editor_mode.onmode('nextChange'); editor_mode.onmode('nextChange');
editor_mode.onmode('floor'); editor_mode.onmode('floor');
editor.uivalues.recentFloors.push(editor.currentFloorId);
editor.changeFloor(selectFloor.value); editor.changeFloor(selectFloor.value);
} }
}); });

View File

@ -171,6 +171,7 @@ editor_ui_wrapper = function (editor) {
editor_mode.onmode('nextChange'); editor_mode.onmode('nextChange');
editor_mode.onmode('floor'); editor_mode.onmode('floor');
document.getElementById('selectFloor').value = toId; document.getElementById('selectFloor').value = toId;
editor.uivalues.recentFloors.push(editor.currentFloorId);
editor.changeFloor(toId); editor.changeFloor(toId);
} }
return; return;

View File

@ -376,6 +376,7 @@
</div> </div>
<select id="selectFloor" style="clear:left"></select> <select id="selectFloor" style="clear:left"></select>
<input type="button" value="保存地图" id='saveFloor'/> <input type="button" value="保存地图" id='saveFloor'/>
<input type="button" value="后退" id="undoFloor" />
<span id='mobileeditdata' style="display:none"> <span id='mobileeditdata' style="display:none">
<input type="button" value="编辑"/> <input type="button" value="编辑"/>
<input type="button" value="显示完整名称" style="display: none;"/> <input type="button" value="显示完整名称" style="display: none;"/>

View File

@ -340,6 +340,7 @@
<br> <br>
<select id="selectFloor"></select> <select id="selectFloor"></select>
<input type="button" value="保存地图" id='saveFloor'/> <input type="button" value="保存地图" id='saveFloor'/>
<input type="button" value="后退" id="undoFloor" />
</div> </div>
</div> </div>
<div id="mid2"> <div id="mid2">