diff --git a/debug/tests/popup_offset.html b/debug/tests/popup_offset.html new file mode 100644 index 00000000..ca88e1f9 --- /dev/null +++ b/debug/tests/popup_offset.html @@ -0,0 +1,36 @@ + + + + Leaflet debug page + + + + + + + + + + + + +
+ + + + diff --git a/src/layer/Layer.Popup.js b/src/layer/Layer.Popup.js index 7854d605..54cfd337 100644 --- a/src/layer/Layer.Popup.js +++ b/src/layer/Layer.Popup.js @@ -127,7 +127,8 @@ L.Layer.include({ _popupAnchor: function (layer) { var anchor = layer._getPopupAnchor ? layer._getPopupAnchor() : [0, 0]; - return L.point(anchor).add(L.Popup.prototype.options.offset); + var offsetToAdd = layer._popup ? layer._popup.options.offset : L.Popup.prototype.options.offset; + return L.point(anchor).add(offsetToAdd); }, _movePopup: function (e) {