On Thu, 2012-09-06 at 09:03 -0700, rafamachadoalves wrote: > Hi. > Is there a way of OnDragEnter event to happen when a DIV enters the > target element instead of the Mouse? > How do I implement this feature for drop events? > [] > --
Hi, Rafa The drag and drop implementation is intended for easily transferring "data" inside and between apps (think: drag-and-drop text editing, or dropping a selection of .mp3 file names onto a play list). Particularly with native HTML5 drag and drop implementations, you will not be able to alter the way the events happen. It's a specification, and onDragEnter happens according to the specification, not at a time of your choosing. However: If you just want to drag elements around, that's simple enough, and "onMouseMove" is the main event you really need to deal with. You will be setting left and top coordinates for the DIV you are dragging around, and you will need right and bottom for calculating intersection. You will also need left, right, top, and bottom coordinates for any target elements. Go through the list of target elements "often enough" when "onMouseMove" happens, calculating whether there is intersection between your DIV and a target. Then, do whatever you want. Feel free to borrow event handling code from dnd/DNDHelper.py - Jim Washington --
