Question

I am currently working with Seadragon Ajax technology (demos at zoom.it), adding custom interface etc. In particular, I am adding a certain numbers of overlays which need to capture some mouse events (like clicks) but which don't need to capture others (like wheel scrolling).

Seadragon uses mouse pointer position while scrolling to zoom to a pointed part of an image. I'd like to capture mouse events on the overlay but pass some of them under it. Thus, I'm looking for a way to implement a function which would:

  1. take two arguments: theoretical mouse position, vertical and horizontal part
  2. find the DOM element that represents the HTML element which would capture the mouse event at given coordinates
  3. pass the mouse event to this element

The problem is, I have no idea how to reliably do the 2nd step. Seadragon creates many divs containing tiles with graphics, they change each time one pans or zooms the image. Thus, I can't just index it, I need a way to detect it on the fly.

I'd be grateful for any help and/or ideas.

Was it helpful?

Solution

OK, this is so simple I'm ashamed of myself.

document.elementFromPoint(x, y)

It's also almost universally supported... I was probably looking for sth named like getElementFromPoint and this get part misled me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top