diff options
author | Hugo Hörnquist <hugo@hornquist.se> | 2019-04-23 23:14:51 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@hornquist.se> | 2019-04-23 23:14:51 +0200 |
commit | a027cc2f0a6d5dfe55bd4b6ce175168aa49788a3 (patch) | |
tree | bfac956fb32527ae3f5c22ece26b30b950d48d83 /module/output | |
parent | Move some procedures. (diff) | |
download | calp-a027cc2f0a6d5dfe55bd4b6ce175168aa49788a3.tar.gz calp-a027cc2f0a6d5dfe55bd4b6ce175168aa49788a3.tar.xz |
Minor movement in fix-event-widths./module/main.scm 2>/dev/pts/0
Diffstat (limited to '')
-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}. |