It seems that after a TkCanvas has been scrolled, there is a mismatch
between coordinate values reported after a left-click on the canvas and
where items have actually been drawn on the canvas.
I’m trying to scroll a canvas and have the ability to draw a ‘cursor’ on
the canvas at the location of a left mouse click, but what I find is that
there is a mismatch between where the cursor is drawn and where the mouse
is clicked if the canvas has been scrolled. Can someone explain what
happens to the coordinate system of a canvas after a scroll?
Phil
In article bb37fa02f1l@enews3.newsguy.com,
···
Phil Tomson ptkwt@shell1.aracnet.com wrote:
It seems that after a TkCanvas has been scrolled, there is a mismatch
between coordinate values reported after a left-click on the canvas and
where items have actually been drawn on the canvas.
I’m trying to scroll a canvas and have the ability to draw a ‘cursor’ on
the canvas at the location of a left mouse click, but what I find is that
there is a mismatch between where the cursor is drawn and where the mouse
is clicked if the canvas has been scrolled. Can someone explain what
happens to the coordinate system of a canvas after a scroll?
I found the answer: use the canvasx and canvasy functions like:
@canvas.bind(‘1’,proc{|e| @manager.update_cursors(@canvas.canvasx(e.x)) })
seems to do the trick.
Phil