onup
This commit is contained in:
parent
f8220a2a63
commit
49474e2859
@ -372,18 +372,10 @@ actions.prototype.onmove = function (loc) {
|
||||
}
|
||||
|
||||
////// 当点击(触摸)事件放开时 //////
|
||||
actions.prototype.onup = function (loc) {
|
||||
actions.prototype.onup = function () {
|
||||
if (core.isset(core.status.replay)&&core.status.replay.replaying
|
||||
&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0&&core.status.event.id!='viewMaps') return;
|
||||
|
||||
// 画板
|
||||
if (core.status.played && (core.status.event||{}).id=='paint') {
|
||||
this.onupPaint(loc.x, loc.y)
|
||||
return;
|
||||
}
|
||||
|
||||
var x = parseInt(loc.x / loc.size), y = parseInt(loc.y / loc.size);
|
||||
|
||||
clearTimeout(core.timeout.onDownTimeout);
|
||||
core.timeout.onDownTimeout = null;
|
||||
clearInterval(core.interval.onDownInterval);
|
||||
@ -2452,18 +2444,7 @@ actions.prototype.onmovePaint = function (x, y) {
|
||||
core.status.event.data.y = y;
|
||||
}
|
||||
|
||||
actions.prototype.onupPaint = function (x,y) {
|
||||
x+=core.bigmap.offsetX;
|
||||
y+=core.bigmap.offsetY;
|
||||
if (core.status.event.data.erase) {
|
||||
core.clearMap('route', x-5, y-5, 10, 10);
|
||||
}
|
||||
else if (core.status.event.data.x!=null) {
|
||||
var midx = (core.status.event.data.x+x)/2, midy = (core.status.event.data.y+y)/2;
|
||||
core.canvas.route.quadraticCurveTo(midx, midy, x, y);
|
||||
core.canvas.route.stroke();
|
||||
}
|
||||
|
||||
actions.prototype.onupPaint = function () {
|
||||
core.status.event.data.x = null;
|
||||
core.status.event.data.y = null;
|
||||
// 保存
|
||||
|
||||
@ -407,8 +407,8 @@ core.prototype.onmove = function (loc) {
|
||||
}
|
||||
|
||||
////// 当点击(触摸)事件放开时 //////
|
||||
core.prototype.onup = function (loc) {
|
||||
return core.actions.onup(loc);
|
||||
core.prototype.onup = function () {
|
||||
return core.actions.onup();
|
||||
}
|
||||
|
||||
////// 获得点击事件相对左上角的坐标(0到12之间) //////
|
||||
|
||||
12
main.js
12
main.js
@ -344,12 +344,9 @@ main.dom.data.onmousemove = function (e) {
|
||||
}
|
||||
|
||||
////// 鼠标放开时 //////
|
||||
main.dom.data.onmouseup = function (e) {
|
||||
main.dom.data.onmouseup = function () {
|
||||
try {
|
||||
e.stopPropagation();
|
||||
var loc = main.core.getClickLoc(e.clientX, e.clientY);
|
||||
if (loc == null) return;
|
||||
main.core.onup(loc);
|
||||
main.core.onup();
|
||||
}catch (e) {}
|
||||
}
|
||||
|
||||
@ -386,10 +383,7 @@ main.dom.data.ontouchmove = function (e) {
|
||||
////// 手指离开触摸屏时 //////
|
||||
main.dom.data.ontouchend = function () {
|
||||
try {
|
||||
e.preventDefault();
|
||||
var loc = main.core.getClickLoc(e.targetTouches[0].clientX, e.targetTouches[0].clientY);
|
||||
if (loc == null) return;
|
||||
main.core.onup(loc);
|
||||
main.core.onup();
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user