The canvasx and canvasy operations map from a screen coordinate to a canvas coordinate. If the scroll region is larger than the display area, then you need to use these operations to map from the X and Y in an event (i.e., %x and %y) and the canvas coordinates. The typical use is:
set id [$c find closest [$c canvasx %x] [$c canvasy %y]]
Coordinates for canvas items are stored internally as floating point numbers, so the values returned by the coords operation will be floating point numbers. If you have a very large canvas, you may need to adjust the precision with which you ...