annotorious / annotorious-openseadragon

An OpenSeadragon plugin for annotating high-res zoomable images
https://annotorious.github.io
BSD 3-Clause "New" or "Revised" License
121 stars 42 forks source link

add check for line #131

Closed Architrixs closed 2 years ago

Architrixs commented 2 years ago

Related change for https://github.com/recogito/annotorious-selector-pack/pull/17

rsimon commented 2 years ago

That doesn't quite work yet. The purpose of this check is the following:

image

image

Your test for the line always returns true, which means a line will always obstruct any shape underneath it's bounding box. The ideal test would check if the mouse is actually above the line (with a small buffer on each side).

I'll merge the PR for now, so that things work. But I'll open an issue so we can keep this limitation on the list.

Architrixs commented 2 years ago

Got

That doesn't quite work yet. The purpose of this check is the following:

  • All shapes are stored in a spatial index, using their bounding box. This way, Annotorious can quickly test which shapes are underneath the mouse for every mousemove event.
  • The spatial index will only test by the shape bounding box. Therefore, a mouseover would also trigger in cases where the actual shape isn't underneath the mouse. See examples below:

image

image

  • The spatial index will return a hit anywhere within the dashed box. That's where the second test comes in: this takes all the shapes found by bounding box, and tests whether they actually intersect the mouse coordinates.

Your test for the line always returns true, which means a line will always obstruct any shape underneath it's bounding box. The ideal test would check if the mouse is actually above the line (with a small buffer on each side).

I'll merge the PR for now, so that things work. But I'll open an issue so we can keep this limitation on the list.

Got it! Thanks.

rsimon commented 2 years ago

Corresponding issue ticket here: https://github.com/recogito/annotorious-openseadragon/issues/132