Serialize bug fix

This commit is contained in:
Dustin Moore
2012-12-10 14:33:25 -08:00
parent 44019ca787
commit 3ebf5fa95e
8 changed files with 89 additions and 17 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
/*! gridster.js - v0.1.0 - 2012-11-28
/*! gridster.js - v0.1.0 - 2012-12-10
* http://gridster.net/
* Copyright (c) 2012 ducksboard; Licensed MIT */
+28 -4
View File
@@ -1,4 +1,4 @@
/*! gridster.js - v0.1.0 - 2012-11-28
/*! gridster.js - v0.1.0 - 2012-12-10
* http://gridster.net/
* Copyright (c) 2012 ducksboard; Licensed MIT */
@@ -690,7 +690,7 @@
};
//jQuery adapter
$.fn.drag = function ( options ) {
$.fn.dragg = function ( options ) {
return this.each(function () {
if (!$.data(this, 'drag')) {
$.data(this, 'drag', new Draggable( this, options ));
@@ -712,6 +712,7 @@
extra_rows: 0,
extra_cols: 0,
min_cols: 1,
max_cols: 50,
min_rows: 15,
max_rows: 15,
max_size_x: 6,
@@ -874,6 +875,7 @@
}).addClass('gs_w').appendTo(this.$el).hide();
this.$widgets = this.$widgets.add($w);
this.$changed = this.$changed.add($w);
this.register_widget($w);
@@ -1131,6 +1133,13 @@
return false;
};
fn.remove_by_grid = function(col, row){
var $w = this.is_widget(col, row);
if($w){
this.remove_widget($w);
}
}
/**
* Remove a widget from the grid.
@@ -1207,8 +1216,10 @@
$widgets || ($widgets = this.$widgets);
var result = [];
$widgets.each($.proxy(function(i, widget) {
result.push(this.options.serialize_params(
if(typeof($(widget).coords().grid) != "undefined"){
result.push(this.options.serialize_params(
$(widget), $(widget).coords().grid ) );
}
}, this));
return result;
@@ -1249,6 +1260,10 @@
!this.can_move_to(
{size_x: wgd.size_x, size_y: wgd.size_y}, wgd.col, wgd.row)
) {
if(!$el.hasClass('.disp_ad')){
$el.remove();
return false;
}
wgd = this.next_position(wgd.size_x, wgd.size_y);
wgd.el = $el;
$el.attr({
@@ -1360,7 +1375,7 @@
}, 60)
});
this.drag_api = this.$el.drag(draggable_options).data('drag');
this.drag_api = this.$el.dragg(draggable_options).data('drag');
return this;
};
@@ -1754,6 +1769,12 @@
delete this.w_queue[key];
}
}
if(rowc > parseInt(this.options.max_rows)){
occupied = true;
}
if(colc > parseInt(this.options.max_cols)){
occupied = true;
}
if (this.is_player_in(colc,rowc)){
occupied = true;
}
@@ -1775,6 +1796,9 @@
if(rowc > parseInt(this.options.max_rows)){
can_set = false;
}
if(colc > parseInt(this.options.max_cols)){
can_set = false;
}
if(this.is_occupied(colc,rowc) && !this.is_widget_queued_and_can_move($tw)){
can_set = false;
}
+1 -1
View File
@@ -1,3 +1,3 @@
/*! gridster.js - v0.1.0 - 2012-11-28
/*! gridster.js - v0.1.0 - 2012-12-10
* http://gridster.net/
* Copyright (c) 2012 ducksboard; Licensed MIT */.gridster{position:relative}.gridster>*{margin:0 auto;-webkit-transition:height .4s;-moz-transition:height .4s;-o-transition:height .4s;-ms-transition:height .4s;transition:height .4s}.gridster .gs_w{z-index:2;position:absolute}.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){-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{z-index:10!important;-webkit-transition:all 0s!important;-moz-transition:all 0s!important;-o-transition:all 0s!important;transition:all 0s!important}
+2 -2
View File
File diff suppressed because one or more lines are too long
+28 -4
View File
@@ -1,4 +1,4 @@
/*! gridster.js - v0.1.0 - 2012-11-28
/*! gridster.js - v0.1.0 - 2012-12-10
* http://gridster.net/
* Copyright (c) 2012 ducksboard; Licensed MIT */
@@ -690,7 +690,7 @@
};
//jQuery adapter
$.fn.drag = function ( options ) {
$.fn.dragg = function ( options ) {
return this.each(function () {
if (!$.data(this, 'drag')) {
$.data(this, 'drag', new Draggable( this, options ));
@@ -712,6 +712,7 @@
extra_rows: 0,
extra_cols: 0,
min_cols: 1,
max_cols: 50,
min_rows: 15,
max_rows: 15,
max_size_x: 6,
@@ -874,6 +875,7 @@
}).addClass('gs_w').appendTo(this.$el).hide();
this.$widgets = this.$widgets.add($w);
this.$changed = this.$changed.add($w);
this.register_widget($w);
@@ -1131,6 +1133,13 @@
return false;
};
fn.remove_by_grid = function(col, row){
var $w = this.is_widget(col, row);
if($w){
this.remove_widget($w);
}
}
/**
* Remove a widget from the grid.
@@ -1207,8 +1216,10 @@
$widgets || ($widgets = this.$widgets);
var result = [];
$widgets.each($.proxy(function(i, widget) {
result.push(this.options.serialize_params(
if(typeof($(widget).coords().grid) != "undefined"){
result.push(this.options.serialize_params(
$(widget), $(widget).coords().grid ) );
}
}, this));
return result;
@@ -1249,6 +1260,10 @@
!this.can_move_to(
{size_x: wgd.size_x, size_y: wgd.size_y}, wgd.col, wgd.row)
) {
if(!$el.hasClass('.disp_ad')){
$el.remove();
return false;
}
wgd = this.next_position(wgd.size_x, wgd.size_y);
wgd.el = $el;
$el.attr({
@@ -1360,7 +1375,7 @@
}, 60)
});
this.drag_api = this.$el.drag(draggable_options).data('drag');
this.drag_api = this.$el.dragg(draggable_options).data('drag');
return this;
};
@@ -1754,6 +1769,12 @@
delete this.w_queue[key];
}
}
if(rowc > parseInt(this.options.max_rows)){
occupied = true;
}
if(colc > parseInt(this.options.max_cols)){
occupied = true;
}
if (this.is_player_in(colc,rowc)){
occupied = true;
}
@@ -1775,6 +1796,9 @@
if(rowc > parseInt(this.options.max_rows)){
can_set = false;
}
if(colc > parseInt(this.options.max_cols)){
can_set = false;
}
if(this.is_occupied(colc,rowc) && !this.is_widget_queued_and_can_move($tw)){
can_set = false;
}
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -338,7 +338,7 @@
};
//jQuery adapter
$.fn.drag = function ( options ) {
$.fn.dragg = function ( options ) {
return this.each(function () {
if (!$.data(this, 'drag')) {
$.data(this, 'drag', new Draggable( this, options ));
+26 -2
View File
@@ -16,6 +16,7 @@
extra_rows: 0,
extra_cols: 0,
min_cols: 1,
max_cols: 50,
min_rows: 15,
max_rows: 15,
max_size_x: 6,
@@ -178,6 +179,7 @@
}).addClass('gs_w').appendTo(this.$el).hide();
this.$widgets = this.$widgets.add($w);
this.$changed = this.$changed.add($w);
this.register_widget($w);
@@ -435,6 +437,13 @@
return false;
};
fn.remove_by_grid = function(col, row){
var $w = this.is_widget(col, row);
if($w){
this.remove_widget($w);
}
}
/**
* Remove a widget from the grid.
@@ -511,8 +520,10 @@
$widgets || ($widgets = this.$widgets);
var result = [];
$widgets.each($.proxy(function(i, widget) {
result.push(this.options.serialize_params(
if(typeof($(widget).coords().grid) != "undefined"){
result.push(this.options.serialize_params(
$(widget), $(widget).coords().grid ) );
}
}, this));
return result;
@@ -553,6 +564,10 @@
!this.can_move_to(
{size_x: wgd.size_x, size_y: wgd.size_y}, wgd.col, wgd.row)
) {
if(!$el.hasClass('.disp_ad')){
$el.remove();
return false;
}
wgd = this.next_position(wgd.size_x, wgd.size_y);
wgd.el = $el;
$el.attr({
@@ -664,7 +679,7 @@
}, 60)
});
this.drag_api = this.$el.drag(draggable_options).data('drag');
this.drag_api = this.$el.dragg(draggable_options).data('drag');
return this;
};
@@ -1058,6 +1073,12 @@
delete this.w_queue[key];
}
}
if(rowc > parseInt(this.options.max_rows)){
occupied = true;
}
if(colc > parseInt(this.options.max_cols)){
occupied = true;
}
if (this.is_player_in(colc,rowc)){
occupied = true;
}
@@ -1079,6 +1100,9 @@
if(rowc > parseInt(this.options.max_rows)){
can_set = false;
}
if(colc > parseInt(this.options.max_cols)){
can_set = false;
}
if(this.is_occupied(colc,rowc) && !this.is_widget_queued_and_can_move($tw)){
can_set = false;
}