Skip to content

Commit

Permalink
ENYO-789: better fix for Chrome on Android, using document.elementFro…
Browse files Browse the repository at this point in the history
…mPoint with proper scaling applied to coordinates. Fixes issues with pickers not working.

Enyo-DCO-1.0-Signed-Off-By: Ben Combee (ben.combee@palm.com)
  • Loading branch information
Ben Combee committed Aug 29, 2012
1 parent ffe1389 commit e208965
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions source/touch/touch.js
Expand Up @@ -100,9 +100,14 @@ enyo.requiresWindow(function() {
document[e] = enyo.dispatch;
});
// use proper target finding technique based on feature detection.
// HACK: on Chrome for Android v18 on devices with higher density displays,
// document.elementFromPoint fails because of an internal scaling problem.
if (!document.elementFromPoint || enyo.platform.androidChrome <= 18) {
if (enyo.platform.androidChrome <= 18) {
// HACK: on Chrome for Android v18 on devices with higher density displays,
// document.elementFromPoint uses wrong pixel system, so manually scale
var dpr = window.devicePixelRatio;
this.findTarget = function(inX, inY) {
return document.elementFromPoint(inX * dpr, inY * dpr);
};
} else if (!document.elementFromPoint) {
this.findTarget = function(inX, inY) {
return this.findTargetTraverse(null, inX, inY);
};
Expand Down

0 comments on commit e208965

Please sign in to comment.