diff --git a/collects/2htdp/private/world.rkt b/collects/2htdp/private/world.rkt index 9c275df1ba..1bdc37a427 100644 --- a/collects/2htdp/private/world.rkt +++ b/collects/2htdp/private/world.rkt @@ -263,14 +263,17 @@ (begin (set! nw (stop-the-world-world nw)) (send world set tag nw) - (when last-picture (last-draw)) - (when draw (pdraw)) + (cond + [last-picture (last-draw)] + [draw (pdraw)]) (callback-stop! 'name) (enable-images-button)) - (let ([changed-world? (send world set tag nw)]) + (let ([changed-world? (send world set tag nw)] + [stop? (pstop)]) ;; this is the old "Robby optimization" see checked-cell: ; unless changed-world? - (when draw + (cond + [(and draw (not stop?)) (cond [(not drawing) (set! drawing #t) @@ -285,11 +288,13 @@ ;; high!! the scheduled callback didn't fire (queue-callback (lambda () (d)) #t)] [else - (set! draw# (- draw# 1))])) - (when (pstop) - (when last-picture (last-draw)) - (callback-stop! 'name) - (enable-images-button)) + (set! draw# (- draw# 1))])] + [stop? + (cond + [last-picture (last-draw)] + [draw (pdraw)]) + (callback-stop! 'name) + (enable-images-button)]) changed-world?)))))))) ;; tick, tock : deal with a tick event for this world