fix: word-wrap never incremented current-len (all text treated as single line); scrollbox wrong offset origin; integration test fixes
This commit is contained in:
@@ -47,20 +47,19 @@ Children outside the viewport are skipped."
|
||||
(vh (if ln (layout-node-height ln) 24))
|
||||
(sy (scroll-box-scroll-y sb))
|
||||
(sx (scroll-box-scroll-x sb)))
|
||||
(declare (ignore vx))
|
||||
(dolist (child (scroll-box-children sb))
|
||||
(let* ((cln (component-layout-node child))
|
||||
(ch (if cln (layout-node-height cln) 1))
|
||||
(cy vy))
|
||||
;; Only render children that are visible in the viewport
|
||||
(when (and (< (+ cy (- sy)) (+ vh vy))
|
||||
(> (+ cy (- sy) ch) vy))
|
||||
(when (and (< (- cy sy) vh)
|
||||
(> (+ (- cy sy) ch) 0))
|
||||
;; Temporarily offset child's layout-node position for rendering
|
||||
(let ((orig-x (if cln (layout-node-x cln) 0))
|
||||
(orig-y (if cln (layout-node-y cln) 0)))
|
||||
(when cln
|
||||
(setf (layout-node-x cln) (- orig-x sx)
|
||||
(layout-node-y cln) (- orig-y sy)))
|
||||
(setf (layout-node-x cln) (- vx sx)
|
||||
(layout-node-y cln) (- vy sy)))
|
||||
(unwind-protect
|
||||
(render child backend)
|
||||
(when cln
|
||||
|
||||
@@ -70,7 +70,9 @@ Breaks at word boundaries. Words exceeding MAX-WIDTH are hard-broken."
|
||||
(let ((wl (length word)))
|
||||
(cond ((<= wl max-width)
|
||||
(if (and current (<= (+ current-len 1 wl) max-width))
|
||||
(push word current)
|
||||
(progn
|
||||
(push word current)
|
||||
(incf current-len (1+ wl)))
|
||||
(progn
|
||||
(when current
|
||||
(push (format nil "~{~A~^ ~}" (nreverse current)) lines))
|
||||
|
||||
Reference in New Issue
Block a user