From dbc226d46c8224f753c07af6aff259785c60425f Mon Sep 17 00:00:00 2001 From: floyd_hawkes Date: Sat, 21 Feb 2015 12:25:05 -0500 Subject: [PATCH] fix(gridster): fixed expand_widget bug not expanding full width of window fix(gridster): user can specify size_x when expanding widget --- src/jquery.gridster.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/jquery.gridster.js b/src/jquery.gridster.js index 62bce8783..06b2b2153 100755 --- a/src/jquery.gridster.js +++ b/src/jquery.gridster.js @@ -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;