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

Owner Document/dimensions_scale on dynamically created <img> Elements #310

Closed
kim8823 opened this issue May 13, 2022 · 4 comments
Closed
Labels
bug Something isn't working

Comments

@kim8823
Copy link

kim8823 commented May 13, 2022

My app uses density independent pixel ratio to support high-density displays, I'm using the latest release, 4.3.
I'm loading a document and clone a subtree that contains images. These cloned images come out too small when using a dp ratio > 1 because they don't have an owner document when LoadTexture runs, can't find a context and default to a dp ratio of 1. The same happens with manually created elements (Rml::Factory::InstanceElement in my case), although I haven't looked closely at those yet.

The cloning happens right after loading the document, InstanceElement is called in an instancer for custom elements that are loaded with the document, before any Update calls. When they get to LoadTexture they should already be firmly attached to the document, so I'm not sure what the actual issue is.

@mikke89
Copy link
Owner

mikke89 commented May 13, 2022

Hey, thanks for reporting.

I had some trouble reproducing it initially, since cloning an image element directly works fine. But the key thing here as you mention is to clone a wrapper element with descendant images. Then I can see that the dp-scaling is not applied to the image elements.

I'll take a closer look and try to figure out a solution.

@mikke89 mikke89 added the bug Something isn't working label May 13, 2022
mikke89 added a commit that referenced this issue May 15, 2022
@mikke89
Copy link
Owner

mikke89 commented May 15, 2022

Could you test these changes and let me know if they solve the issue?

@kim8823
Copy link
Author

kim8823 commented May 16, 2022

Works great, thank you!

@mikke89
Copy link
Owner

mikke89 commented May 16, 2022

Great, no problem!

@mikke89 mikke89 closed this as completed May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants