commit fc93364713b6f100becd8cab3869dd3f3adb5e8f
parent 794f50b2ae1ff5a97e734fc76c111b53995e6d4a
Author: Sergej Orlov <wladimirych@gmail.com>
Date: Sat, 29 Jul 2017 15:32:26 +0300
[control.caption] added method setContent
Diffstat:
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/lib/leaflet.control.caption/index.js b/src/lib/leaflet.control.caption/index.js
@@ -14,6 +14,7 @@ L.Control.Caption = L.Control.extend({
},
onAdd: function (map) {
+ this._map = map;
this._container = L.DomUtil.create('div', this.options.className);
this._stopContainerEvents();
this._container.innerHTML = this._contents;
@@ -23,6 +24,13 @@ L.Control.Caption = L.Control.extend({
return true;
});
return this._container;
+ },
+
+ setContents: function(contents) {
+ this._contents = contents;
+ if (this._map) {
+ this._container.innerHTML = this._contents;
+ }
}
});