Merge pull request #174 from zhaouv/v2.x

V2 x
This commit is contained in:
Zhang Chen 2018-07-09 22:49:33 +08:00 committed by GitHub
commit 6442712e0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 9 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

@ -118,13 +118,20 @@ editor_mode = function (editor) {
printe(field + ' : 输入的值不合要求,请鼠标放置在注释上查看说明');
}
}
input.ondblclick = function () {
var dblclickfunc=function () {
if (cobj._type === 'event') editor_blockly.import(guid, {type: cobj._event});
if (cobj._type === 'textarea') editor_multi.import(guid, {lint: cobj._lint, string: cobj._string});
}
// thisTr.onclick = function(){
// editor.lastClickId=guid;
// }
input.ondblclick = dblclickfunc
var doubleClickCheck=[0];
thisTr.onclick = function(){
var newClick = new Date().getTime();
var lastClick = doubleClickCheck.shift();
doubleClickCheck.push(newClick);
if(newClick-lastClick<500){
dblclickfunc()
}
}
});
}
return {"HTML": outstr.join(''), "guids": guids, "listen": listen};

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