Allow aligning lottie animations with fixed aspect ratio - #2472
Merged
Conversation
Analogous to the preview and thumbnail views, file types can now register a Backbone view which the background positioning dialog renders in place of the image the file points at. Dragging the file to position it happens on a wrapper which shrinks to the size of whatever the view renders.
Rendering the positioning view of the file type with cover fit and telling it about position changes replaces the cropped background image. Positions are passed in percent, just like the background position they stand in for.
Both the file to drag and the crop previews render the animation in a loop, using the player's own layout options to crop and align it. Since the position may change before the player has read the file, it is applied again once the animation has loaded.
Cropping an animation to an aspect ratio leaves the choice which part of it to keep. The player's layout alignment covers the same range as the crop position, only in fractions instead of percent.
Just like for videos, cropping an animation to an aspect ratio enables the menu item which opens the background positioning dialog. The preview shows the aspect ratio the animation is actually cropped to.
Creating the player for the file rendered in a canvas and destroying it again is the same for the thumbnail, the file meta data preview and the box of the positioning dialog. What differs is playback and how each of them reacts to the animation having been read.
The preview and the box of the positioning dialog size themselves based on dimensions which only the animation provides. The player has drawn its first frame into a canvas of the size the view had before and only picks up the new one via a resize observer, which fires too late to keep that frame from being stretched. Staying invisible until the player has been resized hides this, while keeping the box in the layout so displaying it does not reflow the dialog.
Thumbnails of images and videos fill their box just the same, which keeps rows of the file list from mixing letterboxed and filled thumbnails.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
REDMINE-21349