I am writing an application that uses OpenLayers to enable users to drag and drop files on to a pre-defined set of features that get sent to a server with AJAX. The files themselves are raw data from geophysics equipment that will be rendered as a raster layer by the server.
I have drag-and-drop working for the map:
var mapelem = $id("map");
mapelem.addEventListener("dragover", FileDragHover, false);
mapelem.addEventListener("dragleave", FileDragHover, false);
mapelem.addEventListener("drop", FileSelectHandler, false);
And I have highlight on hover working with this code:
var sf = new OpenLayers.Control.SelectFeature(boxes, {
hover: true,
multiple: false,
highlightOnly: true
});
map.addControl(sf);
sf.activate();
The rest of the code is mostly just the Boxes Example - Vector.
The problem is that when dragging a file onto the map canvas, the OpenLayers hover selection no longer works, and I would like the feedback it gives the user to ensure they're dropping the file where they expect it.
I can get the cursor's position on the canvas:
map.events.register("mousemove", map, function(e) {
lonlat = map.getLonLatFromPixel(e.xy);
});
So I may be able to do a point-in-feature test in that function, but it would be nice to be able to use the existing functionality.
Is there some way I can propagate the drag message to my OpenLayers layer?