diff options
| author | Braden Shepherdson | 2013-02-08 13:39:23 -0500 |
|---|---|---|
| committer | Igor Minar | 2013-03-13 22:59:06 -0700 |
| commit | 707c65d5a228b44ab3aea2fad95516fe6c57169a (patch) | |
| tree | 547fabaa6c57da04ee8e683a89515b9f1e091cbd /src/ngScenario/Scenario.js | |
| parent | d1b49e25f1c8e303d57f44d1d3417dbefb194a5c (diff) | |
| download | angular.js-707c65d5a228b44ab3aea2fad95516fe6c57169a.tar.bz2 | |
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.
Diffstat (limited to 'src/ngScenario/Scenario.js')
| -rw-r--r-- | src/ngScenario/Scenario.js | 8 |
1 files changed, 6 insertions, 2 deletions
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.<string>=} 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); |
