# $XConsortium: zoomer,v 1.2 94/04/01 16:33:19 matt Exp $
#  This dish script draws a circle that changes its size
#
#  Bugs:    1) Doesn't redraw when the mouse is not moving in the window
#   	    2) Sourcing the second zoomer causes the first to halt

proc zoomer {{delta 0.02} {pause 0.1}} {
    global figure_kit figure_root  # hack to allow sourcing 2nd zoomer
    global circle
    set scale 1.0
    set matrix [circle transform]
    while {1} {
	delay pause
    	set scale [expr $scale - $delta]
    	if {$scale < 0.05 || $scale > 0.999999} {
    	    set delta [expr -$delta]
    	}
	matrix load_identity
	matrix scale "{scale scale scale}"
	circle need_redraw
    }
}

set circle [figure_kit circle 0 [figure_kit default_style] 0 0 100]
set figure_root [figure_kit figure_root circle]
spawn [action zoomer 0.02 0.1]
main 0 figure_root
