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!

Method of determining overlapping canvas items

Status
Not open for further replies.

srhoads

Programmer
Nov 21, 2001
21
0
0
US
I want to be able to drag items on the screen and determine if they overlap. Anybody have any ideas?
 
From the title of your add I suppose that your are speaking about items in a canvas.

I didn't used that, but here are some ideas:
You can get the boxing rectangle of the interesting item by the bbox subcommand:
Code:
set bbox [.canvas bbox $interesting]
Then you can ask all overlapping items:
Code:
set items [eval .canvas find overlapping $bbox]
$interesting should be in the list.

Not tried, hope this help

ulis
 
Yes, I do want to use canvas items but they have very complex shapes such as an "L", "T", "Y", etc and I need to be very precise. Rectangular bounding boxes does not provide the required precision.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top