From fa61c25cf8bba4fd5ab65640d9a989f2d53311d2 Mon Sep 17 00:00:00 2001 From: YouWei Zhao Date: Tue, 19 May 2020 14:24:08 +0800 Subject: [PATCH] highlight savefloor button --- _server/editor.js | 1 + _server/editor_mappanel.js | 17 +++++++++++++++++ _server/editor_ui.js | 5 +++++ 3 files changed, 23 insertions(+) diff --git a/_server/editor.js b/_server/editor.js index 31d1f954..4717dbdb 100644 --- a/_server/editor.js +++ b/_server/editor.js @@ -282,6 +282,7 @@ editor.prototype.changeFloor = function (floorId, callback) { editor.viewportLoc = editor.viewportLoc || {}; var loc = editor.viewportLoc[floorId] || [], x = loc[0] || 0, y = loc[1] || 0; editor.setViewport(x, y); + editor.uifunctions.unhighlightSaveFloorButton(); editor.config.set('editorLastFloorId', floorId, function() { if (callback) callback(); diff --git a/_server/editor_mappanel.js b/_server/editor_mappanel.js index f6c7687c..3c8c86e1 100644 --- a/_server/editor_mappanel.js +++ b/_server/editor_mappanel.js @@ -274,6 +274,7 @@ editor_mappanel_wrapper = function (editor) { editor.uivalues.holdingPath = 0; editor.uivalues.stepPostfix = []; editor.dom.euiCtx.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__); + editor.uifunctions.highlightSaveFloorButton(); } return false; } @@ -465,6 +466,7 @@ editor_mappanel_wrapper = function (editor) { editor.drawEventBlock(); editor_mode.showMode('loc'); printf('添加楼梯事件成功'); + editor.uifunctions.unhighlightSaveFloorButton(); }); return true; } @@ -525,6 +527,7 @@ editor_mappanel_wrapper = function (editor) { editor.drawPosSelection(); editor_mode.showMode('loc'); printf('绑定机关门事件成功'); + editor.uifunctions.unhighlightSaveFloorButton(); }); bindSpecialDoor.loc = null; bindSpecialDoor.enemys = []; @@ -577,6 +580,7 @@ editor_mappanel_wrapper = function (editor) { throw (err) } ; printf('复制事件成功'); + editor.uifunctions.unhighlightSaveFloorButton(); editor.drawPosSelection(); }); } @@ -591,6 +595,7 @@ editor_mappanel_wrapper = function (editor) { editor.savePreMap(); editor_mode.onmode(''); editor.exchangePos(editor.pos, editor.uivalues.lastRightButtonPos[1]); + editor.uifunctions.unhighlightSaveFloorButton(); } /** @@ -600,6 +605,7 @@ editor_mappanel_wrapper = function (editor) { editor.uifunctions.clearEvent_click = function (e) { e.stopPropagation(); editor.clearPos(false); + editor.uifunctions.unhighlightSaveFloorButton(); } /** @@ -609,6 +615,7 @@ editor_mappanel_wrapper = function (editor) { editor.uifunctions.clearLoc_click = function (e) { e.stopPropagation(); editor.clearPos(true); + editor.uifunctions.unhighlightSaveFloorButton(); } /** @@ -765,6 +772,15 @@ editor_mappanel_wrapper = function (editor) { }); } + editor.uifunctions.highlightSaveFloorButton=function(){ + var saveFloor = document.getElementById('saveFloor'); + saveFloor.style.background='#FFCCAA'; + } + + editor.uifunctions.unhighlightSaveFloorButton=function(){ + var saveFloor = document.getElementById('saveFloor'); + saveFloor.style.background=''; + } editor.uifunctions.saveFloor_func = function () { var saveFloor = document.getElementById('saveFloor'); @@ -776,6 +792,7 @@ editor_mappanel_wrapper = function (editor) { throw (err) } ; printf('保存成功'); + editor.uifunctions.unhighlightSaveFloorButton() }); } saveFloor.onclick = editor_mode.saveFloor; diff --git a/_server/editor_ui.js b/_server/editor_ui.js index cc9588ed..c316d200 100644 --- a/_server/editor_ui.js +++ b/_server/editor_ui.js @@ -318,6 +318,7 @@ editor_ui_wrapper = function (editor) { editor.bgmap = JSON.parse(JSON.stringify(data.bgmap)); editor.updateMap(); editor.uivalues.postMapData.push(data); + editor.uifunctions.highlightSaveFloorButton(); printf("已撤销此操作,你可能需要重新保存地图。"); } return; @@ -332,6 +333,7 @@ editor_ui_wrapper = function (editor) { editor.bgmap = JSON.parse(JSON.stringify(data.bgmap)); editor.updateMap(); editor.uivalues.preMapData.push(data); + editor.uifunctions.highlightSaveFloorButton(); printf("已重做此操作,你可能需要重新保存地图。"); } return; @@ -349,6 +351,7 @@ editor_ui_wrapper = function (editor) { editor.uivalues.copyedInfo = editor.copyFromPos(); editor.clearPos(true, null, function () { printf('该点事件已剪切'); + editor.uifunctions.unhighlightSaveFloorButton(); }) return; } @@ -366,6 +369,7 @@ editor_ui_wrapper = function (editor) { throw (err) } ; printf('粘贴事件成功'); + editor.uifunctions.unhighlightSaveFloorButton(); editor.drawPosSelection(); }); return; @@ -373,6 +377,7 @@ editor_ui_wrapper = function (editor) { // DELETE if (e.keyCode == 46 && !selectBox.isSelected()) { editor.clearPos(true); + editor.uifunctions.unhighlightSaveFloorButton(); return; } // ESC