Skip to content

Add support for viewbox transformations for intrinsic raster image dimensions #314

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

Merged
merged 2 commits into from
Feb 12, 2025

Conversation

EugeneBalabai
Copy link
Contributor

This PR provides solution #284

Changes

  • Modified ImageNode to use computeViewBoxTransform for handling image scaling and positioning
  • Images now properly respect the SVG preserveAspectRatio attribute

@EugeneBalabai
Copy link
Contributor Author

  1. Some tests are failing, though visual inspection shows correct output. The failures appear to be related to how transformations are being applied.

  2. Is there an alternative approach to obtain accurate image dimensions?

@EugeneBalabai
Copy link
Contributor Author

@yGuy @HackbrettXXX What do you think?

@yGuy
Copy link
Member

yGuy commented Nov 12, 2024

I currently don't have the time to debug this or do a new implementation. Sorry!
@HackbrettXXX is also busy, but he might have a quick answer for you, at least.

@HackbrettXXX
Copy link
Member

If the visual output looks good, you can probably just update the reference files. You can download them from the CI build result.

The approach for obtaining the image dimensions looks good. Although I would love if we would have to load the image only once (-> fetchImage).

I hope I have time for an in-depth review soon.

@HackbrettXXX HackbrettXXX linked an issue Feb 12, 2025 that may be closed by this pull request
Copy link
Member

@HackbrettXXX HackbrettXXX left a comment

Choose a reason for hiding this comment

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

Looks good. I've added/changed the reference files. Loading the image only once is probably not feasible, because of the special case for SVG images.

@HackbrettXXX HackbrettXXX changed the title WIP: Implement preserveAspectRatio for <image> tags Add support for viewbox transformations for intrinsic raster image dimensions Feb 12, 2025
@HackbrettXXX HackbrettXXX merged commit 36bb1b5 into yWorks:master Feb 12, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement preserveAspectRatio for <image> tags
3 participants