ui.gadgets.paragraphs: pref-dim of { 0 0 } if no children.

db4
John Benediktsson 2015-09-20 09:45:05 -07:00
parent e0bcd7423b
commit d5c5a1389d
1 changed files with 5 additions and 1 deletions

View File

@ -54,7 +54,11 @@ TUPLE: line words width height baseline ;
[ height>> ] map-sum ;
M: paragraph pref-dim*
cached-wrapped [ max-line-width ] [ sum-line-heights ] bi 2array ;
cached-wrapped [
{ 0 0 }
] [
[ max-line-width ] [ sum-line-heights ] bi 2array
] if-empty ;
: line-y-coordinates ( wrapped-paragraph -- ys )
0 [ height>> + ] accumulate nip ;