diff --git a/src/layer/Popup.js b/src/layer/Popup.js index 1c47ccee..128ef0a3 100644 --- a/src/layer/Popup.js +++ b/src/layer/Popup.js @@ -3,6 +3,7 @@ L.Popup = L.Class.extend({ includes: L.Mixin.Events, options: { + minWidth: 50, maxWidth: 300, autoPan: true, closeButton: true, @@ -113,10 +114,10 @@ L.Popup = L.Class.extend({ var width = this._container.offsetWidth; - this._container.style.width = (width > this.options.maxWidth ? this.options.maxWidth : width) + 'px'; - this._container.style.whiteSpace = ''; + this._containerWidth = (width > this.options.maxWidth ? this.options.maxWidth : (width < this.options.minWidth ? this.options.minWidth : width ) ); - this._containerWidth = this._container.offsetWidth; + this._container.style.width = this._containerWidth + 'px'; + this._container.style.whiteSpace = ''; }, _updatePosition: function() { @@ -163,4 +164,4 @@ L.Popup = L.Class.extend({ this._close(); L.DomEvent.stop(e); } -}); \ No newline at end of file +});