summaryrefslogtreecommitdiff
path: root/program/js
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2009-06-04 20:01:31 +0000
committeralecpl <alec@alec.pl>2009-06-04 20:01:31 +0000
commit0061e7b77fee24b216433256b636505a2d5cb9d4 (patch)
tree3cfaf5c7b6c099779b54b875bdae680abf7a3a19 /program/js
parent88ed237f7c80b00cb6b5060fed64b97a4372b23e (diff)
- fix drag_move performance
Diffstat (limited to 'program/js')
-rw-r--r--program/js/app.js33
1 files changed, 20 insertions, 13 deletions
diff --git a/program/js/app.js b/program/js/app.js
index 9cc3c1d73..3bc194272 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -1262,10 +1262,11 @@ function rcube_webmail()
this.env.folder_coords = new Array();
for (var k in model) {
if (li = this.get_folder_li(k)) {
- pos = $(li.firstChild).offset();
- // only visible folders
- if (height = li.firstChild.offsetHeight)
- this.env.folder_coords[k] = { x1:pos.left, y1:pos.top, x2:pos.left + li.firstChild.offsetWidth, y2:pos.top + height };
+ // only visible folders
+ 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, on:0 };
+ }
}
}
}
@@ -1308,24 +1309,30 @@ function rcube_webmail()
}
return;
}
-
+
+ var last = this.env.last_folder_target;
// over the folders
for (var k in this.env.folder_coords) {
pos = this.env.folder_coords[k];
- if (this.check_droptarget(k) && ((mouse.x >= pos.x1) && (mouse.x < pos.x2)
- && (mouse.y >= pos.y1) && (mouse.y < pos.y2))) {
+ if ((mouse.x >= pos.x1) && (mouse.x < pos.x2)
+ && (mouse.y >= pos.y1) && (mouse.y < pos.y2)
+ && this.check_droptarget(k)) {
+ if (k == last)
+ continue;
$(this.get_folder_li(k)).addClass('droptarget');
this.env.last_folder_target = k;
- }
- else {
+ this.env.folder_coords[k].on = 1;
+ }
+ 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');
- if (k == this.env.last_folder_target)
- this.env.last_folder_target = null;
- }
+ }
}
}
};
-
+
this.collapse_folder = function(id)
{
var div;