Is there a way to determine a drop container without looping through each container and comparing absolute positions? This is the only solution mentioned in this article:
http://www.webreference.com/programming/javascript/mk/column2/2.html I don't want to have to move the item being dragged out of the way of the cursor so that i have event.target available. I'm thinking it can be looked up some how with a hash table so that it is O(1). I suppose we can assume that the containers do not overlap.. I suppose if I store for containers i in (0,N)..: container[i].x0 //top left point container[i].y0 container[i].x1 //bottom right point container[i].y1 then I generate javascript like this perhaps: switch(pos){ case pos.x>container0x0&&pos.y>container0x0&&pos.x<container0x1&&pos.y<container0y1: return container[0]; ..etc } ..but then I would have to eval this, and I'm not sure if there would be any performance gain..would the switch generate a hash table? Also, would container[0] even be accessible inside an eval. Is there a way to map the position values to a hashtable for all containers without looping?