Skip to content

Fix: Y-axis clipping uses resolution.height instead of width#161

Merged
grovesNL merged 2 commits intogrovesNL:mainfrom
AltrixHub:fix/y-clipping-bounds
Dec 1, 2025
Merged

Fix: Y-axis clipping uses resolution.height instead of width#161
grovesNL merged 2 commits intogrovesNL:mainfrom
AltrixHub:fix/y-clipping-bounds

Conversation

@AltrixHub
Copy link
Contributor

Summary

Fix incorrect Y-axis clipping bounds that caused text to be clipped when window height exceeded window width.

Problem

In the prepare_with_depth_and_custom function, the Y-axis clipping bounds incorrectly used resolution.width instead of resolution.height:

https://github.com/grovesNL/glyphon/blob/2b3e0906a67e71f48b29131b25a81e46794967ca/src/text_render.rs#L154C17-L157C19

y: Bounds {
    min: text_area.bounds.top.max(0),
    max: text_area.bounds.bottom.min(resolution.width as i32), // Bug
},

This caused text at y > resolution.width to be clipped, even when the viewport height was larger than the width.

Fix

Changed resolution.width to resolution.height:

y: Bounds {
    min: text_area.bounds.top.max(0),
    max: text_area.bounds.bottom.min(resolution.height as i32),
},

@downhilllabs
Copy link

downhilllabs commented Dec 1, 2025

👍 I was hitting this and it was driving me up a wall.

Please prioritize merging this @grovesNL !

Copy link
Owner

@grovesNL grovesNL left a comment

Choose a reason for hiding this comment

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

Thanks! Looks like a regression introduced in #150

@grovesNL grovesNL merged commit 9dd9376 into grovesNL:main Dec 1, 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.

3 participants