mobile - show-user-location

1. if canvas-based layers are in use, don't draw the hack range marker (as any leaflet path-based drawing is slow, and they don't support SVG styles)
2. only add/remove the circle marker layer when needed - as the leaflet library doesn't document what will happen if a removed layer is removed again, or an added layer is added again
This commit is contained in:
Jon Atkins 2014-03-22 03:34:46 +00:00
parent ffc056505f
commit 427614ccca

View File

@ -66,10 +66,13 @@ window.plugin.userLocation.setup = function() {
};
window.plugin.userLocation.onZoomEnd = function() {
if(window.map.getZoom() < 16)
window.plugin.userLocation.locationLayer.removeLayer(window.plugin.userLocation.circle);
else
window.plugin.userLocation.locationLayer.addLayer(window.plugin.userLocation.circle);
if(window.map.getZoom() < 16 || L.Path.CANVAS) {
if (window.plugin.userLocation.locationLayer.hasLayer(window.plugin.userLocation.circle))
window.plugin.userLocation.locationLayer.removeLayer(window.plugin.userLocation.circle);
} else {
if (!window.plugin.userLocation.locationLayer.hasLayer(window.plugin.userLocation.circle))
window.plugin.userLocation.locationLayer.addLayer(window.plugin.userLocation.circle);
}
};
window.plugin.userLocation.locate = function(lat, lng, accuracy) {