I'm using Kinetic.js library for handling my touch events and other canvas related objects for a HTML5 mobile game. The library provides easy interface to access all events however, it does not have a handle for catching long-touch/taphold event. My game requires users to touch-hold the key to continue fire but this selects the entire canvas which requires an additional click to deselect which becomes annoying when done repeatedly. I looked at this discussion but no solution is accepted there.
Asked
Active
Viewed 1,607 times
1
-
e.preventDefault() inside my own object(using the library) event handler din't help – Ani Jul 23 '12 at 11:56
1 Answers
0
event.preventDefault() is what you use to prevent the browser's default behavior and event.stopPropagation() is what you use to prevent competing event handlers from firing. For IE: window.event.cancelBubble = true
Try using stopPropagation()
to get the event you can do:
function(e) {
var event = e || window.event;
event.preventDefault();
event.stopPropagation();
// more code
}

SoluableNonagon
- 11,541
- 11
- 53
- 98