some changes for gridster
This commit is contained in:
parent
e9c0f443b7
commit
912080482b
|
@ -459,40 +459,54 @@ var orbitDesktop = function(dom){
|
|||
.gridster({
|
||||
widget_margins: [6, 6],
|
||||
widget_base_dimensions: [120, 120],
|
||||
avoid_overlapped_widgets: true,
|
||||
// avoid_overlapped_widgets: true,
|
||||
draggable : {
|
||||
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");
|
||||
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;
|
||||
// if(!isNaN(sizex)){
|
||||
// total += sizex;
|
||||
// }
|
||||
// })
|
||||
// if(total>totaltiles_in_a_row){
|
||||
// revertbacktiles();
|
||||
// }
|
||||
// }
|
||||
|
||||
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){
|
||||
$(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();
|
||||
o.initializeWidgets();
|
||||
|
|
Loading…
Reference in New Issue