mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-317864 Fix coordinate checks in SimpleToolWindowPanel
The top/left insets weren't taken into account: the toolbar height isn't always the same as its bottom-edge coordinate. Get its bounds and convert them to the panel's coordinate system to make code more generic and layout-agnostic. This also factors in the insets automatically. Use case: the Remote Host tool window, it has a top border on the panel. GitOrigin-RevId: 04574d8a0f2b64a08e012fa600023e9b6891b971
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f503db70f5
commit
b478a4dc36
@@ -257,7 +257,8 @@ public class SimpleToolWindowPanel extends JBPanelWithEmptyText implements Quick
|
||||
if (toolbar == null || !toolbar.isVisible() || !component.isShowing()) {
|
||||
return false;
|
||||
}
|
||||
var expectedCoordinate = (myVertical ? toolbar.getHeight() : toolbar.getWidth()) + GAP;
|
||||
var toolbarBounds = SwingUtilities.convertRectangle(toolbar.getParent(), toolbar.getBounds(), this);
|
||||
var expectedCoordinate = (myVertical ? toolbarBounds.y + toolbarBounds.height : toolbarBounds.x + toolbarBounds.width) + GAP;
|
||||
var paneLocation = SwingUtilities.convertPoint(component.getParent(), component.getLocation(), this);
|
||||
var actualCoordinate = myVertical ? paneLocation.y : paneLocation.x;
|
||||
return expectedCoordinate == actualCoordinate;
|
||||
|
||||
Reference in New Issue
Block a user