alecpl
2009-06-04 0061e7b77fee24b216433256b636505a2d5cb9d4
- fix drag_move performance


1 files modified
33 ■■■■■ changed files
program/js/app.js 33 ●●●●● patch | view | raw | blame | history
program/js/app.js
@@ -1262,10 +1262,11 @@
      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 @@
        }
        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;