mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
[RIDER] change cursor on inlays hover
GitOrigin-RevId: 1339f18946074ff10d71d80d740954efb2b96385
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4cb7999924
commit
b7b36a7592
@@ -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,
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user