]> gitweb.factorcode.org Git - factor.git/commitdiff
ui.gadgets.paragraphs: pref-dim of { 0 0 } if no children.
authorJohn Benediktsson <mrjbq7@gmail.com>
Sun, 20 Sep 2015 16:45:05 +0000 (09:45 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sun, 20 Sep 2015 16:45:05 +0000 (09:45 -0700)
basis/ui/gadgets/paragraphs/paragraphs.factor

index 0657b5b49c88b6e6b511de694f4ac516a0b343ee..8c1817c9efb51ecb1baf20457636d223bba9c5af 100644 (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 ;