diff --git a/_server/css/editor.css b/_server/css/editor.css
index f5681118..928a0964 100644
--- a/_server/css/editor.css
+++ b/_server/css/editor.css
@@ -89,6 +89,10 @@ body {
height: 630px;
}
+#mapEdit {
+ overflow: hidden;
+}
+
.map {
position: absolute;
left: 20px;
diff --git a/_server/css/editor_mobile.css b/_server/css/editor_mobile.css
index d5eed943..36ca92ae 100644
--- a/_server/css/editor_mobile.css
+++ b/_server/css/editor_mobile.css
@@ -82,6 +82,10 @@ body {
position: absolute;
}
+#mapEdit {
+ overflow: hidden;
+}
+
.map {
position: absolute;
left: 4vw;
diff --git a/_server/editor.js b/_server/editor.js
index d515dec6..8343e596 100644
--- a/_server/editor.js
+++ b/_server/editor.js
@@ -21,6 +21,7 @@ editor.prototype.init = function (callback) {
editor.updateMap();
editor.currentFloorId = core.status.floorId;
editor.currentFloorData = core.floors[core.status.floorId];
+ editor.buildMark();
editor.drawEventBlock();
if (Boolean(callback)) callback();
});
@@ -266,6 +267,64 @@ editor.prototype.updateMap = function () {
}
+editor.prototype.buildMark = function(){
+ // 生成定位编号
+ var arrColMark=document.getElementById('arrColMark');
+ var arrRowMark=document.getElementById('arrRowMark');
+ var mapColMark=document.getElementById('mapColMark');
+ var mapRowMark=document.getElementById('mapRowMark');
+ var buildMark = function (offsetX,offsetY) {
+ var colNum = ' ';
+ for (var i = 0; i < 13; i++) {
+ var tpl = '
' + (i+offsetX) + ' | ';
+ colNum += tpl;
+ }
+ arrColMark.innerHTML = '' + colNum + '
';
+ mapColMark.innerHTML = '' + colNum + '
';
+ var rowNum = ' ';
+ for (var i = 0; i < 13; i++) {
+ var tpl = '| ' + (i+offsetY) + ' |
';
+ rowNum += tpl;
+ }
+ arrRowMark.innerHTML = rowNum;
+ mapRowMark.innerHTML = rowNum;
+ }
+ var buildMark_mobile = function (offsetX,offsetY) {
+ var colNum = ' ';
+ for (var i = 0; i < 13; i++) {
+ var tpl = '' + (' '+i).slice(-2).replace(' ',' ') + ' | ';
+ colNum += tpl;
+ }
+ arrColMark.innerHTML = '' + colNum + '
';
+ //mapColMark.innerHTML = '' + colNum + '
';
+ var rowNum = ' ';
+ for (var i = 0; i < 13; i++) {
+ var tpl = '| ' + (' '+i).slice(-2).replace(' ',' ') + ' |
';
+ rowNum += tpl;
+ }
+ arrRowMark.innerHTML = rowNum;
+ //mapRowMark.innerHTML = rowNum;
+ //=====
+ var colNum = ' ';
+ for (var i = 0; i < 13; i++) {
+ var tpl = '' + (' '+(i+offsetX)).slice(-2).replace(' ',' ') + '
';
+ colNum += tpl;
+ }
+ mapColMark.innerHTML = '' + colNum + '
';
+ var rowNum = ' ';
+ for (var i = 0; i < 13; i++) {
+ var tpl = '' + (' '+(i+offsetY)).slice(-2).replace(' ',' ') + '
';
+ rowNum += tpl;
+ }
+ mapRowMark.innerHTML = rowNum;
+ }
+ if(editor.isMobile){
+ buildMark_mobile(core.bigmap.offsetX/32,core.bigmap.offsetY/32);
+ } else {
+ buildMark(core.bigmap.offsetX/32,core.bigmap.offsetY/32);
+ }
+}
+
editor.prototype.changeFloor = function (floorId, callback) {
editor.currentFloorData.map = editor.map.map(function (v) {
return v.map(function (v) {
@@ -324,8 +383,13 @@ editor.prototype.listen = function () {
return editor.loc;
}//返回可用的组件内坐标
- function locToPos(loc) {
- editor.pos = {'x': ~~(loc.x / loc.size)+core.bigmap.offsetX/32, 'y': ~~(loc.y / loc.size)+core.bigmap.offsetY/32}
+ function locToPos(loc, addViewportOffset) {
+ var offsetX=0, offsetY=0;
+ if (addViewportOffset){
+ offsetX=core.bigmap.offsetX/32;
+ offsetY=core.bigmap.offsetY/32;
+ }
+ editor.pos = {'x': ~~(loc.x / loc.size)+offsetX, 'y': ~~(loc.y / loc.size)+offsetY}
return editor.pos;
}
@@ -350,13 +414,13 @@ editor.prototype.listen = function () {
eui.onmousedown = function (e) {
if (e.button==2){
var loc = eToLoc(e);
- var pos = locToPos(loc);
+ var pos = locToPos(loc,true);
editor.showMidMenu(e.clientX,e.clientY);
return;
}
if (!selectBox.isSelected) {
var loc = eToLoc(e);
- var pos = locToPos(loc);
+ var pos = locToPos(loc,true);
editor_mode.onmode('nextChange');
editor_mode.onmode('loc');
//editor_mode.loc();
@@ -372,7 +436,7 @@ editor.prototype.listen = function () {
e.stopPropagation();
uc.clearRect(0, 0, 416, 416);
var loc = eToLoc(e);
- var pos = locToPos(loc);
+ var pos = locToPos(loc,true);
stepPostfix = [];
stepPostfix.push(pos);
fillPos(pos);
@@ -390,7 +454,7 @@ editor.prototype.listen = function () {
mouseOutCheck = 2;
e.stopPropagation();
var loc = eToLoc(e);
- var pos = locToPos(loc);
+ var pos = locToPos(loc,true);
var pos0 = stepPostfix[stepPostfix.length - 1]
var directionDistance = [pos.y - pos0.y, pos0.x - pos.x, pos0.y - pos.y, pos.x - pos0.x]
var max = 0, index = 4;
@@ -778,6 +842,23 @@ editor.prototype.listen = function () {
editor.brushMod=brushMod2.value;
}
+
+ editor.moveViewport=function(x,y){
+ core.bigmap.offsetX = core.clamp(core.bigmap.offsetX+32*x, 0, 32*core.bigmap.width-416);
+ core.bigmap.offsetY = core.clamp(core.bigmap.offsetY+32*y, 0, 32*core.bigmap.height-416);
+ core.control.updateViewport();
+ editor.buildMark();
+ }
+
+ var viewportButtons=document.getElementById('viewportButtons');
+ for(var ii=0,node;node=viewportButtons.children[ii];ii++){
+ (function(x,y){
+ node.onclick=function(){
+ editor.moveViewport(x,y);
+ }
+ })([-1,0,0,1][ii],[0,-1,1,0][ii]);
+ }
+
}//绑定事件
/*
diff --git a/editor-mobile.html b/editor-mobile.html
index eae04732..e7092229 100644
--- a/editor-mobile.html
+++ b/editor-mobile.html
@@ -268,7 +268,12 @@
-
+
+
+
+
+
+
@@ -387,50 +392,20 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
diff --git a/editor.html b/editor.html
index 86a9a5f5..c52708fb 100644
--- a/editor.html
+++ b/editor.html
@@ -5,11 +5,6 @@
-
-->
-
@@ -448,24 +424,6 @@ if (location.protocol.indexOf("http")!=0) {