updated doc and dist

This commit is contained in:
vieron
2012-07-19 15:56:12 +02:00
parent 2bcd943fff
commit d4145e873c
5 changed files with 364 additions and 123 deletions

View File

@@ -409,6 +409,7 @@
this.set_dom_grid_height();
this.$wrapper.addClass('ready');
this.draggable();
this.next_position(2, 2);
$(window).bind(
'resize', throttle($.proxy(this.recalculate_faux_grid, this), 200));
@@ -446,6 +447,47 @@
};
/**
* Get the most left column below to add a new widget.
*
* @method next_position
* @param {Number} size_x The nº of rows the widget occupies horizontally.
* @param {Number} size_y The nº of columns the widget occupies vertically.
* @return {Object} Returns a grid coords object representing the future
* widget coords.
*/
fn.next_position = function(size_x, size_y) {
var ga = this.gridmap;
var cols_l = ga.length;
var valid_pos = [];
for (var c = 1; c < cols_l; c++) {
var rows_l = ga[c].length;
for (var r = 1; r <= rows_l; r++) {
var can_move_to = this.can_move_to({
size_x: size_x,
size_y: size_y
}, c, r);
if (can_move_to) {
valid_pos.push({
col: c,
row: r,
size_y: size_y,
size_x: size_x
});
};
};
};
if (valid_pos.length) {
this.next_position = this.sort_by_row_asc(valid_pos)[0];
return this.next_position;
};
return false;
}
/**
* Remove a widget from the grid.
*