Skip to content

Fix UILabel TextKit truncation hit testing - #75

Open
krysto9872 wants to merge 2 commits into
lixiang1994:TextKit=UILabelfrom
krysto9872:patch-1
Open

Fix UILabel TextKit truncation hit testing#75
krysto9872 wants to merge 2 commits into
lixiang1994:TextKit=UILabelfrom
krysto9872:patch-1

Conversation

@krysto9872

Copy link
Copy Markdown

Summary

Fix the remaining mismatch between UILabel truncation and TextKit hit testing when numberOfLines is limited.

Changes

  • Preserve wrapping for truncating paragraph modes so TextKit performs final-line truncation.
  • Reject taps that resolve into truncatedGlyphRange, preventing hidden action ranges from firing.
  • Keep UILabel baseline and line metrics synchronized with the layout manager.

Verification

  • git diff --check passes locally.
  • Added explicit guards for out-of-range glyphs and truncated glyphs.
  • I could not run the iOS/Xcode test target in the Windows environment; CI should run the iOS tests.

Related to #12 and follows the truncation concern raised in #74.

Keep TextKit's final-line truncation aligned with UILabel when numberOfLines is limited, and prevent taps on hidden truncated glyphs from triggering actions. Preserve paragraph wrapping for truncating modes and synchronize label layout metrics.
Keep scaled UILabel baseline, line-height, and paragraph spacing calculations consistent with the TextKit layout used for hit testing.
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.

1 participant