«Жест», который я пытаюсь зафиксировать, - это нажатие, когда, но только когда элемент (другой или такой же) уже прикоснулся к нему. Итак, касание (1) нажатие кнопки вниз, а касание (2) касание выбранных параметров, касание (1) отпускает, и кнопка нажимается.
У меня проблема с последним битом. Событие "touchend" не запускается, когда я отпускаю последний палец? Итак, у меня нет возможности нажать кнопку?
.. также событие "touchend" всегда имеет touches.length = 0?
Вот код, чтобы вы могли понять, что я имею в виду. Я думаю, это может быть ошибка мобильного сафари?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Multi-touch problem</title>
<style>
#touchpane{
width:900px;
height:500px;
background-color:#333;
}
</style>
</head>
<body>
<div id="touchpane" click="void();"></div>
<script>
var tp = document.getElementById("touchpane");
tp.addEventListener('touchstart', function(e){
e.preventDefault();// to stop copy and paste
console.log("touchstart " + e.touches.length );
}, false)
tp.addEventListener('touchend', function(e){
console.log("touchend " + e.touches.length );
// not called when last finger removed?
}, false)
tp.addEventListener('touchcancel', function(e){
console.log("touchcancel");
}, false)
</script>
</body>
</html>