Fix vector layer flicker on iOS, closes #18 (yay!)

This commit is contained in:
Vladimir Agafonkin 2012-07-16 14:53:07 +03:00
parent cfd0789140
commit c32319e3ba
3 changed files with 8 additions and 3 deletions

View File

@ -141,6 +141,7 @@ Icon API was improved to be more flexible, but one of the changes is backwards-i
#### Mobile browser bugfixes #### Mobile browser bugfixes
* Fixed a bug that sometimes caused map to disappear completely after zoom on iOS (by [@fr1n63](https://github.com/fr1n63)). [#580](https://github.com/CloudMade/Leaflet/issues/580) [#777](https://github.com/CloudMade/Leaflet/pull/777) * Fixed a bug that sometimes caused map to disappear completely after zoom on iOS (by [@fr1n63](https://github.com/fr1n63)). [#580](https://github.com/CloudMade/Leaflet/issues/580) [#777](https://github.com/CloudMade/Leaflet/pull/777)
* Fixed a bug that often caused vector layers to flicker on drag end on iOS (by [@krawaller](https://github.com/krawaller)). [#18](https://github.com/CloudMade/Leaflet/issues/18)
* Fixed a bug with false map click events on pinch-zoom and zoom/layers controls click. [#485](https://github.com/CloudMade/Leaflet/issues/485) * Fixed a bug with false map click events on pinch-zoom and zoom/layers controls click. [#485](https://github.com/CloudMade/Leaflet/issues/485)
* Fixed a bug where touching the map with two or more fingers simultaneously would raise an error. * Fixed a bug where touching the map with two or more fingers simultaneously would raise an error.
* Fixed a bug where zoom control wasn't always visible on Android 3. [#335](https://github.com/CloudMade/Leaflet/issues/335) * Fixed a bug where zoom control wasn't always visible on Android 3. [#335](https://github.com/CloudMade/Leaflet/issues/335)

View File

@ -16,7 +16,7 @@
<div id="map"></div> <div id="map"></div>
<script> <script>
var map = L.map('map') var map = L.map('map', {closePopupOnClick: false})
.setView([51.505, -0.09], 13); .setView([51.505, -0.09], 13);
var cloudmade = L.tileLayer('http://{s}.tile.cloudmade.com/{key}/{styleId}/256/{z}/{x}/{y}.png', { var cloudmade = L.tileLayer('http://{s}.tile.cloudmade.com/{key}/{styleId}/256/{z}/{x}/{y}.png', {
@ -27,7 +27,7 @@
}).addTo(map); }).addTo(map);
var marker = L.marker([51.5, -0.09]) var marker = L.marker([51.5, -0.09])
.bindPopup("<b>Hello world!</b><br />I am a popup.") .bindPopup("<b>Hello world!</b><br /><a href='javascript:alert(15);'>I am a popup</a>.")
.addTo(map) .addTo(map)
.openPopup(); .openPopup();

View File

@ -8,7 +8,11 @@ L.Path = L.Class.extend({
statics: { statics: {
// how much to extend the clip area around the map view // how much to extend the clip area around the map view
// (relative to its size, e.g. 0.5 is half the screen in each direction) // (relative to its size, e.g. 0.5 is half the screen in each direction)
CLIP_PADDING: 0.5 // set in such way that SVG element doesn't exceed 1280px (vector layers flicker on dragend if it is)
CLIP_PADDING: L.Browser.mobile ?
Math.max(0, Math.min(0.5,
(1280 / Math.max(window.innerWidth, window.innerHeight) - 1) / 2))
: 0.5
}, },
options: { options: {