@@ -1226,19 +1226,7 @@ If the namespace does not, they are colored the unbound color.
12261226 (define tacked-arrow-drawing (new arrow-drawing% [who "tacked arrows " ]))
12271227 (define mouse-over-arrow-drawing (new arrow-drawing% [who "mouse-over arrows " ]))
12281228
1229- (define/private (get-var-arrow-end-x-min-and-max matching-identifiers)
1230- (for/fold ([x-min #f ]
1231- [x-max #f ])
1232- ([(ele _ ) (in-hash matching-identifiers)])
1233- (match-define (list end-text pos-left pos-right) ele)
1234- (define-values (end-x end-y)
1235- (find-poss end-text pos-left pos-right 1/2 1/2 ))
1236- (values (if x-min (min x-min end-x) end-x)
1237- (if x-max (max x-max end-x) end-x))))
1238-
12391229 (define/private (determine-the-mouse-over-arrows)
1240- (define-values (var-arrow-end-x-min var-arrow-end-x-max)
1241- (get-var-arrow-end-x-min-and-max current-matching-identifiers))
12421230 (define arrow-records-at-cursor
12431231 (and cursor-text cursor-pos (fetch-arrow-records cursor-text cursor-pos)))
12441232
@@ -1257,11 +1245,9 @@ If the namespace does not, they are colored the unbound color.
12571245 (λ (arr)
12581246 (set! arrows-to-draw (cons arr arrows-to-draw)))
12591247 tail-arrows arrow-records))
1260- (list (arrows-and-min-max-width arrows-to-draw var-arrow-end-x-min var-arrow-end-x-max #f )))
1248+ (list (arrows-and-min-max-width arrows-to-draw #f )))
12611249
12621250 (define/private (determine-the-tacked-arrows)
1263- (define tacked-arrows-to-draw '() )
1264- (define arrow->matching-identifiers-hash (make-hash))
12651251 (define table (make-hash))
12661252
12671253 (for ([(arrow v) (in-hash tacked-hash-table)])
@@ -1279,9 +1265,7 @@ If the namespace does not, they are colored the unbound color.
12791265 (define-values (_binders make-identifiers-hash)
12801266 (position->matching-identifiers-hash arrow-text arrow-pos arrow-pos
12811267 #:also-look-backward-one? #f ))
1282- (define-values (var-arrow-end-x-min var-arrow-end-x-max)
1283- (get-var-arrow-end-x-min-and-max (make-identifiers-hash)))
1284- (arrows-and-min-max-width arrows var-arrow-end-x-min var-arrow-end-x-max #t )))
1268+ (arrows-and-min-max-width arrows #t )))
12851269
12861270 ;; for-each-tail-arrows : (tail-arrow -> void) tail-arrow -> void
12871271 (define/private (for-each-tail-arrows f tail-arrows)
@@ -2125,7 +2109,7 @@ If the namespace does not, they are colored the unbound color.
21252109 (color-prefs:lookup-in-color-scheme 'drracket:syncheck:template-arrow ))
21262110 (send dc set-alpha 0.5 )
21272111
2128- (define (draw-an-arrow tacked? ele var-arrow-end-x-min var-arrow-end-x-max )
2112+ (define (draw-an-arrow tacked? ele)
21292113 (cond [(var-arrow? ele)
21302114 (if (var-arrow-actual? ele)
21312115 (begin (send dc set-pen (get-var-pen))
@@ -2135,46 +2119,37 @@ If the namespace does not, they are colored the unbound color.
21352119 [(tail-arrow? ele)
21362120 (send dc set-pen (get-tail-pen))
21372121 (send dc set-brush (if tacked? (get-tacked-tail-brush) (get-untacked-brush)))])
2138- (draw-arrow2 ele
2139- max-width-for-arrow max-height-for-arrow dc dx dy
2140- #:x-min var-arrow-end-x-min
2141- #:x-max var-arrow-end-x-max))
2122+ (draw-arrow2 ele max-width-for-arrow max-height-for-arrow dc dx dy))
21422123
21432124 (define start-time (current-inexact-monotonic-milliseconds))
21442125 (define timeout-in-milliseconds 15 )
21452126 (define result
21462127 (let loop ([arrows-and-min-max-widths arrows-and-min-max-widths]
21472128 [arrows #f ]
2148- [var-arrow-end-x-min #f ]
2149- [var-arrow-end-x-max #f ]
21502129 [tacked? #f ]
21512130 [drew-at-least-one-arrow? #f ])
21522131 (cond
21532132 [(and drew-at-least-one-arrow? (>= (current-inexact-monotonic-milliseconds)
21542133 (+ start-time timeout-in-milliseconds)))
21552134 (if arrows
2156- (cons (arrows-and-min-max-width arrows var-arrow-end-x-min var-arrow-end-x-max tacked?)
2135+ (cons (arrows-and-min-max-width arrows tacked?)
21572136 arrows-and-min-max-widths)
21582137 arrows-and-min-max-widths)]
21592138 [(and (not arrows) (null? arrows-and-min-max-widths))
21602139 "done " ]
21612140 [(not arrows)
2162- (match-define (arrows-and-min-max-width arrows var-arrow-end-x-min var-arrow-end-x-max tacked?)
2141+ (match-define (arrows-and-min-max-width arrows tacked?)
21632142 (car arrows-and-min-max-widths))
21642143 (loop (cdr arrows-and-min-max-widths)
21652144 arrows
2166- var-arrow-end-x-min
2167- var-arrow-end-x-max
21682145 tacked?
21692146 drew-at-least-one-arrow?)]
21702147 [(null? arrows)
2171- (loop arrows-and-min-max-widths #f #f #f #f drew-at-least-one-arrow?)]
2148+ (loop arrows-and-min-max-widths #f #f drew-at-least-one-arrow?)]
21722149 [else
2173- (draw-an-arrow tacked? (car arrows) var-arrow-end-x-min var-arrow-end-x-max )
2150+ (draw-an-arrow tacked? (car arrows))
21742151 (loop arrows-and-min-max-widths
21752152 (cdr arrows)
2176- var-arrow-end-x-min
2177- var-arrow-end-x-max
21782153 tacked?
21792154 #t )])))
21802155
@@ -2186,39 +2161,15 @@ If the namespace does not, they are colored the unbound color.
21862161 (send dc set-alpha old-alpha)
21872162 result)))
21882163
2189- (struct arrows-and-min-max-width (arrows var-arrow-end-x-min var-arrow-end-x-max tacked?))
2164+ (struct arrows-and-min-max-width (arrows tacked?))
21902165
2191- (define (draw-arrow2 arrow max-width-for-arrow max-height-for-arrow dc dx dy
2192- #:x-min [var-arrow-end-x-min #f ]
2193- #:x-max [var-arrow-end-x-max #f ])
2166+ (define (draw-arrow2 arrow max-width-for-arrow max-height-for-arrow dc dx dy)
21942167 (define-values (start-x start-y end-x end-y) (get-arrow-poss arrow))
21952168 (unless (and (= start-x end-x)
21962169 (= start-y end-y))
21972170 (define %age
21982171 (cond
2199- [(and (var-arrow? arrow)
2200- var-arrow-end-x-min
2201- var-arrow-end-x-max)
2202- (define base-%age
2203- (cond
2204- ;; it can be that we have only a single arrow
2205- ;; and they might be directly above each other,
2206- ;; which will end up with var-arrow-end-x-max and
2207- ;; var-arrow-end-x-min equal to each other; in
2208- ;; that case we want a straight up/down arrow
2209- ;; (instead of the nan from the arithmetic below)
2210- [(= var-arrow-end-x-max var-arrow-end-x-min) 0 ]
2211- [else
2212- (/ (- end-x var-arrow-end-x-min)
2213- (- var-arrow-end-x-max var-arrow-end-x-min))]))
2214- (if (< (var-arrow-start-pos-left arrow)
2215- (var-arrow-end-pos-left arrow))
2216- base-%age
2217- (- base-%age))]
22182172 [(var-arrow? arrow)
2219- ;; when we don't have `var-arrow-end-x-min` and `var-arrow-end-x-max`
2220- ;; then this is a require arrow so we use the entire width
2221- ;; to determine the curvature of the arrow
22222173 (define base-%age (/ end-x max-width-for-arrow))
22232174 (if (< (var-arrow-start-pos-left arrow)
22242175 (var-arrow-end-pos-left arrow))
0 commit comments