From 1d636e5517ff084ba41c04353d6ca16dfef115f1 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Mon, 6 Jul 2020 17:57:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E7=9B=B4=E6=8E=A5=E7=BB=98?= =?UTF-8?q?=E5=88=B6=E5=A4=A7=E5=9C=B0=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _server/editor.js | 1 - _server/editor_mappanel.js | 34 +++++++++------------------------ _server/editor_materialpanel.js | 14 +++++++------- 3 files changed, 16 insertions(+), 33 deletions(-) diff --git a/_server/editor.js b/_server/editor.js index 45b1b554..adeb49af 100644 --- a/_server/editor.js +++ b/_server/editor.js @@ -814,7 +814,6 @@ editor.prototype.buildMark = function(){ } editor.prototype.setSelectBoxFromInfo=function(thisevent, scrollTo){ - if (editor.uivalues.bigmap) return; var pos={x: 0, y: 0, images: "terrains"}; var ysize = 32; if(thisevent==0){ diff --git a/_server/editor_mappanel.js b/_server/editor_mappanel.js index a4c62d6a..85aa1d6f 100644 --- a/_server/editor_mappanel.js +++ b/_server/editor_mappanel.js @@ -7,7 +7,8 @@ editor_mappanel_wrapper = function (editor) { */ editor.uifunctions.fillPos = function (pos) { editor.dom.euiCtx.fillStyle = '#' + ~~(Math.random() * 8) + ~~(Math.random() * 8) + ~~(Math.random() * 8); - editor.dom.euiCtx.fillRect(pos.x * 32 + 12 - core.bigmap.offsetX, pos.y * 32 + 12 - core.bigmap.offsetY, 8, 8); + var grid = _getGridByPos({x: pos.x, y: pos.y}); + editor.dom.euiCtx.fillRect(grid.x + grid.size * 3 / 8, grid.y + grid.size * 3 / 8, grid.size / 4, grid.size / 4); } /** @@ -55,7 +56,7 @@ editor_mappanel_wrapper = function (editor) { * 双击地图可以选中素材 */ editor.uifunctions.map_doubleClick = function (e) { - if (editor.uivalues.bindSpecialDoor.loc != null || editor.uivalues.bigmap) return; + if (editor.uivalues.bindSpecialDoor.loc != null) return; var loc = editor.uifunctions.eToLoc(e); var pos = editor.uifunctions.locToPos(loc, true); editor.setSelectBoxFromInfo(editor[editor.layerMod][pos.y][pos.x], true); @@ -89,18 +90,6 @@ editor_mappanel_wrapper = function (editor) { editor.uivalues.lastMoveE=e; var loc = editor.uifunctions.eToLoc(e); var pos = editor.uifunctions.locToPos(loc, true); - if (editor.uivalues.bigmap) { - if (!selectBox.isSelected()) { - editor_mode.onmode('nextChange'); - editor_mode.onmode('loc'); - printi("大地图模式(F键)下,可以拖动、右键拉框与复制剪切粘贴;但不可进行绘图。"); - editor.uivalues.startPos = pos; - editor.dom.euiCtx.strokeStyle = '#FF0000'; - editor.dom.euiCtx.lineWidth = 2; - if (editor.isMobile) editor.uifunctions.showMidMenu(e.clientX, e.clientY); - } - return false; - } if (editor.uivalues.bindSpecialDoor.loc != null) { var x = editor.pos.x, y = editor.pos.y, id = (editor.map[y][x] || {}).id; @@ -125,7 +114,7 @@ editor_mappanel_wrapper = function (editor) { editor.uifunctions.showTips(6); editor.uivalues.startPos = pos; editor.dom.euiCtx.strokeStyle = '#FF0000'; - editor.dom.euiCtx.lineWidth = 3; + editor.dom.euiCtx.lineWidth = 2; if (editor.isMobile) editor.uifunctions.showMidMenu(e.clientX, e.clientY); return false; } @@ -196,7 +185,6 @@ editor_mappanel_wrapper = function (editor) { //editor_mode.loc(); return false; } - if (editor.uivalues.bigmap) return false; if (editor.uivalues.holdingPath == 0) { return false; @@ -228,8 +216,9 @@ editor_mappanel_wrapper = function (editor) { // draw rect editor.dom.euiCtx.clearRect(0, 0, editor.dom.euiCtx.canvas.width, editor.dom.euiCtx.canvas.height); editor.dom.euiCtx.fillStyle = 'rgba(0, 127, 255, 0.4)'; - editor.dom.euiCtx.fillRect(32 * x0 - core.bigmap.offsetX, 32 * y0 - core.bigmap.offsetY, - 32 * (x1 - x0) + 32, 32 * (y1 - y0) + 32); + var grid = _getGridByPos({x: x0, y: y0}); + editor.dom.euiCtx.fillRect(grid.x, grid.y, + grid.size * (x1 - x0 + 1), grid.size * (y1 - y0 + 1)); } editor.uivalues.stepPostfix.push(pos); } @@ -270,7 +259,7 @@ editor_mappanel_wrapper = function (editor) { editor.uivalues.startPos = editor.uivalues.endPos = null; return false; } - if (editor.uivalues.bigmap) return false; + editor.uivalues.holdingPath = 0; if (editor.uivalues.stepPostfix && editor.uivalues.stepPostfix.length) { editor.savePreMap(); @@ -809,15 +798,10 @@ editor_mappanel_wrapper = function (editor) { } editor.uifunctions.triggerBigmap = function () { - if (selectBox.isSelected()) { - printe("请先点击【保存地图】以退出绘图模式"); - return; - } - editor.uivalues.bigmap = !editor.uivalues.bigmap; if (editor.uivalues.bigmap) { editor.dom.bigmapBtn.classList.add('highlight'); - printi("大地图模式(F键)下,可以拖动与复制剪切粘贴;但不可拉框、绘图或呼出右键菜单。"); + printf("已进入大地图模式"); } else { editor.dom.bigmapBtn.classList.remove('highlight'); editor.setViewport(32 * (editor.pos.x - core.__HALF_SIZE__), 32 * (editor.pos.y - core.__HALF_SIZE__)); diff --git a/_server/editor_materialpanel.js b/_server/editor_materialpanel.js index 6b89c749..f4df1bd3 100644 --- a/_server/editor_materialpanel.js +++ b/_server/editor_materialpanel.js @@ -13,6 +13,10 @@ editor_materialpanel_wrapper = function (editor) { return selectBox._isSelected } + var locToPos = function (loc) { + return { 'x': ~~(loc.x / loc.size), 'y': ~~(loc.y / loc.size) }; + } + editor.uifunctions.getScrollBarHeight = function () { var outer = document.createElement("div"); outer.style.visibility = "hidden"; @@ -66,7 +70,6 @@ editor_materialpanel_wrapper = function (editor) { editor.uifunctions.material_ondown = function (e) { e.stopPropagation(); e.preventDefault(); - if (editor.uivalues.bigmap) return; editor.uivalues.lastMoveMaterE=e; if (!editor.isMobile && e.clientY >= editor.dom.iconLib.offsetHeight - editor.uivalues.scrollBarHeight) return; var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft; @@ -87,10 +90,9 @@ editor_materialpanel_wrapper = function (editor) { editor.uifunctions.material_onmove = function (e) { e.stopPropagation(); e.preventDefault(); - if (editor.uivalues.bigmap) return; editor.uivalues.lastMoveMaterE=e; if (!editor.uivalues.startLoc) return; - var pos0 = editor.uifunctions.locToPos(editor.uivalues.startLoc); + var pos0 = locToPos(editor.uivalues.startLoc); editor.dom.dataSelection.style.left = 32 * pos0.x + 'px'; editor.dom.dataSelection.style.top = 32 * pos0.y + 'px'; @@ -106,7 +108,6 @@ editor_materialpanel_wrapper = function (editor) { editor.uifunctions.material_onup = function (ee) { var startLoc = editor.uivalues.startLoc; editor.uivalues.startLoc = null; - if (editor.uivalues.bigmap) return; var e=editor.uivalues.lastMoveMaterE; if (!editor.isMobile && e.clientY >= editor.dom.iconLib.offsetHeight - editor.uivalues.scrollBarHeight) return; @@ -119,8 +120,8 @@ editor_materialpanel_wrapper = function (editor) { }; editor.loc = loc; editor.uivalues.tileSize = [1,1]; - var pos0 = editor.uifunctions.locToPos(startLoc); - var pos = editor.uifunctions.locToPos(loc); + var pos0 = locToPos(startLoc); + var pos = locToPos(loc); for (var spriter in editor.widthsX) { if (pos.x >= editor.widthsX[spriter][1] && pos.x < editor.widthsX[spriter][2]) { var ysize = spriter.endsWith('48') ? 48 : 32; @@ -219,7 +220,6 @@ editor_materialpanel_wrapper = function (editor) { } else { editor.info = editor.ids[idindex-(x-1)-(y-1)*(widthX[2]-widthX[1])]; - editor.uifunctions.locToPos(startLoc); //重置editor.pos editor.uivalues.tileSize = [x, y]; editor.dom.dataSelection.style.left = pos0.x * 32 + 'px'; editor.dom.dataSelection.style.top = pos0.y * ysize + 'px';