kayak_ui icon indicating copy to clipboard operation
kayak_ui copied to clipboard

Fix incorrect border alignment on ninepatch images

Open MrGVSV opened this issue 3 years ago • 5 comments

Fixes: #111

The borders were incorrectly swapped along the y-axis. This PR corrects their orientation.

This brings to light an issue with the current implementation, though, that I'm unsure how to fix. The borders of the nine patch are warped compared to the center of the image. This is likely due to the squishing of the edges' UVs so that they can fit their individual quads.

Source

Sample Image

Result

Warped nine patch output

MrGVSV avatar May 21 '22 04:05 MrGVSV

I'm not sure about the warping, but I suspect you are right. Ideally we should likely use an array texture here. That way we can keep UV's between 0-1 and also apply wrapping or repeating of textures.

StarArawn avatar May 24 '22 12:05 StarArawn

Ideally we should likely use an array texture here.

Not something I’m too familiar with. Should we make a separate issue for that?

MrGVSV avatar May 24 '22 13:05 MrGVSV

Ideally we should likely use an array texture here.

Not something I’m too familiar with. Should we make a separate issue for that?

Yeah! Is the warping an existing issue?

StarArawn avatar May 24 '22 14:05 StarArawn

Yeah! Is the warping an existing issue?

I haven't tested it, but I’m guessing it is. I can run a test later today to verify that it existed before this fix.

MrGVSV avatar May 24 '22 14:05 MrGVSV

Yeah! Is the warping an existing issue?

I haven't tested it, but I’m guessing it is. I can run a test later today to verify that it existed before this fix.

It also kinda looks like the nine patch border size is wrong. It should match the size in pixels of the most extreme corner. This is hard to do because things are split into 9 parts. So for the top with the blue "bar" it'll look wrong. Unity has different options which allow you to change how the 9 parts behave.

StarArawn avatar May 24 '22 14:05 StarArawn