diff --git a/_server/editor.js b/_server/editor.js index a15e98dd..0e0cb653 100644 --- a/_server/editor.js +++ b/_server/editor.js @@ -388,7 +388,7 @@ editor.prototype.HTMLescape = function (str_) { } editor.prototype.listen = function () { - + var eui=document.getElementById('eui'); var uc = eui.getContext('2d'); function fillPos(pos) { @@ -399,9 +399,11 @@ editor.prototype.listen = function () { function eToLoc(e) { var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft var scrollTop = document.documentElement.scrollTop || document.body.scrollTop + var xx=e.clientX,yy=e.clientY + if(editor.isMobile){xx=e.touches[0].clientX,yy=e.touches[0].clientY} editor.loc = { - 'x': scrollLeft + e.clientX - mid.offsetLeft - mapEdit.offsetLeft, - 'y': scrollTop + e.clientY - mid.offsetTop - mapEdit.offsetTop, + 'x': scrollLeft + xx - mid.offsetLeft - mapEdit.offsetLeft, + 'y': scrollTop + yy - mid.offsetTop - mapEdit.offsetTop, 'size': editor.isMobile?(32*innerWidth*0.96/416):32 }; return editor.loc; @@ -499,7 +501,6 @@ editor.prototype.listen = function () { } holdingPath = 0; e.stopPropagation(); - var loc = eToLoc(e); if (stepPostfix && stepPostfix.length) { preMapData = JSON.parse(JSON.stringify(editor.map)); currDrawData.pos = JSON.parse(JSON.stringify(stepPostfix)); diff --git a/editor-mobile.html b/editor-mobile.html index c7e5832b..954e81e1 100644 --- a/editor-mobile.html +++ b/editor-mobile.html @@ -503,10 +503,20 @@ var editor_mobile_listen=function(){ printf(info[0].children[1].getAttribute('title')) } + //===== + document.body.ontouchstart=document.body.onmousedown; document.body.onmousedown=null; - //===== + + var eui=document.getElementById('eui'); + eui.ontouchstart=eui.onmousedown + eui.onmousedown=null + eui.ontouchmove=eui.onmousemove + eui.onmousemove=null + eui.ontouchend=eui.onmouseup + eui.onmouseup=null + var chooseThis = document.getElementById('chooseThis'); chooseThis.ontouchstart=chooseThis.onmousedown