with-heart / aoe2-ui

2 stars 0 forks source link

Investigate how `Widget.Image` should be used to render materials #38

Closed with-heart closed 7 months ago

with-heart commented 7 months ago

So far I haven't taken into account Image but it appears that we need to in order to accurately render the UI.

As an example, here's how the SpectatorsIcon is rendered currently:

image

If we hover over its container, we can see that it's being centered within it but is still being tiled:

image

Details

Here are some notes about SpectatorsIcon specifically that should help us figure out what's going on here:

Questions to answer

with-heart commented 7 months ago

I created a sandbox to play around with this stuff here: https://codesandbox.io/p/sandbox/charming-microservice-mnl66s?file=%2Fsrc%2Fui.tsx%3A104%2C35

Still not sure I have an answer to any of the questions yet but I'm getting somewhere at least.

with-heart commented 7 months ago

Note to self: textures.json should probably only be used for defs. Rendering the svg might only involve ViewPort/Image.

with-heart commented 7 months ago

According to a conversation with Perplexity, the solution here is to set width and height for the pattern or (and???) image to match the size of the widget and not the size of the texture.