Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

move graphics entities to the origin

Status
Not open for further replies.

srhoads

Programmer
Nov 21, 2001
21
0
0
US
I have written a TCL application which places graphics on a canvas and allows the user to zoom in, out, and pan. I record the scaling info so I am able to restore the canvas items to the original scale but I don't know how to restore them to the original position.

If I could query the screen coordinates of a line I create with the tag "Origin" I could then figure out how far to move all the items.

Anybody know a solution for either of these techniques?

 
Sounds like you need to register and restore the scrollregion and the position in it.

Registering :
Code:
set sr [.canvas config -scrollregion]
set xpos [.canvas xview]
set ypos [.canvas yview]
Restoring:
Code:
.canvas config -scrollregion $sr
.canvas xview moveto [lindex $xpos 0]
.canvas yview moveto [lindex $ypos 0]

I've not tested this code but you got the idea.

ulis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top