Skip to content

Commit

Permalink
Update lint.js
Browse files Browse the repository at this point in the history
I have adapted the implementation to only have one cycle and slightly simplified.

Please adapt as you like it of course.
  • Loading branch information
benjaminr-ps committed Jul 19, 2023
1 parent 7cf7f83 commit fc6d6e3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions addon/lint/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
function position(e) {
if (!tt.parentNode) return CodeMirror.off(document, "mousemove", position);
tt.style.top = Math.max(0, e.clientY - tt.offsetHeight - 5) + "px";
tt.style.left = (e.clientX + 5) + "px";

var box = tt.getBoundingClientRect()

var parentView = tt.ownerDocument.defaultView
if ( tt.offsetLeft + box.width > parentView.innerWidth)
var leftPos = e.clientX;
if (leftPos + tt.offsetWidth > parentView.innerWidth)
{
tt.style.left = tt.offsetLeft - box.width
leftPos = Math.max(0, leftPos - tt.offsetWidth)
}
tt.style.left = (leftPos + 5) + "px"
}
CodeMirror.on(document, "mousemove", position);
position(e);
Expand Down

0 comments on commit fc6d6e3

Please sign in to comment.