8000 Use safer method to prevent tooltips moving (#680) · nsavas2000/python-editor-v3@adfc3ea · GitHub
[go: up one dir, main page]

Skip to content

Commit adfc3ea

Browse files
Use safer method to prevent tooltips moving (microbit-foundation#680)
1 parent 6eb41b7 commit adfc3ea

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/editor/codemirror/lint/lint.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,8 +704,11 @@ function trackHoverOn(view: EditorView, marker: HTMLElement) {
704704
}
705705

706706
function gutterMarkerMouseOver(view: EditorView, marker: HTMLElement, diagnostics: readonly Diagnostic[]) {
707-
let line = view.elementAtHeight(marker.getBoundingClientRect().top + 5 - view.documentTop)
708707
function hovered() {
708+
if (marker.getBoundingClientRect().top === 0) {
709+
return
710+
}
711+
let line = view.elementAtHeight(marker.getBoundingClientRect().top + 5 - view.documentTop)
709712
const linePos = view.coordsAtPos(line.from)
710713
if (linePos) {
711714
view.dispatch({effects: setLintGutterTooltip.of({
@@ -719,6 +722,7 @@ function gutterMarkerMouseOver(view: EditorView, marker: HTMLElement, diagnostic
719722
}
720723
})})
721724
}
725+
722726
marker.onmouseout = marker.onmousemove = null
723727
trackHoverOn(view, marker)
724728
}

0 commit comments

Comments
 (0)
0