add layer getElement methods

This commit is contained in:
Vladimir Agafonkin 2015-05-21 19:57:12 +03:00
parent c4b6e79fa4
commit 8ffbb707c6
4 changed files with 16 additions and 0 deletions

View File

@ -101,6 +101,10 @@ L.ImageOverlay = L.Layer.extend({
return this._bounds;
},
getElement: function () {
return this._image;
},
_initImage: function () {
var img = this._image = L.DomUtil.create('img',
'leaflet-image-layer ' + (this._zoomAnimated ? 'leaflet-zoom-animated' : ''));

View File

@ -103,6 +103,10 @@ L.Popup = L.Layer.extend({
return this;
},
getElement: function () {
return this._container;
},
update: function () {
if (!this._map) { return; }

View File

@ -82,6 +82,10 @@ L.Marker = L.Layer.extend({
return this;
},
getElement: function () {
return this._icon;
},
update: function () {
if (this._icon) {

View File

@ -74,6 +74,10 @@ L.Path = L.Layer.extend({
return this;
},
getElement: function () {
return this._path;
},
_clickTolerance: function () {
// used when doing hit detection for Canvas layers
return (this.options.stroke ? this.options.weight / 2 : 0) + (L.Browser.touch ? 10 : 0);