Changeset 2610 in subversion


Ignore:
Timestamp:
Jun 5, 2009 4:12:26 AM (4 years ago)
Author:
alec
Message:
  • small fixes/improvements of drag&drop
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/js/app.js

    r2607 r2610  
    12661266          if (height = li.firstChild.offsetHeight) { 
    12671267            pos = $(li.firstChild).offset(); 
    1268             this.env.folder_coords[k] = { x1:pos.left, y1:pos.top, x2:pos.left + li.firstChild.offsetWidth, y2:pos.top + height, on:0 }; 
     1268            this.env.folder_coords[k] = { x1:pos.left, y1:pos.top, 
     1269                x2:pos.left + li.firstChild.offsetWidth, y2:pos.top + height, on:0 }; 
    12691270          } 
    12701271        } 
     
    12761277  { 
    12771278    this.drag_active = false; 
     1279    this.env.last_folder_target = null; 
    12781280 
    12791281    // over the folders 
    12801282    if (this.gui_objects.folderlist && this.env.folder_coords) { 
    12811283      for (var k in this.env.folder_coords) { 
    1282         if (k == this.env.last_folder_target) { 
     1284        if (this.env.folder_coords[k].on) 
    12831285          $(this.get_folder_li(k)).removeClass('droptarget'); 
    1284           this.env.last_folder_target = null; 
    1285         } 
    12861286      } 
    12871287    } 
     
    12991299      mouse = rcube_event.get_mouse_pos(e); 
    13001300      pos = this.env.folderlist_coords; 
    1301  
    13021301      mouse.y += toffset; 
    13031302 
    13041303      // if mouse pointer is outside of folderlist 
    13051304      if (mouse.x < pos.x1 || mouse.x >= pos.x2 || mouse.y < pos.y1 || mouse.y >= pos.y2) { 
    1306         if (this.env.last_folder_target) { 
     1305        if (this.env.last_folder_target) { 
    13071306          $(this.get_folder_li(this.env.last_folder_target)).removeClass('droptarget'); 
    1308           this.env.last_folder_target = null; 
    1309         } 
     1307          this.env.folder_coords[this.env.last_folder_target].on = 0; 
     1308          this.env.last_folder_target = null; 
     1309        } 
    13101310        return; 
    13111311      } 
    13121312     
    13131313      var last = this.env.last_folder_target; 
     1314 
    13141315      // over the folders 
    13151316      for (var k in this.env.folder_coords) { 
    13161317        pos = this.env.folder_coords[k]; 
    1317         if ((mouse.x >= pos.x1) && (mouse.x < pos.x2)  
    1318             && (mouse.y >= pos.y1) && (mouse.y < pos.y2) 
     1318        if (mouse.x >= pos.x1 && mouse.x < pos.x2 && mouse.y >= pos.y1 && mouse.y < pos.y2 
    13191319            && this.check_droptarget(k)) { 
    1320           if (k == last) 
    1321             continue;  
    13221320          $(this.get_folder_li(k)).addClass('droptarget'); 
    13231321          this.env.last_folder_target = k; 
    13241322          this.env.folder_coords[k].on = 1; 
    13251323        } 
    1326         else if (pos.on){ 
    1327           if (k == last) 
    1328             this.env.last_folder_target = null; 
     1324        else if (pos.on) { 
     1325          $(this.get_folder_li(k)).removeClass('droptarget'); 
    13291326          this.env.folder_coords[k].on = 0; 
    1330           $(this.get_folder_li(k)).removeClass('droptarget'); 
    13311327        } 
    13321328      } 
Note: See TracChangeset for help on using the changeset viewer.