mirror of
https://github.com/chylex/IntelliJ-Inspection-Lens.git
synced 2025-04-21 15:15:46 +02:00
Fix hover underline not disappearing when scrolling without moving the mouse
This commit is contained in:
parent
603b35abdb
commit
0f41b22872
@ -16,6 +16,7 @@ import com.intellij.ui.paint.EffectPainter
|
||||
import java.awt.Cursor
|
||||
import java.awt.Graphics
|
||||
import java.awt.Graphics2D
|
||||
import java.awt.MouseInfo
|
||||
import java.awt.Point
|
||||
import java.awt.Rectangle
|
||||
import java.awt.event.MouseEvent
|
||||
@ -54,7 +55,7 @@ class LensRenderer(private var info: HighlightInfo, settings: LensSettingsState)
|
||||
fixBaselineForTextRendering(r)
|
||||
super.paint(inlay, g, r, textAttributes)
|
||||
|
||||
if (hovered) {
|
||||
if (hovered && isHoveringText()) {
|
||||
paintHoverEffect(inlay, g, r)
|
||||
}
|
||||
}
|
||||
@ -124,6 +125,16 @@ class LensRenderer(private var info: HighlightInfo, settings: LensSettingsState)
|
||||
}
|
||||
}
|
||||
|
||||
private fun isHoveringText(): Boolean {
|
||||
val bounds = inlay.bounds ?: return false
|
||||
val translatedPoint = MouseInfo.getPointerInfo().location.apply {
|
||||
SwingUtilities.convertPointFromScreen(this, inlay.editor.contentComponent)
|
||||
translate(-bounds.x, -bounds.y)
|
||||
}
|
||||
|
||||
return isHoveringText(translatedPoint)
|
||||
}
|
||||
|
||||
private fun isHoveringText(point: Point): Boolean {
|
||||
return point.x >= HOVER_HORIZONTAL_PADDING
|
||||
&& point.y >= 4
|
||||
|
Loading…
Reference in New Issue
Block a user