From b9e1f5bf8ae2382f5f4b247bd7751452ec4eda2a Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Wed, 19 Nov 2008 17:47:25 -0600 Subject: [PATCH] M: track pref-dim did not take the gap into account --- basis/ui/gadgets/tracks/tracks.factor | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/basis/ui/gadgets/tracks/tracks.factor b/basis/ui/gadgets/tracks/tracks.factor index 5a9683ceff..771c489ce3 100644 --- a/basis/ui/gadgets/tracks/tracks.factor +++ b/basis/ui/gadgets/tracks/tracks.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2006, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors io kernel math namespaces - sequences words math.vectors ui.gadgets ui.gadgets.packs - math.geometry.rect fry ; +USING: accessors io kernel namespaces fry +math math.vectors math.geometry.rect math.order +sequences words ui.gadgets ui.gadgets.packs ; IN: ui.gadgets.tracks @@ -35,13 +35,16 @@ TUPLE: track < pack sizes ; M: track layout* ( track -- ) dup track-layout pack-layout ; -: track-pref-dims-1 ( track -- dim ) children>> pref-dims max-dim ; +: track-pref-dims-1 ( track -- dim ) + children>> pref-dims max-dim ; : track-pref-dims-2 ( track -- dim ) - [ children>> pref-dims ] [ normalized-sizes ] bi - [ [ v/n ] when* ] 2map - max-dim - [ >fixnum ] map ; + [ + [ children>> pref-dims ] [ normalized-sizes ] bi + [ [ v/n ] when* ] 2map max-dim [ >fixnum ] map + ] + [ [ gap>> ] [ children>> length 1 [-] ] bi v*n ] bi + v+ ; M: track pref-dim* ( gadget -- dim ) [ track-pref-dims-1 ]