Permalink
Browse files

ENYO-789: better fix for Chrome on Android, using document.elementFro…

…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...
1 parent ffe1389 commit e208965cb94baa201ed922d24b811a4db6293170 Ben Combee committed Aug 29, 2012
Showing with 8 additions and 3 deletions.
  1. +8 −3 source/touch/touch.js
View
@@ -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);
};

0 comments on commit e208965

Please sign in to comment.