fix(gridster): fixed bugs in centering_widgets (widgets were getting smushed when being resized) and fixed bug with min_width

This commit is contained in:
floyd_hawkes
2015-04-06 16:05:40 -04:00
parent 16a7a65953
commit 86053f8be3
8 changed files with 161 additions and 116 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
/*! gridster.js - v0.6.4 - 2015-03-19
/*! gridster.js - v0.6.4 - 2015-04-06
* http://gridster.net/
* Copyright (c) 2015 decksterteam; Licensed */
+52 -37
View File
@@ -1,4 +1,4 @@
/*! gridster.js - v0.6.4 - 2015-03-19
/*! gridster.js - v0.6.4 - 2015-04-06
* http://gridster.net/
* Copyright (c) 2015 decksterteam; Licensed */
@@ -845,7 +845,7 @@
};
//jQuery adapter
$.fn.drag = function ( options ) {
$.fn.gridDraggable = function ( options ) {
return new Draggable(this, options);
};
@@ -1106,6 +1106,12 @@
this.draggable();
this.options.resize.enabled && this.resizable();
if (this.options.center_widgets) {
setTimeout($.proxy(function () {
this.center_widgets();
}, this), 0);
}
$(window).bind('resize.gridster', throttle(
$.proxy(this.recalculate_faux_grid, this), 200));
};
@@ -1222,6 +1228,12 @@
this.drag_api.set_limits((this.cols * this.min_widget_width) + ((this.cols + 1) * this.options.widget_margins[0]));
if (this.options.center_widgets) {
setTimeout($.proxy(function () {
this.center_widgets();
}, this), 0);
}
return $w.fadeIn({complete: function () { if(callback) callback.call(this); }});
};
@@ -1297,14 +1309,17 @@
* @param {Number} size_x The number of columns that will occupy the widget.
* By default <code>size_x</code> is limited to the space available from
* the column where the widget begins, until the last column to the right.
* @param {Boolean} [reposition] Set to false to not move the widget to
* the left if there is insufficient space on the right.
* @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.resize_widget = function($widget, size_x, size_y, callback) {
fn.resize_widget = function($widget, size_x, size_y, reposition, callback) {
var wgd = $widget.coords().grid;
var col = wgd.col;
var max_cols = this.options.max_cols;
reposition !== false && (reposition = true);
var old_size_y = wgd.size_y;
var old_col = wgd.col;
var new_col = old_col;
@@ -1312,8 +1327,14 @@
size_x || (size_x = wgd.size_x);
size_y || (size_y = wgd.size_y);
if (max_cols !== Infinity) {
size_x = Math.min(size_x, max_cols - col + 1);
//if (max_cols !== Infinity) {
// size_x = Math.min(size_x, max_cols - col + 1);
//}
if (reposition && old_col + size_x - 1 > this.cols) {
var diff = old_col + (size_x - 1) - this.cols;
var c = old_col - diff;
new_col = Math.max(1, c);
}
if (size_y > old_size_y) {
@@ -1470,15 +1491,16 @@
* @method center_widgets
*/
fn.center_widgets = debounce(function () {
var window_width = $(window).width();
var wrapper_width = this.$wrapper.width();
var col_size = this.options.widget_base_dimensions[0] + (2 * this.options.widget_margins[0]);
var col_count = Math.floor(Math.max(Math.floor(window_width / col_size), this.min_col_count) / 2) * 2;
var col_count = Math.floor(Math.max(Math.floor(wrapper_width / col_size), this.min_col_count) / 2) * 2;
this.options.min_cols = col_count;
this.options.max_cols = col_count;
this.options.extra_cols = 0;
this.options.max_size_x = col_count;
this.set_dom_grid_width(col_count);
this.cols = col_count;
var col_dif = (col_count - this.prev_col_count) / 2;
@@ -1515,28 +1537,30 @@
fn.get_min_col = function () {
var min_col = this.min_col_count;
this.$widgets.each($.proxy(function(i, widget) {
var $widget = $(widget);
var value = parseInt($widget.attr("data-col"));
min_col = Math.min(min_col, value);
}, this));
return min_col;
return Math.min.apply(Math, this.$widgets.map($.proxy(function (key, widget) {
return this.get_cells_occupied($(widget).coords().grid).cols;
}, this)).get());
};
fn.shift_cols = function (col_dif) {
this.$widgets.each($.proxy(function(i, widget) {
var $widget = $(widget);
var widgets_coords = this.$widgets.map($.proxy(function(i, widget) {
var $w = $(widget);
return this.dom_to_coords($w);
}, this));
widgets_coords = Gridster.sort_by_row_and_col_asc(widgets_coords);
widgets_coords.each($.proxy(function(i, widget) {
var $widget = $(widget.el);
var wgd = $widget.coords().grid;
var value = parseInt($widget.attr("data-col"));
var col = parseInt($widget.attr("data-col"));
var new_grid_data = {
col: Math.round(value + col_dif),
col: col + col_dif,
row: wgd.row,
size_x: wgd.size_x,
size_y: wgd.size_y
};
setTimeout($.proxy(function () {
this.mutate_widget_in_gridmap($widget, wgd, new_grid_data);
}, this), 0);
@@ -1925,12 +1949,6 @@
this.options.resize.enabled && this.add_resize_handle($el);
if (this.options.center_widgets) {
setTimeout($.proxy(function () {
this.center_widgets();
}, this), 0);
}
return posChanged;
};
@@ -2066,7 +2084,7 @@
}, 60)
});
this.drag_api = this.$el.drag(draggable_options);
this.drag_api = this.$el.gridDraggable(draggable_options);
return this;
};
@@ -2078,7 +2096,7 @@
* @return {Class} Returns instance of gridster Class.
*/
fn.resizable = function() {
this.resize_api = this.$el.drag({
this.resize_api = this.$el.gridDraggable({
items: '.' + this.options.resize.handle_class,
offset_left: this.options.widget_margins[0],
container_width: this.container_width,
@@ -2480,7 +2498,7 @@
if (size_x !== this.resize_last_sizex ||
size_y !== this.resize_last_sizey) {
this.resize_widget(this.$resized_widget, size_x, size_y);
this.resize_widget(this.$resized_widget, size_x, size_y, false);
this.set_dom_grid_width(this.cols);
this.$resize_preview_holder.css({
@@ -3974,15 +3992,12 @@
opts.widget_base_dimensions ||
(opts.widget_base_dimensions = this.options.widget_base_dimensions);
if(this.is_responsive()) {
opts.widget_base_dimensions = [this.get_responsive_col_width(), opts.widget_base_dimensions[1]];
}
opts.widget_margins || (opts.widget_margins = this.options.widget_margins);
this.toggle_collapsed_grid(full_width, opts);
if(this.is_responsive()) {
opts.widget_base_dimensions = [this.get_responsive_col_width(), opts.widget_base_dimensions[1]];
this.toggle_collapsed_grid(full_width, opts);
}
// don't duplicate stylesheets for the same configuration
var serialized_opts = $.param(opts);
@@ -4268,11 +4283,11 @@
*
* @param wrapper
*/
fn.set_num_columns = function (wrapper) {
fn.set_num_columns = function (wrapper_width) {
var max_cols = this.options.max_cols;
var cols = Math.floor(wrapper / (this.min_widget_width + this.options.widget_margins[0])) +
var cols = Math.floor(wrapper_width / (this.min_widget_width + this.options.widget_margins[0])) +
this.options.extra_cols;
var actual_cols = this.$widgets.map(function() {
+1 -1
View File
@@ -1,2 +1,2 @@
/*! gridster.js - v0.6.4 - 2015-03-19 - * http://gridster.net/ - Copyright (c) 2015 decksterteam; Licensed */
/*! gridster.js - v0.6.4 - 2015-04-06 - * http://gridster.net/ - Copyright (c) 2015 decksterteam; Licensed */
.gridster{position:relative}.gridster>*{margin:0 auto;-webkit-transition:height .4s,width .4s;-moz-transition:height .4s,width .4s;-o-transition:height .4s,width .4s;-ms-transition:height .4s,width .4s;transition:height .4s,width .4s}.gridster .gs-w{z-index:2;position:absolute}.gridster.collapsed{height:auto!important}.gridster.collapsed .gs-w{position:static!important}.ready .gs-w:not(.preview-holder){-webkit-transition:opacity .3s,left .3s,top .3s;-moz-transition:opacity .3s,left .3s,top .3s;-o-transition:opacity .3s,left .3s,top .3s;transition:opacity .3s,left .3s,top .3s}.ready .gs-w:not(.preview-holder),.ready .resize-preview-holder{-webkit-transition:opacity .3s,left .3s,top .3s,width .3s,height .3s;-moz-transition:opacity .3s,left .3s,top .3s,width .3s,height .3s;-o-transition:opacity .3s,left .3s,top .3s,width .3s,height .3s;transition:opacity .3s,left .3s,top .3s,width .3s,height .3s}.gridster .preview-holder{z-index:1;position:absolute;background-color:#fff;border-color:#fff;opacity:.3}.gridster .player-revert{z-index:10!important;-webkit-transition:left .3s,top .3s!important;-moz-transition:left .3s,top .3s!important;-o-transition:left .3s,top .3s!important;transition:left .3s,top .3s!important}.gridster .dragging,.gridster .resizing{z-index:10!important;-webkit-transition:all 0s!important;-moz-transition:all 0s!important;-o-transition:all 0s!important;transition:all 0s!important}.gs-resize-handle{position:absolute;z-index:1}.gs-resize-handle-both{width:20px;height:20px;bottom:-8px;right:-8px;background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/Pg08IS0tIEdlbmVyYXRvcjogQWRvYmUgRmlyZXdvcmtzIENTNiwgRXhwb3J0IFNWRyBFeHRlbnNpb24gYnkgQWFyb24gQmVhbGwgKGh0dHA6Ly9maXJld29ya3MuYWJlYWxsLmNvbSkgLiBWZXJzaW9uOiAwLjYuMSAgLS0+DTwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DTxzdmcgaWQ9IlVudGl0bGVkLVBhZ2UlMjAxIiB2aWV3Qm94PSIwIDAgNiA2IiBzdHlsZT0iYmFja2dyb3VuZC1jb2xvcjojZmZmZmZmMDAiIHZlcnNpb249IjEuMSINCXhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbDpzcGFjZT0icHJlc2VydmUiDQl4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjZweCIgaGVpZ2h0PSI2cHgiDT4NCTxnIG9wYWNpdHk9IjAuMzAyIj4NCQk8cGF0aCBkPSJNIDYgNiBMIDAgNiBMIDAgNC4yIEwgNCA0LjIgTCA0LjIgNC4yIEwgNC4yIDAgTCA2IDAgTCA2IDYgTCA2IDYgWiIgZmlsbD0iIzAwMDAwMCIvPg0JPC9nPg08L3N2Zz4=);background-position:top left;background-repeat:no-repeat;cursor:se-resize;z-index:20}.gs-resize-handle-x{top:0;bottom:13px;right:-5px;width:10px;cursor:e-resize}.gs-resize-handle-y{left:0;right:13px;bottom:-5px;height:10px;cursor:s-resize}.gs-w:hover .gs-resize-handle,.resizing .gs-resize-handle{opacity:1}.gs-resize-handle,.gs-w.dragging .gs-resize-handle{opacity:0}.gs-resize-disabled .gs-resize-handle{display:none!important}[data-max-sizex="1"] .gs-resize-handle-x,[data-max-sizey="1"] .gs-resize-handle-y,[data-max-sizey="1"][data-max-sizex="1"] .gs-resize-handle{display:none!important}
+2 -2
View File
File diff suppressed because one or more lines are too long
+52 -37
View File
@@ -1,4 +1,4 @@
/*! gridster.js - v0.6.4 - 2015-03-19
/*! gridster.js - v0.6.4 - 2015-04-06
* http://gridster.net/
* Copyright (c) 2015 decksterteam; Licensed */
@@ -845,7 +845,7 @@
};
//jQuery adapter
$.fn.drag = function ( options ) {
$.fn.gridDraggable = function ( options ) {
return new Draggable(this, options);
};
@@ -1106,6 +1106,12 @@
this.draggable();
this.options.resize.enabled && this.resizable();
if (this.options.center_widgets) {
setTimeout($.proxy(function () {
this.center_widgets();
}, this), 0);
}
$(window).bind('resize.gridster', throttle(
$.proxy(this.recalculate_faux_grid, this), 200));
};
@@ -1222,6 +1228,12 @@
this.drag_api.set_limits((this.cols * this.min_widget_width) + ((this.cols + 1) * this.options.widget_margins[0]));
if (this.options.center_widgets) {
setTimeout($.proxy(function () {
this.center_widgets();
}, this), 0);
}
return $w.fadeIn({complete: function () { if(callback) callback.call(this); }});
};
@@ -1297,14 +1309,17 @@
* @param {Number} size_x The number of columns that will occupy the widget.
* By default <code>size_x</code> is limited to the space available from
* the column where the widget begins, until the last column to the right.
* @param {Boolean} [reposition] Set to false to not move the widget to
* the left if there is insufficient space on the right.
* @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.resize_widget = function($widget, size_x, size_y, callback) {
fn.resize_widget = function($widget, size_x, size_y, reposition, callback) {
var wgd = $widget.coords().grid;
var col = wgd.col;
var max_cols = this.options.max_cols;
reposition !== false && (reposition = true);
var old_size_y = wgd.size_y;
var old_col = wgd.col;
var new_col = old_col;
@@ -1312,8 +1327,14 @@
size_x || (size_x = wgd.size_x);
size_y || (size_y = wgd.size_y);
if (max_cols !== Infinity) {
size_x = Math.min(size_x, max_cols - col + 1);
//if (max_cols !== Infinity) {
// size_x = Math.min(size_x, max_cols - col + 1);
//}
if (reposition && old_col + size_x - 1 > this.cols) {
var diff = old_col + (size_x - 1) - this.cols;
var c = old_col - diff;
new_col = Math.max(1, c);
}
if (size_y > old_size_y) {
@@ -1470,15 +1491,16 @@
* @method center_widgets
*/
fn.center_widgets = debounce(function () {
var window_width = $(window).width();
var wrapper_width = this.$wrapper.width();
var col_size = this.options.widget_base_dimensions[0] + (2 * this.options.widget_margins[0]);
var col_count = Math.floor(Math.max(Math.floor(window_width / col_size), this.min_col_count) / 2) * 2;
var col_count = Math.floor(Math.max(Math.floor(wrapper_width / col_size), this.min_col_count) / 2) * 2;
this.options.min_cols = col_count;
this.options.max_cols = col_count;
this.options.extra_cols = 0;
this.options.max_size_x = col_count;
this.set_dom_grid_width(col_count);
this.cols = col_count;
var col_dif = (col_count - this.prev_col_count) / 2;
@@ -1515,28 +1537,30 @@
fn.get_min_col = function () {
var min_col = this.min_col_count;
this.$widgets.each($.proxy(function(i, widget) {
var $widget = $(widget);
var value = parseInt($widget.attr("data-col"));
min_col = Math.min(min_col, value);
}, this));
return min_col;
return Math.min.apply(Math, this.$widgets.map($.proxy(function (key, widget) {
return this.get_cells_occupied($(widget).coords().grid).cols;
}, this)).get());
};
fn.shift_cols = function (col_dif) {
this.$widgets.each($.proxy(function(i, widget) {
var $widget = $(widget);
var widgets_coords = this.$widgets.map($.proxy(function(i, widget) {
var $w = $(widget);
return this.dom_to_coords($w);
}, this));
widgets_coords = Gridster.sort_by_row_and_col_asc(widgets_coords);
widgets_coords.each($.proxy(function(i, widget) {
var $widget = $(widget.el);
var wgd = $widget.coords().grid;
var value = parseInt($widget.attr("data-col"));
var col = parseInt($widget.attr("data-col"));
var new_grid_data = {
col: Math.round(value + col_dif),
col: col + col_dif,
row: wgd.row,
size_x: wgd.size_x,
size_y: wgd.size_y
};
setTimeout($.proxy(function () {
this.mutate_widget_in_gridmap($widget, wgd, new_grid_data);
}, this), 0);
@@ -1925,12 +1949,6 @@
this.options.resize.enabled && this.add_resize_handle($el);
if (this.options.center_widgets) {
setTimeout($.proxy(function () {
this.center_widgets();
}, this), 0);
}
return posChanged;
};
@@ -2066,7 +2084,7 @@
}, 60)
});
this.drag_api = this.$el.drag(draggable_options);
this.drag_api = this.$el.gridDraggable(draggable_options);
return this;
};
@@ -2078,7 +2096,7 @@
* @return {Class} Returns instance of gridster Class.
*/
fn.resizable = function() {
this.resize_api = this.$el.drag({
this.resize_api = this.$el.gridDraggable({
items: '.' + this.options.resize.handle_class,
offset_left: this.options.widget_margins[0],
container_width: this.container_width,
@@ -2480,7 +2498,7 @@
if (size_x !== this.resize_last_sizex ||
size_y !== this.resize_last_sizey) {
this.resize_widget(this.$resized_widget, size_x, size_y);
this.resize_widget(this.$resized_widget, size_x, size_y, false);
this.set_dom_grid_width(this.cols);
this.$resize_preview_holder.css({
@@ -3974,15 +3992,12 @@
opts.widget_base_dimensions ||
(opts.widget_base_dimensions = this.options.widget_base_dimensions);
if(this.is_responsive()) {
opts.widget_base_dimensions = [this.get_responsive_col_width(), opts.widget_base_dimensions[1]];
}
opts.widget_margins || (opts.widget_margins = this.options.widget_margins);
this.toggle_collapsed_grid(full_width, opts);
if(this.is_responsive()) {
opts.widget_base_dimensions = [this.get_responsive_col_width(), opts.widget_base_dimensions[1]];
this.toggle_collapsed_grid(full_width, opts);
}
// don't duplicate stylesheets for the same configuration
var serialized_opts = $.param(opts);
@@ -4268,11 +4283,11 @@
*
* @param wrapper
*/
fn.set_num_columns = function (wrapper) {
fn.set_num_columns = function (wrapper_width) {
var max_cols = this.options.max_cols;
var cols = Math.floor(wrapper / (this.min_widget_width + this.options.widget_margins[0])) +
var cols = Math.floor(wrapper_width / (this.min_widget_width + this.options.widget_margins[0])) +
this.options.extra_cols;
var actual_cols = this.$widgets.map(function() {
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -423,7 +423,7 @@
};
//jQuery adapter
$.fn.drag = function ( options ) {
$.fn.gridDraggable = function ( options ) {
return new Draggable(this, options);
};
+50 -35
View File
@@ -259,6 +259,12 @@
this.draggable();
this.options.resize.enabled && this.resizable();
if (this.options.center_widgets) {
setTimeout($.proxy(function () {
this.center_widgets();
}, this), 0);
}
$(window).bind('resize.gridster', throttle(
$.proxy(this.recalculate_faux_grid, this), 200));
};
@@ -375,6 +381,12 @@
this.drag_api.set_limits((this.cols * this.min_widget_width) + ((this.cols + 1) * this.options.widget_margins[0]));
if (this.options.center_widgets) {
setTimeout($.proxy(function () {
this.center_widgets();
}, this), 0);
}
return $w.fadeIn({complete: function () { if(callback) callback.call(this); }});
};
@@ -450,14 +462,17 @@
* @param {Number} size_x The number of columns that will occupy the widget.
* By default <code>size_x</code> is limited to the space available from
* the column where the widget begins, until the last column to the right.
* @param {Boolean} [reposition] Set to false to not move the widget to
* the left if there is insufficient space on the right.
* @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.resize_widget = function($widget, size_x, size_y, callback) {
fn.resize_widget = function($widget, size_x, size_y, reposition, callback) {
var wgd = $widget.coords().grid;
var col = wgd.col;
var max_cols = this.options.max_cols;
reposition !== false && (reposition = true);
var old_size_y = wgd.size_y;
var old_col = wgd.col;
var new_col = old_col;
@@ -465,8 +480,14 @@
size_x || (size_x = wgd.size_x);
size_y || (size_y = wgd.size_y);
if (max_cols !== Infinity) {
size_x = Math.min(size_x, max_cols - col + 1);
//if (max_cols !== Infinity) {
// size_x = Math.min(size_x, max_cols - col + 1);
//}
if (reposition && old_col + size_x - 1 > this.cols) {
var diff = old_col + (size_x - 1) - this.cols;
var c = old_col - diff;
new_col = Math.max(1, c);
}
if (size_y > old_size_y) {
@@ -623,15 +644,16 @@
* @method center_widgets
*/
fn.center_widgets = debounce(function () {
var window_width = $(window).width();
var wrapper_width = this.$wrapper.width();
var col_size = this.options.widget_base_dimensions[0] + (2 * this.options.widget_margins[0]);
var col_count = Math.floor(Math.max(Math.floor(window_width / col_size), this.min_col_count) / 2) * 2;
var col_count = Math.floor(Math.max(Math.floor(wrapper_width / col_size), this.min_col_count) / 2) * 2;
this.options.min_cols = col_count;
this.options.max_cols = col_count;
this.options.extra_cols = 0;
this.options.max_size_x = col_count;
this.set_dom_grid_width(col_count);
this.cols = col_count;
var col_dif = (col_count - this.prev_col_count) / 2;
@@ -668,28 +690,30 @@
fn.get_min_col = function () {
var min_col = this.min_col_count;
this.$widgets.each($.proxy(function(i, widget) {
var $widget = $(widget);
var value = parseInt($widget.attr("data-col"));
min_col = Math.min(min_col, value);
}, this));
return min_col;
return Math.min.apply(Math, this.$widgets.map($.proxy(function (key, widget) {
return this.get_cells_occupied($(widget).coords().grid).cols;
}, this)).get());
};
fn.shift_cols = function (col_dif) {
this.$widgets.each($.proxy(function(i, widget) {
var $widget = $(widget);
var widgets_coords = this.$widgets.map($.proxy(function(i, widget) {
var $w = $(widget);
return this.dom_to_coords($w);
}, this));
widgets_coords = Gridster.sort_by_row_and_col_asc(widgets_coords);
widgets_coords.each($.proxy(function(i, widget) {
var $widget = $(widget.el);
var wgd = $widget.coords().grid;
var value = parseInt($widget.attr("data-col"));
var col = parseInt($widget.attr("data-col"));
var new_grid_data = {
col: Math.round(value + col_dif),
col: col + col_dif,
row: wgd.row,
size_x: wgd.size_x,
size_y: wgd.size_y
};
setTimeout($.proxy(function () {
this.mutate_widget_in_gridmap($widget, wgd, new_grid_data);
}, this), 0);
@@ -1078,12 +1102,6 @@
this.options.resize.enabled && this.add_resize_handle($el);
if (this.options.center_widgets) {
setTimeout($.proxy(function () {
this.center_widgets();
}, this), 0);
}
return posChanged;
};
@@ -1219,7 +1237,7 @@
}, 60)
});
this.drag_api = this.$el.drag(draggable_options);
this.drag_api = this.$el.gridDraggable(draggable_options);
return this;
};
@@ -1231,7 +1249,7 @@
* @return {Class} Returns instance of gridster Class.
*/
fn.resizable = function() {
this.resize_api = this.$el.drag({
this.resize_api = this.$el.gridDraggable({
items: '.' + this.options.resize.handle_class,
offset_left: this.options.widget_margins[0],
container_width: this.container_width,
@@ -1633,7 +1651,7 @@
if (size_x !== this.resize_last_sizex ||
size_y !== this.resize_last_sizey) {
this.resize_widget(this.$resized_widget, size_x, size_y);
this.resize_widget(this.$resized_widget, size_x, size_y, false);
this.set_dom_grid_width(this.cols);
this.$resize_preview_holder.css({
@@ -3127,15 +3145,12 @@
opts.widget_base_dimensions ||
(opts.widget_base_dimensions = this.options.widget_base_dimensions);
if(this.is_responsive()) {
opts.widget_base_dimensions = [this.get_responsive_col_width(), opts.widget_base_dimensions[1]];
}
opts.widget_margins || (opts.widget_margins = this.options.widget_margins);
this.toggle_collapsed_grid(full_width, opts);
if(this.is_responsive()) {
opts.widget_base_dimensions = [this.get_responsive_col_width(), opts.widget_base_dimensions[1]];
this.toggle_collapsed_grid(full_width, opts);
}
// don't duplicate stylesheets for the same configuration
var serialized_opts = $.param(opts);
@@ -3421,11 +3436,11 @@
*
* @param wrapper
*/
fn.set_num_columns = function (wrapper) {
fn.set_num_columns = function (wrapper_width) {
var max_cols = this.options.max_cols;
var cols = Math.floor(wrapper / (this.min_widget_width + this.options.widget_margins[0])) +
var cols = Math.floor(wrapper_width / (this.min_widget_width + this.options.widget_margins[0])) +
this.options.extra_cols;
var actual_cols = this.$widgets.map(function() {