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

TextureButton click mask doesn't scale correctly without other textures present #91898

Closed
sam52796 opened this issue May 13, 2024 · 2 comments · Fixed by #92222
Closed

TextureButton click mask doesn't scale correctly without other textures present #91898

sam52796 opened this issue May 13, 2024 · 2 comments · Fixed by #92222
Milestone

Comments

@sam52796
Copy link

Tested versions

Found in v4.2.1.stable.mono.official [b09f793]

System information

Godot v4.2.1.stable.mono - Windows 10.0.19045 - GLES3 (Compatibility) - Intel(R) HD Graphics (Intel Corporation; 20.19.15.4835) - Intel(R) Pentium(R) CPU G3258 @ 3.20GHz (2 Threads)

Issue description

A TextureButton has several texture slots, including Normal, Pressed, Hover, and Click Mask.

It looks like the texture scaling options (e.g. "Keep Aspect Covered") only work correctly for the Click Mask if there is another texture slot filled with a texture, AND if that slot is currently being used.

For example, if you only put a texture into Hover and Click Mask, then the Click Mask texture will be incorrectly scaled until the mouse enters the (incorrect) Click Mask area, at which point the Hover texture gets enabled, and the Click Mask is then scaled correctly. This potentially results in the mouse now being outside the clickable area, in which case the hover state will flicker rapidly between entered and exited as you move the mouse around.

If you have a button with a Normal texture, then the Click Mask is always scaled correctly, so the issue doesn't occur:

image

Steps to reproduce

No scripting required.

Create a TextureButton with a Hover texture and a Click Mask bitmap. Set the scaling options to ignore texture size, and keep aspect covered. The click mask will only be scaled correctly when the button is in the hovered state.

See MRP - there are two TextureButtons which are identical - the only difference between them is that the top one has a Normal texture, so its click mask is always scaled correctly. The second button does not, and so the click mask is not scaled correctly. If you copy and paste the normal texture from the top button to the bottom button then it will start working correctly.

Minimal reproduction project (MRP)

Click mask minimal.zip

@AThousandShips
Copy link
Member

Please try with 4.2.2, this might already have been solved

@sam52796
Copy link
Author

Checked with 4.2.2 - issue still exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants