Skip to content

Instantly share code, notes, and snippets.

@sujoyu
Created October 8, 2016 15:18
Show Gist options
  • Save sujoyu/c51d01be7c5b1d300656fb0af261c8ae to your computer and use it in GitHub Desktop.
Save sujoyu/c51d01be7c5b1d300656fb0af261c8ae to your computer and use it in GitHub Desktop.
Google Maps Scripts API bug fix code on iOS 10.
(function() {
function ios_ver (){
var ios_ua = navigator.userAgent;
if( ios_ua.indexOf("iPhone") > 0 ) {
ios_ua.match(/iPhone OS (\w+)/g);
var version = RegExp.$1.split("_")[0];
return version;
}
}
if (ios_ver() === '10') {
window.__Touch = window.Touch;
window.Touch = function(init) {
this.target = init.target;
this.identifier = init.identifier;
this.clientX = init.clientX;
this.clientY = init.clientY;
this.pageX = init.pageX;
this.pageY = init.pageY;
this.screenX = init.screenX;
this.screenY = init.screenY;
}
window.Touch.prototype = Object.create(window.__Touch.prototype);
window.Touch.prototype.constructor = window.Touch;
window.__TouchEvent = window.TouchEvent;
window.TouchEvent = null;
}
})();
@JustinWinthers
Copy link

Worked like a charm. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment