Fix PreviewDropdown viewBox only for non-rotated elements
This fixes the most common cases for #969 (closed): elements without a rotation angle or mirroring will now be displayed properly.
However, for rotated elements, the viewBox
will not be set correctly and the image will be cropped.
Fixing this will require refactoring the boundingBox
helper to make it aware of the element's rotation_angle
and mirroring
, and adding an option to take them into account when computing image bounds:
boundingBox(this.element, { margin: Infinity, imageBounds: true, rotated: true })
Note that this makes a change to ElementImage
, which is also used in the element creation modal, element edition modal and transcription edition modal. All of those will still work properly with both rotated and non-rotated elements: