Add word-wrapped text display with two-finger scroll
- Renderer computes word wrap via single LayoutString pass with
WrapHeuristically policy; glyphs drawn inline at FlagLineBreak
- Fixed line height (fontSize * 1.2), independent of glyph metrics
- Two-finger trackpad scroll via gesture.Scroll with vertical axis
- Display line feedback: renderer reports last glyph Y after each
Draw; logic uses it to clamp scroll offset so last line stops
at bottom of viewport with lineHeight/2 padding
- ScrollRange fix: {Min: -(1<<30), Max: 1<<30} ensures scroll
delta is consumed (empty range consumes nothing via clampSplit)
- Line counting fix: only FlagLineBreak increments count; buffer
flushes (32-glyph cap) draw but don't count
This commit is contained in:
+2
-1
@@ -58,7 +58,8 @@ func run(w *app.Window) error {
|
||||
mu.Lock()
|
||||
currentElems := elems
|
||||
renderer.Draw(gtx, currentElems)
|
||||
if events := renderer.CheckGestures(e.Source); len(events) > 0 {
|
||||
logic.DisplayLineChan() <- int(renderer.LastLineY())
|
||||
if events := renderer.CheckGestures(e.Source, gtx.Metric); len(events) > 0 {
|
||||
logic.InputChan() <- events
|
||||
}
|
||||
e.Frame(&ops)
|
||||
|
||||
Reference in New Issue
Block a user