Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse GEF and Draw2d Plug-in Developer Guide
Previous Page Home Next Page

Hit Testing

There are several situations which require finding a figure for a mouse location. For example, determining which tooltip to display when the mouse pauses on top of a figure canvas. Another example is interactive graphical applications, which must interpret dragging one figure on top of another.

There are four methods available on IFigure which perform hit testing, three of which are actually just convenience methods which call the fourth.

Hit testing must be done exactly the same way as painting. Clipping and coordinate changes must be duplicated in both. As an optimizations, branches of the figure composition tree are pruned by calling containsPoint(). If a figure does not contain the location, it returns NULL and does not search its children. By default, all figures are considered to be the rectangular region defined by their bounds, regardless of how or if they paint. This can be overridden as it is in Polyline, Ellipse, and other figures.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire