后退最近访问的楼层

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'),
lockMode: document.getElementById('lockMode'),
gameInject: document.getElementById('gameInject'),
undoFloor: document.getElementById('undoFloor'),
maps: ['bgmap', 'fgmap', 'map'],
canvas: ['bg', 'fg'],
};
@ -107,6 +108,9 @@ function editor() {
// 最近使用的图块
lastUsedType: null,
lastUsed: [],
// 最近访问的楼层
recentFloors: []
};
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.clearEvent.onmouseup = editor.uifunctions.clearEvent_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.oncontextmenu = function (e) { e.preventDefault(); }

View File

@ -366,6 +366,7 @@ editor_mappanel_wrapper = function (editor) {
editor_mode.onmode('nextChange');
editor_mode.onmode('floor');
editor.dom.selectFloor.value = toId;
editor.uivalues.recentFloors.push(editor.currentFloorId);
editor.changeFloor(toId);
}
@ -381,6 +382,16 @@ editor_mappanel_wrapper = function (editor) {
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 () {
editor_mode.onmode('nextChange');
editor_mode.onmode('floor');
editor.uivalues.recentFloors.push(editor.currentFloorId);
editor.changeFloor(selectFloor.value);
}
});

View File

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

View File

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

View File

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