Skip to content

[WinUI] Fix gif animation initial state#20169

Merged
mattleibow merged 1 commit intomainfrom
dev/winui-gif-init
Feb 2, 2024
Merged

[WinUI] Fix gif animation initial state#20169
mattleibow merged 1 commit intomainfrom
dev/winui-gif-init

Conversation

@mattleibow
Copy link
Copy Markdown
Member

Description of Change

Animated GIF on WinUI are not correctly respecting the IsAnimationPlaying because the actual image is animated, not the view. However, the image has to actually be loaded and on-screen before we can start/stop playing.

This PR waits for the image to be fully loaded and presented before handling the animation.

This PR needs:

Based on the work in:

@mattleibow mattleibow requested a review from a team as a code owner January 26, 2024 02:05
@mattleibow mattleibow changed the title Dev/winui gif init [WinUI] Fix gif animation initial state Jan 26, 2024
@ghost ghost added the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label Jan 26, 2024
namespace Microsoft.Maui.Handlers
{
public partial class ImageHandler : ViewHandler<IImage, Image>
public partial class ImageHandler : ViewHandler<IImage, WImage>
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image === WImage, just using the type alias as it got confusing.

Comment on lines -45 to -46
if (destinationContext is WImage imageView)
imageView.UpdateIsAnimationPlaying(image);
Copy link
Copy Markdown
Member Author

@mattleibow mattleibow Jan 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This did nothing as the image is only animatable after it is decoded - which is after it is on-screen.

@mattleibow mattleibow merged commit 3f7409b into main Feb 2, 2024
@mattleibow mattleibow deleted the dev/winui-gif-init branch February 2, 2024 13:10
@github-actions github-actions bot locked and limited conversation to collaborators Mar 4, 2024
@Eilon Eilon removed the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants