Languages

Menu
Sites
Language
Touch Event At The Top of Screen of Wearable Device

I started to learn Tizen wearable development just a few weeks ago. When I tried to add a "touchstart" and  a "touchend" event listener to an element at the top of screen. I found the "touchstart" event will not be triggered when I press on it. And both the two events will be triggered at the same time, which means when click activity is over, these two events will be triggered together.

This only happens to elements at the top of the screen. The tizenhwkey has been disabled, and "event.preventDefault()" is called. Both "true" and "false" have been tried as the third parameter of "addEventListener" function. Still the problem is not solved.

Has anyone ever met this problem?

Responses

3 Replies
daniel kim

Hi,

I could observe that "touchstart" and "touchend" event was triggered whenevenr text was touched. I would suggest you to refer to following code.

and two event were not triggered together in my case.

<body>
 <div class="ui-page ui-page-active"> 
  <div class="ui-content content-padding"  id="touchable">
     Touch or drag this box with one finger.Touch or drag this box with one finger.
     Touch or drag this box with one finger.Touch or drag this box with one finger.
     Touch or drag this box with one finger.Touch or drag this box with one finger.
     Touch or drag this box with one finger.Touch or drag this box with one finger.
     </div>    
 </div>
 <script type="text/javascript" src="lib/tau/wearable/js/tau.min.js"></script>
 <script type="text/javascript" src="js/circle-helper.js"></script>
 <script src="app.js"></script>
 <script src="lowBatteryCheck.js"></script>
</body>
<script>

var touchable = document.querySelector("#touchable");

/* touchstart event */
touchable.addEventListener("touchstart", function(e)
{
   console.log("touchstart");
}, false);
 
/* touchend event */
touchable.addEventListener("touchend", function(e)
{
  console.log("touchend");
}, false);


</script>

Regards

AVSukhov

Hello,

This may be due to the fact that in wearable devices for closing app using swipe from top to bottom. If you add only touchstart event on element at the top and element at the middle you can see that on top element touchstart event is triggered after delay.

Nafisul Islam Kiron

I tested the above code and it works.