fix(gridster): fixed expand_widget bug not expanding full width of window

fix(gridster): user can specify size_x when expanding widget
This commit is contained in:
floyd_hawkes
2015-02-21 12:25:05 -05:00
parent afd83fead8
commit dbc226d46c

View File

@ -499,15 +499,15 @@
* @method expand_widget
* @param {HTMLElement} $widget The jQuery wrapped HTMLElement
* representing the widget.
* @param {Number} size_x The number of cols that will occupy the widget.
* @param {Number} size_y The number of rows that will occupy the widget.
* @param {Function} [callback] Function executed when the widget is removed.
* @return {HTMLElement} Returns $widget.
*/
fn.expand_widget = function($widget, size_y, callback) {
fn.expand_widget = function($widget, size_x, size_y, callback) {
var wgd = $widget.coords().grid;
var max_size_x = Math.floor(($(window).width() - this.options.widget_margins[0] * 2) /
(this.min_widget_width + this.options.widget_margins[0] * 2));
var size_x = Math.min(max_size_x, this.cols);
var max_size_x = Math.floor(($(window).width() - this.options.widget_margins[0] * 2) / this.min_widget_width);
size_x = size_x || Math.min(max_size_x, this.cols);
size_y || (size_y = wgd.size_y);
var old_size_y = wgd.size_y;