From 568828d491bfb3104e3935e995d32dd83719e9bc Mon Sep 17 00:00:00 2001 From: Neil Toronto Date: Sat, 3 Mar 2012 15:39:16 -0700 Subject: [PATCH] Fixed graphical glitches: plots too small to render margin decorations (i.e. axis and tick labels) now render without them; plots in frames now initially render with full detail --- collects/plot/common/draw.rkt | 9 +++++++++ collects/plot/common/gui.rkt | 6 ++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/collects/plot/common/draw.rkt b/collects/plot/common/draw.rkt index 8f9d0421f1..7d1af15fe8 100644 --- a/collects/plot/common/draw.rkt +++ b/collects/plot/common/draw.rkt @@ -306,6 +306,15 @@ (define new-top (round (+ top (- y-min param-y-min)))) (define new-bottom (round (- bottom (- (sub1 y-max) param-y-max)))) + ;; Not enough space? + (define area-x-min (+ x-min new-left)) + (define area-x-max (- x-max new-right)) + (define area-y-min (+ y-min new-top)) + (define area-y-max (- y-max new-bottom)) + (when (or (area-x-min . > . area-x-max) + (area-y-min . > . area-y-max)) + (return init-left init-right init-top init-bottom)) + ;; Early out: if the margins haven't changed much, another iteration won't change them more ;; (hopefully) (when (and (= left new-left) (= right new-right) diff --git a/collects/plot/common/gui.rkt b/collects/plot/common/gui.rkt index cb7085ab91..6a57a8491b 100644 --- a/collects/plot/common/gui.rkt +++ b/collects/plot/common/gui.rkt @@ -18,12 +18,10 @@ )) (define (make-snip-frame snip width height label) - (define (make-snip w h) - (send snip resize w h) - snip) + (define (make-snip w h) snip) (define frame - (new snip-frame% [label label] [width (+ 10 width)] [height (+ 10 height)])) + (new snip-frame% [label label] [width (+ 20 width)] [height (+ 20 height)])) (new snip-canvas% [parent frame]