Skip to content

Commit

Permalink
[show-hint addon] Make sure the tooltip is placed to the left of the …
Browse files Browse the repository at this point in the history
…viewport

We have to prevent to render the hint tooltip popup to far to the left, which exceeds the viewport.

If it exceeds the viewport too much to the left, we fallback to zero position.
  • Loading branch information
benjaminr-ps authored May 31, 2022
1 parent b6798cc commit e6f456f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion addon/hint/show-hint.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@
hints.style.width = (winW - 5) + "px";
overlapX -= (box.right - box.left) - winW;
}
hints.style.left = (left = pos.left - overlapX - offsetLeft) + "px";
hints.style.left = (left = Math.max(pos.left - overlapX - offsetLeft, 0)) + "px";
}
if (scrolls) for (var node = hints.firstChild; node; node = node.nextSibling)
node.style.paddingRight = cm.display.nativeBarWidth + "px"
Expand Down

1 comment on commit e6f456f

@benjaminr-ps
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any plans when next release happens?

Please sign in to comment.