This commit is contained in:
YouWei Zhao 2018-07-09 22:30:43 +08:00
parent 5b81962869
commit 338323c748
2 changed files with 16 additions and 5 deletions

View File

@ -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));

View File

@ -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