summaryrefslogtreecommitdiff
path: root/program/js
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2009-06-05 08:12:26 +0000
committeralecpl <alec@alec.pl>2009-06-05 08:12:26 +0000
commit12989a756d351429f2bcdc279855a773f5b49c20 (patch)
tree037d25a699be0fe6f1c41b996c388bea55c5e8b8 /program/js
parent74eb6c3ceb214d816a679fb6c99495bd8c192f80 (diff)
- small fixes/improvements of drag&drop
Diffstat (limited to 'program/js')
-rw-r--r--program/js/app.js28
1 files changed, 12 insertions, 16 deletions
diff --git a/program/js/app.js b/program/js/app.js
index 3bc194272..5f96c8bba 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -1265,7 +1265,8 @@ function rcube_webmail()
// 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 };
+ this.env.folder_coords[k] = { x1:pos.left, y1:pos.top,
+ x2:pos.left + li.firstChild.offsetWidth, y2:pos.top + height, on:0 };
}
}
}
@@ -1275,14 +1276,13 @@ function rcube_webmail()
this.drag_end = function(e)
{
this.drag_active = false;
+ this.env.last_folder_target = null;
// over the folders
if (this.gui_objects.folderlist && this.env.folder_coords) {
for (var k in this.env.folder_coords) {
- if (k == this.env.last_folder_target) {
+ if (this.env.folder_coords[k].on)
$(this.get_folder_li(k)).removeClass('droptarget');
- this.env.last_folder_target = null;
- }
}
}
};
@@ -1298,36 +1298,32 @@ function rcube_webmail()
var li, pos, mouse;
mouse = rcube_event.get_mouse_pos(e);
pos = this.env.folderlist_coords;
-
mouse.y += toffset;
// if mouse pointer is outside of folderlist
if (mouse.x < pos.x1 || mouse.x >= pos.x2 || mouse.y < pos.y1 || mouse.y >= pos.y2) {
- if (this.env.last_folder_target) {
+ if (this.env.last_folder_target) {
$(this.get_folder_li(this.env.last_folder_target)).removeClass('droptarget');
- this.env.last_folder_target = null;
- }
+ this.env.folder_coords[this.env.last_folder_target].on = 0;
+ this.env.last_folder_target = null;
+ }
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 ((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;
this.env.folder_coords[k].on = 1;
}
- else if (pos.on){
- if (k == last)
- this.env.last_folder_target = null;
+ else if (pos.on) {
+ $(this.get_folder_li(k)).removeClass('droptarget');
this.env.folder_coords[k].on = 0;
- $(this.get_folder_li(k)).removeClass('droptarget');
}
}
}