add minWidth to Popup, fix calculation _containerWidth

This commit is contained in:
Marcin Sikon 2011-07-27 08:57:44 +02:00
parent f58a1c7369
commit a9dc7e0dd3

View File

@ -3,6 +3,7 @@ L.Popup = L.Class.extend({
includes: L.Mixin.Events, includes: L.Mixin.Events,
options: { options: {
minWidth: 50,
maxWidth: 300, maxWidth: 300,
autoPan: true, autoPan: true,
closeButton: true, closeButton: true,
@ -113,10 +114,10 @@ L.Popup = L.Class.extend({
var width = this._container.offsetWidth; var width = this._container.offsetWidth;
this._container.style.width = (width > this.options.maxWidth ? this.options.maxWidth : width) + 'px'; this._containerWidth = (width > this.options.maxWidth ? this.options.maxWidth : (width < this.options.minWidth ? this.options.minWidth : width ) );
this._container.style.whiteSpace = '';
this._containerWidth = this._container.offsetWidth; this._container.style.width = this._containerWidth + 'px';
this._container.style.whiteSpace = '';
}, },
_updatePosition: function() { _updatePosition: function() {
@ -163,4 +164,4 @@ L.Popup = L.Class.extend({
this._close(); this._close();
L.DomEvent.stop(e); L.DomEvent.stop(e);
} }
}); });