diff options
Diffstat (limited to 'module/output')
-rw-r--r-- | module/output/html.scm | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/module/output/html.scm b/module/output/html.scm index 812e9d79..614fc1cb 100644 --- a/module/output/html.scm +++ b/module/output/html.scm @@ -39,24 +39,23 @@ ;; Takes a list of vcomponents, sets their widths and x-positions to optimally ;; fill out the space, without any overlaps. (define (fix-event-widths! start-of-day lst) + ;; The tree construction is greedy. This means + ;; that if a smaller event preceeds a longer + ;; event it would capture the longer event to + ;; only find events which also overlaps the + ;; smaller event. ;; @var{x} is how for left in the container we are. - (define (inner x tree) + (let inner ((x 0) + (tree (make-tree (lambda (head e) (overlapping? head e)) + (sort* lst time>? (lambda (e) (event-length/day e start-of-day)))))) (if (null? tree) #f (let ((w (/ (- 1 x) (+ 1 (length-of-longst-branch (left-subtree tree)))))) (set! (width (car tree)) w (x-pos (car tree)) x) (inner (+ x w) (left-subtree tree)) - (inner x (right-subtree tree))))) - - (inner 0 (make-tree (lambda (head e) (overlapping? head e)) - ;; The tree construction is greedy. This means - ;; that if a smaller event preceeds a longer - ;; event it would capture the longer event to - ;; only find events which also overlaps the - ;; smaller event. - (sort* lst time>? (lambda (e) (event-length/day e start-of-day)))))) + (inner x (right-subtree tree)))))) ;; This should only be used on time intervals, never on absolute times. ;; For that see @var{date->decimal-hour}. |