From a9dc7e0dd3df97d1df91fb264ad5b124cb30f530 Mon Sep 17 00:00:00 2001 From: Marcin Sikon Date: Wed, 27 Jul 2011 08:57:44 +0200 Subject: [PATCH] add minWidth to Popup, fix calculation _containerWidth --- src/layer/Popup.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 +});