some changes for gridster
This commit is contained in:
parent
b8ee748723
commit
0f12314213
|
@ -459,40 +459,54 @@ var orbitDesktop = function(dom){
|
||||||
.gridster({
|
.gridster({
|
||||||
widget_margins: [6, 6],
|
widget_margins: [6, 6],
|
||||||
widget_base_dimensions: [120, 120],
|
widget_base_dimensions: [120, 120],
|
||||||
avoid_overlapped_widgets: true,
|
// avoid_overlapped_widgets: true,
|
||||||
draggable : {
|
draggable : {
|
||||||
stop: function(event, ui){
|
stop: function(event, ui){
|
||||||
|
// var widgetchanged_col = dragged.attr("data-col");
|
||||||
|
// var total = 0;
|
||||||
|
// // console.log(widgetchanged.col);
|
||||||
|
// // console.log(o.gridvar.serialize_changed());
|
||||||
|
// $(".grid ul li[data-col="+widgetchanged_col+"]").each(function(i,w){
|
||||||
|
// var size = parseInt($(this).attr("data-sizey"));
|
||||||
|
// if(!isNaN(size)){
|
||||||
|
// total += size;
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// // other way to calculate the overflow is by top > height of div
|
||||||
|
// if(total>totaltiles_in_a_row){
|
||||||
|
// revertbacktiles();
|
||||||
|
// }else{
|
||||||
|
// console.log(widgetchanged_col-1);
|
||||||
|
// $(".grid ul li[data-col="+(widgetchanged_col-1)+"]").each(function(i,w){
|
||||||
|
// var sizey = parseInt($(this).attr("data-sizey"));
|
||||||
|
// var sizex = parseInt($(this).attr("data-sizex"));
|
||||||
|
// if(sizey==1){
|
||||||
|
// sizex = sizex - 1;
|
||||||
|
// }
|
||||||
|
// console.log(sizex);
|
||||||
|
|
||||||
var widgetchanged_col = dragged.attr("data-col");
|
// if(!isNaN(sizex)){
|
||||||
var total = 0;
|
// total += sizex;
|
||||||
// console.log(widgetchanged.col);
|
// }
|
||||||
// console.log(o.gridvar.serialize_changed());
|
// })
|
||||||
$(".grid ul li[data-col="+widgetchanged_col+"]").each(function(i,w){
|
// if(total>totaltiles_in_a_row){
|
||||||
var size = parseInt($(this).attr("data-sizey"));
|
// revertbacktiles();
|
||||||
if(!isNaN(size)){
|
// }
|
||||||
total += size;
|
// }
|
||||||
|
|
||||||
|
for (var i = 1; i <= 30; i++) {
|
||||||
|
// var celement = $(".grid ul .widget[data-col="+i+"]:last");
|
||||||
|
$(".grid ul .widget[data-col="+i+"]").each(function(){
|
||||||
|
var pos = $(this).position();
|
||||||
|
if(pos){
|
||||||
|
console.log(pos.top + $(this).height() + 6);
|
||||||
|
if((pos.top + $(this).height() + 6) > 550){
|
||||||
|
revertbacktiles();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// other way to calculate the overflow is by top > height of div
|
|
||||||
if(total>totaltiles_in_a_row){
|
|
||||||
revertbacktiles();
|
|
||||||
}else{
|
|
||||||
console.log(widgetchanged_col-1);
|
|
||||||
$(".grid ul li[data-col="+(widgetchanged_col-1)+"]").each(function(i,w){
|
|
||||||
var sizey = parseInt($(this).attr("data-sizey"));
|
|
||||||
var sizex = parseInt($(this).attr("data-sizex"));
|
|
||||||
if(sizey==1){
|
|
||||||
sizex = sizex - 1;
|
|
||||||
}
|
|
||||||
console.log(sizex);
|
|
||||||
|
|
||||||
if(!isNaN(sizex)){
|
|
||||||
total += sizex;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
if(total>totaltiles_in_a_row){
|
|
||||||
revertbacktiles();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -502,6 +516,15 @@ var orbitDesktop = function(dom){
|
||||||
$(".grid ul li").each(function(i){
|
$(".grid ul li").each(function(i){
|
||||||
$(this).attr({"data-col":lastpos[i].col,"data-row":lastpos[i].row});
|
$(this).attr({"data-col":lastpos[i].col,"data-row":lastpos[i].row});
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
var remove_empty_columns = function(){
|
||||||
|
for (var i = 1; i <= 30; i++) {
|
||||||
|
// var celement = $(".grid ul .widget[data-col="+i+"]:last");
|
||||||
|
$(".grid ul .widget[data-col="+i+"]").each(function(){
|
||||||
|
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
bindHandlers();
|
bindHandlers();
|
||||||
o.initializeWidgets();
|
o.initializeWidgets();
|
||||||
|
|
Loading…
Reference in New Issue