From: Joel VanderWerf Date: 2009-09-08T07:35:31+09:00 Subject: Re: Zoomable TkCanvas? Josef Wolf wrote: > - maintain original coordinates at all zoom factors. Thus even after > zoom operations, events as well as querying/moving/adding items are > done as if the canvas is at zoom factor 1.0. So zoom is handled > completely transparent to the user of the module.. Yep, tkar does that too--object coordinates are independent of zoom level. TkCanvas coordinates are hidden in the abstraction. > - turn around the y-axis (origin is at left bottom) Tkar has an option to flip the y-axis (and also an option to use radians instead of degrees for rotation commands). > - handle scroll bars + panning Check. >> One way to do it is tag all >> canvas objects (or just the ones that zoom), and use the Canvas#scale >> method on that tag. You have to keep track of the current zoom level (Tk >> doesn't), and use that to calculate the arguments to #scale. You also have >> to adjust the scroll bars (using 'configure :scrollregion => ...'). Then >> use xview/yview to keep the current view position in sync with the zoom >> level. > > Sounds easy enough. Is it really that easy? I think this would work only > if you do not add or move any items after you have made zoom operations. You are right, that's just the basic idea... tkar does coordinate transforms for all operations (move, rotate, add). -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407