fix popup so that tip shadow is not cut off

This commit is contained in:
Vladimir Agafonkin 2012-07-16 14:13:29 +03:00
parent dd1a134c50
commit 0e4e02a1d3
3 changed files with 17 additions and 2 deletions

2
dist/leaflet.css vendored
View File

@ -288,7 +288,7 @@
.leaflet-popup-tip-container {
margin: 0 auto;
width: 40px;
height: 16px;
height: 20px;
position: relative;
overflow: hidden;
}

View File

@ -12,7 +12,7 @@ L.Popup = L.Class.extend({
maxHeight: null,
autoPan: true,
closeButton: true,
offset: new L.Point(0, 2),
offset: new L.Point(0, 6),
autoPanPadding: new L.Point(5, 5),
className: ''
},

View File

@ -3,10 +3,13 @@
*/
L.Path.include({
bindPopup: function (content, options) {
if (!this._popup || this._popup.options !== options) {
this._popup = new L.Popup(options, this);
}
this._popup.setContent(content);
if (!this._openPopupAdded) {
@ -17,6 +20,18 @@ L.Path.include({
return this;
},
openPopup: function (latlng) {
if (this._popup) {
latlng = latlng || this._latlng ||
this._latlngs[Math.floor(this._latlngs.length / 2)];
this._openPopup({latlng: latlng});
}
return this;
},
_openPopup: function (e) {
this._popup.setLatLng(e.latlng);
this._map.openPopup(this._popup);