From e65fb6226bc0bf9523429d84727e3359f633f7ea Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Fri, 28 Jul 2006 08:15:46 +0000 Subject: [PATCH] re-do changes that were undone in r3843 svn: r3859 original commit: bb5b45b181a85a28ee865cffcf2ef42c54a18408 --- collects/mrlib/graph.ss | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/collects/mrlib/graph.ss b/collects/mrlib/graph.ss index a1be5258..4aa788d0 100644 --- a/collects/mrlib/graph.ss +++ b/collects/mrlib/graph.ss @@ -748,18 +748,18 @@ (send dc draw-polygon points dx dy)) (when (named-link? from-link) (let*-values ([(text-len h d v) (send dc get-text-extent (link-label from-link))] - [(x) (/ (+ from-x to-x) 2)] - [(y) (/ (+ from-y to-y) 2)] - [(theta) (- (angle (- to-pt from-pt)))] - [(flip?) #f #;(negative? (- to-x from-x))] - [(text-angle) - (if flip? - (+ theta pi) - theta)] - [(x) - (- x (* h (cos (if flip? (+ (- theta) pi) (- theta)))))] - [(y) - (- y (* h (sin (if flip? (+ (- theta) pi) (- theta)))))] + [(theta) (angle (- to-pt from-pt))] + [(cx cy) (values (/ (+ from-x to-x) 2) + (/ (+ from-y to-y) 2))] + + ;; ax, ay is the location of the beginning of the string + ;; offset from cx,cy by enough to make the string centered + ;; (but it doesn't seem to be quite right; i'm not sure why) + [(ax ay) (values (- cx (* 1/2 text-len (cos theta))) + (- cy (* 1/2 text-len (sin theta))))] + + [(x y) (values (- ax (* h (cos theta))) + (- ay (* h (sin theta))))] [(sqr) (λ (x) (* x x))]) (when (> (sqrt (+ (sqr (- to-x from-x)) (sqr (- to-y from-y)))) text-len) (send dc draw-text (link-label from-link) @@ -767,7 +767,7 @@ (+ dy y) #f 0 - text-angle)) + (- theta))) ))])))))))) (define (named-link? l) (link-label l))