From af3d52f9b512b7e5a42ea534c869c9fbe76e7e46 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Thu, 26 Jul 2012 18:40:12 -0500 Subject: [PATCH] fix bug in the computation to determine if the big interactions/definitions label and the region to be refreshed have some overlap --- collects/drracket/private/module-language.rkt | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/collects/drracket/private/module-language.rkt b/collects/drracket/private/module-language.rkt index 64cf8aa8bd..2bc61634c1 100644 --- a/collects/drracket/private/module-language.rkt +++ b/collects/drracket/private/module-language.rkt @@ -1804,10 +1804,9 @@ (define-values (tw th _1 _2) (send dc get-text-extent id)) (define tx (+ (unbox bx) (- (unbox bw) tw))) (define ty (+ (unbox by) (- (unbox bh) th))) - (when (and (or (< left tx right) - (< left (+ tx tw) right)) - (or (< top ty bottom) - (< top (+ ty th) bottom))) + (when (rectangles-intersect? + left top right bottom + tx ty (+ tx tw) (+ ty th)) (send dc set-text-foreground "black") (send dc set-alpha .5) (send dc draw-text id (+ dx tx) (+ dy ty)) @@ -1815,6 +1814,16 @@ (send dc set-text-foreground fore)) (send dc set-font defs/ints-font))))) (super-new))) + + (define (rectangles-intersect? l1 t1 r1 b1 l2 t2 r2 b2) + (or (point-in-rectangle? l1 t1 l2 t2 r2 b2) + (point-in-rectangle? r1 t1 l2 t2 r2 b2) + (point-in-rectangle? l1 b1 l2 t2 r2 b2) + (point-in-rectangle? r1 b1 l2 t2 r2 b2))) + + (define (point-in-rectangle? x y l t r b) + (and (<= l x r) + (<= t y b))) (define bx (box 0)) @@ -1822,7 +1831,6 @@ (define bw (box 0)) (define bh (box 0)) - (define module-language-interactions-text-mixin (mk-module-language-text-mixin (string-constant interactions-window-label))) (define module-language-definitions-text-mixin