From 707c65d5a228b44ab3aea2fad95516fe6c57169a Mon Sep 17 00:00:00 2001 From: Braden Shepherdson Date: Fri, 8 Feb 2013 13:39:23 -0500 Subject: feat(ngMobile): add ngMobile module with mobile-specific ngClick Add a new module ngMobile, with mobile/touch-specific directives. Add ngClick, which overrides the default ngClick. This ngClick uses touch events, which are much faster on mobile. On desktop browsers, ngClick responds to click events, so it can be used for portable sites. --- src/ngScenario/Scenario.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/ngScenario/Scenario.js') diff --git a/src/ngScenario/Scenario.js b/src/ngScenario/Scenario.js index 4833e629..1f10fc21 100644 --- a/src/ngScenario/Scenario.js +++ b/src/ngScenario/Scenario.js @@ -231,8 +231,10 @@ function callerFile(offset) { * @param {string} type Optional event type. * @param {Array.=} keys Optional list of pressed keys * (valid values: 'alt', 'meta', 'shift', 'ctrl') + * @param {number} x Optional x-coordinate for mouse/touch events. + * @param {number} y Optional y-coordinate for mouse/touch events. */ -function browserTrigger(element, type, keys) { +function browserTrigger(element, type, keys, x, y) { if (element && !element.nodeName) element = element[0]; if (!element) return; if (!type) { @@ -304,7 +306,9 @@ function browserTrigger(element, type, keys) { return originalPreventDefault.apply(evnt, arguments); }; - evnt.initMouseEvent(type, true, true, window, 0, 0, 0, 0, 0, pressed('ctrl'), pressed('alt'), + x = x || 0; + y = y || 0; + evnt.initMouseEvent(type, true, true, window, 0, x, y, x, y, pressed('ctrl'), pressed('alt'), pressed('shift'), pressed('meta'), 0, element); element.dispatchEvent(evnt); -- cgit v1.2.3