更新 ball.js
This commit is contained in:
1 parent
de27f8dc27
commit
1b79c2b476
1 file changed
+14
-2
@@ -51,7 +51,7 @@ var window = floaty.window(
|
|||||||
|
|
||||||
window.img.setImageBitmap(textpaint());
|
window.img.setImageBitmap(textpaint());
|
||||||
window.setPosition(240, 500);
|
window.setPosition(240, 500);
|
||||||
|
clickCount = 0
|
||||||
//记录按键被按下的时间以便判断长按等动作 疑似有点幽默了
|
//记录按键被按下的时间以便判断长按等动作 疑似有点幽默了
|
||||||
var downTime;
|
var downTime;
|
||||||
window.img.setOnTouchListener(function (view, event) {
|
window.img.setOnTouchListener(function (view, event) {
|
||||||
@@ -73,8 +73,14 @@ window.img.setOnTouchListener(function (view, event) {
|
|||||||
case event.ACTION_UP:
|
case event.ACTION_UP:
|
||||||
//手指弹起时如果偏移很小则判断为点击
|
//手指弹起时如果偏移很小则判断为点击
|
||||||
if (Math.abs(event.getRawY() - y) < 5 && Math.abs(event.getRawX() - x) < 5) {
|
if (Math.abs(event.getRawY() - y) < 5 && Math.abs(event.getRawX() - x) < 5) {
|
||||||
|
clickCount+=1
|
||||||
threads.start(function () {
|
threads.start(function () {
|
||||||
|
sleep(500)
|
||||||
|
if(clickCount == 1)
|
||||||
onClick();
|
onClick();
|
||||||
|
if(clickCount > 1)
|
||||||
|
onClick2();
|
||||||
|
clickCount=0
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -84,7 +90,13 @@ window.img.setOnTouchListener(function (view, event) {
|
|||||||
|
|
||||||
function onClick(){
|
function onClick(){
|
||||||
// var str = prompt('kxnmsl')
|
// var str = prompt('kxnmsl')
|
||||||
toast('有病')
|
toast('单击')
|
||||||
|
// exit()
|
||||||
|
}
|
||||||
|
|
||||||
|
function onClick2(){
|
||||||
|
// var str = prompt('kxnmsl')
|
||||||
|
toast('双击')
|
||||||
// exit()
|
// exit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user