w3c / web-annotation

Web Annotation Working Group repository, see README for links to specs
https://w3c.github.io/web-annotation/
Other
142 stars 30 forks source link

Viewport for SvgSelector #445

Open mk-pmb opened 2 years ago

mk-pmb commented 2 years ago

Hi! I'm building an annotation editor. When faced with an SvgSelector whose outermost <svg> tag lacks a width= and/or height= attribute, my understanding of the SVG standard is that the lacking attribute means 100% of the viewport. What is the viewport of an SvgSelector?

Using the working area of the annotation editor doesn't make much sense, as it most certainly differs from the one used by the annotation's author.

My intuition would be to use the target image as the viewport, but I can't find hard arguments for that.

Or should I understand

The dimensions of the SVG shape or canvas MUST be relative to the dimensions of the Source resource,

as to contrive a viewport that whose aspect ratio equals that of the target image, in order to make the next part

such that scaling the shape's size to the full size of the image correctly describes the desired area.

a no-op for the 100% axis/axes? (In case both axes are 100%, can I pick any positive length as width?)

The plus side of this would be to allow for clever trickery (example) that allows changing the target image's aspect ratio after the fact, because using the aspect ratio at time of display will auto-fit the "missing" dimension to the current size of the target image. However, it feels a bit odd to introduce early scaling calculations just to thwart a later scaling step mandated by the anno model.

The downside of using the target image, or a contrived canvas based on it, as the viewport, would be that the SVG selector cannot be displayed correctly without downloading the target image.