Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid tooltip flickering #175

Open
bric3 opened this issue Jun 13, 2023 · 1 comment
Open

Avoid tooltip flickering #175

bric3 opened this issue Jun 13, 2023 · 1 comment
Labels
enhancement New feature or request swing

Comments

@bric3 bric3 added the enhancement New feature or request label Jun 13, 2023
@bric3
Copy link
Owner Author

bric3 commented Jun 20, 2023

    private fun adjustPosition(
        componentPoint: Point,
        flamegraphView: FlamegraphView<*>,
        tooltipComponent: JComponent,
        hoveredFrameRectangle: Rectangle
    ) {
        val gapBetweenPopupAndFrame = JBUI.scale(6)

        val height = tooltipComponent.preferredSize.height
        if (flamegraphView.mode == FlamegraphView.Mode.FLAMEGRAPH) {
            if (componentPoint.y + height > flamegraphView.component.visibleRect.height) {
                componentPoint.y -= height + gapBetweenPopupAndFrame
            } else {
                componentPoint.y += hoveredFrameRectangle.height + gapBetweenPopupAndFrame
            }
        } else {
            componentPoint.y -= height + gapBetweenPopupAndFrame
        }

        val width = tooltipComponent.preferredSize.width
        if (componentPoint.x + width > flamegraphView.component.visibleRect.width) {
            componentPoint.x = flamegraphView.component.visibleRect.width - width
        } else {
            componentPoint.x += gapBetweenPopupAndFrame
        }
    }

Look at JPopup instead ?

@bric3 bric3 added the swing label May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request swing
Projects
None yet
Development

No branches or pull requests

1 participant