[Pkg-javascript-commits] [dojo] 03/88: fix touch.move on iOS4, thanks edurocher, fixes #15831 on 1.8/ branch !strict

David Prévot taffit at moszumanska.debian.org
Thu Aug 21 17:39:29 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag 1.8.5
in repository dojo.

commit 1b55198f184c942fd27b8eaf52f26868985c0dd6
Author: Bill Keese <bill at dojotoolkit.org>
Date:   Sat Aug 11 00:41:59 2012 +0000

    fix touch.move on iOS4, thanks edurocher, fixes #15831 on 1.8/ branch !strict
    
    git-svn-id: http://svn.dojotoolkit.org/src/branches/1.8/dojo@29473 560b804f-0ae3-0310-86f3-f6aa0a117693
---
 touch.js | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/touch.js b/touch.js
index 60f9c7a..fcbe132 100644
--- a/touch.js
+++ b/touch.js
@@ -6,6 +6,15 @@ function(dojo, lang, aspect, dom, on, has, mouse, ready, win){
 
 	var hasTouch = has("touch");
 
+	// TODO for 2.0: detection of IOS version should be moved from mobile/sniff to dojo/sniff
+	var ios4 = false;
+	if(has("ios")){
+		var ua = navigator.userAgent;
+		var v = ua.match(/OS ([\d_]+)/) ? RegExp.$1 : "1";
+		var os = parseFloat(v.replace(/_/, '.').replace(/_/g, ''));
+		ios4 = os < 5;
+	}
+
 	var touchmove, hoveredNode;
 
 	if(hasTouch){
@@ -34,8 +43,8 @@ function(dojo, lang, aspect, dom, on, has, mouse, ready, win){
 			// Fire synthetic touchover and touchout events on nodes since the browser won't do it natively.
 			on(win.doc, "touchmove", function(evt){
 				var newNode = win.doc.elementFromPoint(
-					evt.pageX - win.global.pageXOffset,
-					evt.pageY - win.global.pageYOffset
+					evt.pageX - (ios4 ? 0 : win.global.pageXOffset), // iOS 4 expects page coords
+					evt.pageY - (ios4 ? 0 : win.global.pageYOffset)
 				);
 				if(newNode && hoveredNode !== newNode){
 					// touch out on the old node
@@ -198,4 +207,4 @@ function(dojo, lang, aspect, dom, on, has, mouse, ready, win){
 	has("extend-dojo") && (dojo.touch = touch);
 
 	return touch;
-});
\ No newline at end of file
+});

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/dojo.git



More information about the Pkg-javascript-commits mailing list