fixed path setStyle in IE6-8, closed #641, updated build and changelog

This commit is contained in:
Vladimir Agafonkin 2012-06-26 12:21:15 +03:00
parent 5da6da99d4
commit 0830bb38dc
4 changed files with 52 additions and 39 deletions

View File

@ -19,7 +19,7 @@ An in-progress version being developed on the master branch.
#### Usability improvements
* Added smooth **zoom animation of markers, vector layers and popups** (by [@danzel](https://github.com/danzel)). [#740](https://github.com/CloudMade/Leaflet/pull/740)
* Added smooth **zoom animation of markers, vector layers, image overlays and popups** (by [@danzel](https://github.com/danzel)). [#740](https://github.com/CloudMade/Leaflet/pull/740) [#758](https://github.com/CloudMade/Leaflet/issues/758)
* Improved zooming so that you don't get a blank map when you zoom in or out twice quickly (by [@danzel](https://github.com/danzel)). [#7](https://github.com/CloudMade/Leaflet/issues/7) [#729](https://github.com/CloudMade/Leaflet/pull/729)
* Drag-panning now works even when there are markers in the starting point (helps on maps with lots of markers). [#506](https://github.com/CloudMade/Leaflet/issues/506)
* Improved panning performance even more (there are no wasted frames now).
@ -104,6 +104,7 @@ An in-progress version being developed on the master branch.
* Fixed a bug where `Control.Layers` didn't work on IE7. [#652](https://github.com/CloudMade/Leaflet/issues/652)
* Fixed a bug that caused popups to be empty in IE when passing a DOM node as the content (by [@nrenner](https://github.com/nrenner)). [#472](https://github.com/CloudMade/Leaflet/pull/472)
* Fixed a bug that could cause false `mousemove` events on click in Chrome (by [@stsydow](https://github.com/stsydow)). [#757](https://github.com/CloudMade/Leaflet/pull/757)
* Fixed a bug in IE6-8 where adding fill or stroke on vector layers after initialization with `setStyle` would break the map. [#641](https://github.com/CloudMade/Leaflet/issues/641)
#### Mobile browser bugfixes
@ -111,6 +112,7 @@ An in-progress version being developed on the master branch.
* 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 opening the layers control would propagate a click to the map (by [jacobtoye](https://github.com/jacobtoye)). [#638](https://github.com/CloudMade/Leaflet/pull/638)
* Fixed a bug where `ImageOverlay` wouldn't stretch properly on zoom on Android 2. [#651](https://github.com/CloudMade/Leaflet/issues/651)
## 0.3.1 (February 14, 2012)

49
dist/leaflet-src.js vendored
View File

@ -2203,6 +2203,7 @@ L.ImageOverlay = L.Class.extend({
map._panes.overlayPane.appendChild(this._image);
map.on('zoomanim', this._zoomAnimation, this);
map.on('viewreset', this._reset, this);
this._reset();
},
@ -2218,7 +2219,7 @@ L.ImageOverlay = L.Class.extend({
},
_initImage: function () {
this._image = L.DomUtil.create('img', 'leaflet-image-layer leaflet-zoom-hide');
this._image = L.DomUtil.create('img', 'leaflet-image-layer leaflet-zoom-animated');
this._image.style.visibility = 'hidden';
@ -2234,6 +2235,16 @@ L.ImageOverlay = L.Class.extend({
});
},
_zoomAnimation: function (opt) {
var image = this._image,
scale = Math.pow(2, opt.zoom - this._map._zoom),
topLeft = this._map._latLngToNewLayerPoint(this._bounds.getNorthWest(), opt.zoom, opt.center),
size = this._map._latLngToNewLayerPoint(this._bounds.getSouthEast(), opt.zoom, opt.center).subtract(topLeft),
currentSize = this._map.latLngToLayerPoint(this._bounds.getSouthEast()).subtract(this._map.latLngToLayerPoint(this._bounds.getNorthWest()));
image.style[L.DomUtil.TRANSFORM] = L.DomUtil.getTranslateString(topLeft.add(size.subtract(currentSize).divideBy(2))) + ' scale(' + scale + ') ';
},
_reset: function () {
var image = this._image,
topLeft = this._map.latLngToLayerPoint(this._bounds.getNorthWest()),
@ -3395,21 +3406,6 @@ L.Path = L.Browser.svg || !L.Browser.vml ? L.Path : L.Path.extend({
},
_initStyle: function () {
var container = this._container,
stroke,
fill;
if (this.options.stroke) {
stroke = this._stroke = this._createElement('stroke');
stroke.endcap = 'round';
container.appendChild(stroke);
}
if (this.options.fill) {
fill = this._fill = this._createElement('fill');
container.appendChild(fill);
}
this._updateStyle();
},
@ -3423,14 +3419,29 @@ L.Path = L.Browser.svg || !L.Browser.vml ? L.Path : L.Path.extend({
container.filled = options.fill;
if (options.stroke) {
stroke.weight = options.weight + 'px';
stroke.color = options.color;
if (!stroke) {
stroke = this._stroke = this._createElement('stroke');
stroke.endcap = 'round';
container.appendChild(stroke);
}
stroke.weight = options.weight + 'px';
stroke.color = options.color;
stroke.opacity = options.opacity;
} else if (stroke) {
container.removeChild(stroke);
this._stroke = null;
}
if (options.fill) {
fill.color = options.fillColor || options.color;
if (!fill) {
fill = this._fill = this._createElement('fill');
container.appendChild(fill);
}
fill.color = options.fillColor || options.color;
fill.opacity = options.fillOpacity;
} else if (fill) {
container.removeChild(fill);
this._fill = null;
}
},

2
dist/leaflet.js vendored

File diff suppressed because one or more lines are too long

View File

@ -45,21 +45,6 @@ L.Path = L.Browser.svg || !L.Browser.vml ? L.Path : L.Path.extend({
},
_initStyle: function () {
var container = this._container,
stroke,
fill;
if (this.options.stroke) {
stroke = this._stroke = this._createElement('stroke');
stroke.endcap = 'round';
container.appendChild(stroke);
}
if (this.options.fill) {
fill = this._fill = this._createElement('fill');
container.appendChild(fill);
}
this._updateStyle();
},
@ -73,14 +58,29 @@ L.Path = L.Browser.svg || !L.Browser.vml ? L.Path : L.Path.extend({
container.filled = options.fill;
if (options.stroke) {
stroke.weight = options.weight + 'px';
stroke.color = options.color;
if (!stroke) {
stroke = this._stroke = this._createElement('stroke');
stroke.endcap = 'round';
container.appendChild(stroke);
}
stroke.weight = options.weight + 'px';
stroke.color = options.color;
stroke.opacity = options.opacity;
} else if (stroke) {
container.removeChild(stroke);
this._stroke = null;
}
if (options.fill) {
fill.color = options.fillColor || options.color;
if (!fill) {
fill = this._fill = this._createElement('fill');
container.appendChild(fill);
}
fill.color = options.fillColor || options.color;
fill.opacity = options.fillOpacity;
} else if (fill) {
container.removeChild(fill);
this._fill = null;
}
},