mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-82025 Tree: Fix glitches with node tooltips
This commit is contained in:
@@ -176,6 +176,17 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener
|
||||
boolean centerStrict = Boolean.TRUE.equals(comp.getClientProperty(UIUtil.CENTER_TOOLTIP_STRICT));
|
||||
int shift = centerStrict ? 0 : (centerDefault ? 4 : 0);
|
||||
|
||||
// Balloon may appear exactly above useful content, such behavior is rather annoying.
|
||||
if (c instanceof JTree) {
|
||||
javax.swing.tree.TreePath path = ((JTree)c).getClosestPathForLocation(me.getX(), me.getY());
|
||||
if (path != null) {
|
||||
Rectangle pathBounds = ((JTree)c).getPathBounds(path);
|
||||
if (pathBounds != null && pathBounds.y + 4 < me.getY()) {
|
||||
shift += me.getY() - pathBounds.y - 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
queueShow(comp, me, centerStrict || centerDefault, shift, -shift, -shift);
|
||||
}
|
||||
|
||||
@@ -199,16 +210,6 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener
|
||||
}
|
||||
}.setToCenter(toCenter).setCalloutShift(shift).setPositionChangeShift(posChangeX, posChangeY).setLayer(Balloon.Layer.top);
|
||||
|
||||
// Balloon may appear exactly above useful content, such behavior is rather annoying.
|
||||
if (tooltip.getPreferredPosition() == Balloon.Position.above && c instanceof JTree) {
|
||||
javax.swing.tree.TreePath path = ((JTree)c).getClosestPathForLocation(me.getX(), me.getY());
|
||||
if (path != null) {
|
||||
Rectangle pathBounds = ((JTree)c).getPathBounds(path);
|
||||
if (pathBounds != null && pathBounds.y + 4 < me.getY()) {
|
||||
tooltip.setPositionChangeShift(tooltip.getPositionChangeX(), tooltip.getPositionChangeY() - ((me.getY() - pathBounds.y - 4)));
|
||||
}
|
||||
}
|
||||
}
|
||||
show(tooltip, false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user