Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WidgetType::Image and Image::alt_text #5534

Merged
merged 6 commits into from
Dec 30, 2024
Merged

Conversation

lucasmerlin
Copy link
Collaborator

@lucasmerlin lucasmerlin commented Dec 29, 2024

This adds WidgetType::Image and correctly sets it in the Image widget. This allows us to query for images in kittest tests and tells accesskit that a node is an image.
It also adds Image::alt_text to set a text that will be shown if the image fails to load and will be read via screen readers. This also allows us to query images by label in kittest.

  • I have followed the instructions in the PR template

Copy link

Preview available at https://egui-pr-preview.github.io/pr/5534-lucasimage-widget-type
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

@lucasmerlin lucasmerlin changed the title Add WidgetType::Image Add WidgetType::Image and Image::alt_text Dec 29, 2024
@lucasmerlin lucasmerlin marked this pull request as ready for review December 29, 2024 14:07
@lucasmerlin lucasmerlin added egui feature New feature or request labels Dec 29, 2024
@lucasmerlin lucasmerlin force-pushed the lucas/image-widget-type branch from 5458595 to 4a8ed33 Compare December 29, 2024 14:21
@lucasmerlin lucasmerlin force-pushed the lucas/image-widget-type branch from 4a8ed33 to dfb44f0 Compare December 29, 2024 14:44
Copy link
Owner

@emilk emilk left a comment

Choose a reason for hiding this comment

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

Very nice!

crates/egui/src/widgets/image.rs Outdated Show resolved Hide resolved
crates/egui/src/widgets/image.rs Outdated Show resolved Hide resolved
Co-authored-by: Emil Ernerfeldt <[email protected]>
@lucasmerlin lucasmerlin force-pushed the lucas/image-widget-type branch from 3f71c16 to 3d1db8e Compare December 30, 2024 11:45
@lucasmerlin lucasmerlin merged commit e32ca21 into master Dec 30, 2024
46 checks passed
@lucasmerlin lucasmerlin deleted the lucas/image-widget-type branch December 30, 2024 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
egui feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants