NEW - bug 371760: Support revealing nested figures
https://bugs.eclipse.org/bugs/show_bug.cgi?id=371760
Change-Id: Ibcc498e9d815f815164755ebe8167b3daf7c6291
diff --git a/org.eclipse.mylyn.mft.gmf.ui/src/org/eclipse/mylyn/mft/gmf/ui/RevealMouseListener.java b/org.eclipse.mylyn.mft.gmf.ui/src/org/eclipse/mylyn/mft/gmf/ui/RevealMouseListener.java
index c7f2af1..d4a8a00 100644
--- a/org.eclipse.mylyn.mft.gmf.ui/src/org/eclipse/mylyn/mft/gmf/ui/RevealMouseListener.java
+++ b/org.eclipse.mylyn.mft.gmf.ui/src/org/eclipse/mylyn/mft/gmf/ui/RevealMouseListener.java
@@ -52,13 +52,16 @@
private void findChildFigure(IFigure parent, Rectangle revealBounds, HashSet<IRevealableFigure> found) {
for (Object object : parent.getChildren()) {
IFigure child = (IFigure) object;
- if (revealBounds.intersects(child.getClientArea())) {
+ Rectangle clientArea = child.getClientArea();
+ Rectangle childRevealBounds = revealBounds.getCopy();
+ child.translateFromParent(childRevealBounds);
+ if (childRevealBounds.intersects(clientArea)) {
// only reveal outer-most
IRevealableFigure figure = getRevealableMember(child);
if (figure != null) {
found.add(figure);
}
- findChildFigure(child, revealBounds, found);
+ findChildFigure(child, childRevealBounds, found);
}
}
}
@@ -107,7 +110,9 @@
}
private double nearness(IFigure figure, Point point) {
- double d = distance(figure.getClientArea(), point);
+ Rectangle clientArea = figure.getClientArea().getCopy();
+ figure.translateToAbsolute(clientArea);
+ double d = distance(clientArea, point);
d = Math.min(d, REVEAL_DISTANCE);
double n = 1.0 - (d / REVEAL_DISTANCE);
return n;