Skip to content

Fix annotation on rotated elements

Erwan Rouchet requested to merge fix-interactiveimage-rotated-annotation into master

Closes #938 (closed)

This adds a new option to the boundingBox helper to disable the sanity checks related to the image. They are enabled by default, which prevents breaking IIIF URLs among other things, but can be turned off to compute bounding boxes that leave the image, which commonly occurs for any non-square image that gets rotated.

This option is then used in ElementImage, since it used a custom bounding box calculation to avoid the image's bounds, and is used in the InteractiveImage to map the svgInput SVG element that is used as a helper to map coordinates in the SVG to coordinates on the original element. This allows the coordinates to be translated properly when clicking or moving the mouse. The elementLimits method has also been updated to use the original, non-rotated bounding box, for bounds checking, which removes the "invisible walls".

Merge request reports

Loading