- fix drag_move performance

release-0.6
alecpl 16 years ago
parent 88ed237f7c
commit 0061e7b77f

@ -1262,10 +1262,11 @@ function rcube_webmail()
this.env.folder_coords = new Array(); this.env.folder_coords = new Array();
for (var k in model) { for (var k in model) {
if (li = this.get_folder_li(k)) { if (li = this.get_folder_li(k)) {
pos = $(li.firstChild).offset(); // only visible folders
// only visible folders if (height = li.firstChild.offsetHeight) {
if (height = li.firstChild.offsetHeight) pos = $(li.firstChild).offset();
this.env.folder_coords[k] = { x1:pos.left, y1:pos.top, x2:pos.left + li.firstChild.offsetWidth, y2:pos.top + height }; this.env.folder_coords[k] = { x1:pos.left, y1:pos.top, x2:pos.left + li.firstChild.offsetWidth, y2:pos.top + height, on:0 };
}
} }
} }
} }
@ -1308,24 +1309,30 @@ function rcube_webmail()
} }
return; return;
} }
var last = this.env.last_folder_target;
// over the folders // over the folders
for (var k in this.env.folder_coords) { for (var k in this.env.folder_coords) {
pos = this.env.folder_coords[k]; pos = this.env.folder_coords[k];
if (this.check_droptarget(k) && ((mouse.x >= pos.x1) && (mouse.x < pos.x2) if ((mouse.x >= pos.x1) && (mouse.x < pos.x2)
&& (mouse.y >= pos.y1) && (mouse.y < pos.y2))) { && (mouse.y >= pos.y1) && (mouse.y < pos.y2)
&& this.check_droptarget(k)) {
if (k == last)
continue;
$(this.get_folder_li(k)).addClass('droptarget'); $(this.get_folder_li(k)).addClass('droptarget');
this.env.last_folder_target = k; this.env.last_folder_target = k;
} this.env.folder_coords[k].on = 1;
else { }
else if (pos.on){
if (k == last)
this.env.last_folder_target = null;
this.env.folder_coords[k].on = 0;
$(this.get_folder_li(k)).removeClass('droptarget'); $(this.get_folder_li(k)).removeClass('droptarget');
if (k == this.env.last_folder_target) }
this.env.last_folder_target = null;
}
} }
} }
}; };
this.collapse_folder = function(id) this.collapse_folder = function(id)
{ {
var div; var div;

Loading…
Cancel
Save