[RIDER] change cursor on inlays hover

GitOrigin-RevId: 1339f18946074ff10d71d80d740954efb2b96385
This commit is contained in:
Nikolay Plyusnin
2023-10-20 16:40:28 +03:00
committed by intellij-monorepo-bot
parent 4cb7999924
commit b7b36a7592
2 changed files with 8 additions and 2 deletions

View File

@@ -309,6 +309,11 @@ class PresentationFactory(private val editor: Editor) : InlayPresentationFactory
return WithCursorOnHoverPresentation(base, cursor, editor)
}
@Contract(pure = true)
fun withCursorOnHoverWhenControlDown (base: InlayPresentation, cursor: Cursor): InlayPresentation {
return WithCursorOnHoverPresentation(base, cursor, editor) { isControlDown(it) }
}
@Contract(pure = true)
fun withReferenceAttributes(noHighlightReference: InlayPresentation): WithAttributesPresentation {
return attributes(noHighlightReference, REFERENCE_HYPERLINK_COLOR,

View File

@@ -10,11 +10,12 @@ import java.awt.event.MouseEvent
class WithCursorOnHoverPresentation(
presentation: InlayPresentation,
val cursor: Cursor,
private val editor: Editor) : StaticDelegatePresentation(presentation) {
private val editor: Editor,
private val onHoverPredicate: (MouseEvent) -> Boolean = { true }) : StaticDelegatePresentation(presentation) {
override fun mouseMoved(event: MouseEvent, translated: Point) {
super.mouseMoved(event, translated)
(editor as? EditorImpl)?.setCustomCursor(this::class, cursor)
(editor as? EditorImpl)?.setCustomCursor(this::class, if (onHoverPredicate(event)) cursor else null)
}
override fun mouseExited() {