Add Android Beam (NFC) support
This commit is contained in:
@ -161,6 +161,11 @@ window.runOnSmartphonesAfterBoot = function() {
|
||||
});
|
||||
});
|
||||
|
||||
if(typeof android !== 'undefined' && android && android.setPermalink) {
|
||||
window.map.on('moveend', window.setAndroidPermalink);
|
||||
addHook('portalSelected', window.setAndroidPermalink);
|
||||
}
|
||||
|
||||
// Force lower render limits for mobile
|
||||
window.VIEWPORT_PAD_RATIO = 0.1;
|
||||
window.MAX_DRAWN_PORTALS = 500;
|
||||
@ -168,6 +173,24 @@ window.runOnSmartphonesAfterBoot = function() {
|
||||
window.MAX_DRAWN_FIELDS = 100;
|
||||
}
|
||||
|
||||
window.setAndroidPermalink = function() {
|
||||
var c = window.map.getCenter();
|
||||
var lat = Math.round(c.lat*1E6)/1E6;
|
||||
var lng = Math.round(c.lng*1E6)/1E6;
|
||||
|
||||
var href = '/intel?ll='+lat+','+lng+'&z=' + map.getZoom();
|
||||
|
||||
if(window.selectedPortal && window.portals[window.selectedPortal]) {
|
||||
var p = window.portals[window.selectedPortal].getLatLng();
|
||||
lat = Math.round(p.lat*1E6)/1E6;
|
||||
lng = Math.round(p.lng*1E6)/1E6;
|
||||
href += '&pll='+lat+','+lng;
|
||||
}
|
||||
|
||||
href = $('<a>').prop('href', href).prop('href'); // to get absolute URI
|
||||
android.setPermalink(href);
|
||||
}
|
||||
|
||||
window.useAndroidPanes = function() {
|
||||
// isSmartphone is important to disable panes in desktop mode
|
||||
return (typeof android !== 'undefined' && android && android.addPane && window.isSmartphone());
|
||||
|
Reference in New Issue
Block a user