1
0
mirror of https://github.com/mbirth/tcl_update_db.git synced 2024-09-19 16:53:25 +01:00

Fix tooltip position when text too wide.

This commit is contained in:
Markus Birth 2018-06-20 19:08:49 +02:00
parent 4c247369d0
commit 3707089942

View File

@ -1,4 +1,4 @@
document.addEventListener 'DOMContentLoaded', (event) ->
document.addEventListener 'DOMContentLoaded', (event) ->
window.mdc.autoInit()
window.tabBar = new mdc.tabs.MDCTabBar document.querySelector '#tab-bar'
@ -114,7 +114,10 @@ document.addEventListener 'DOMContentLoaded', (event) ->
if mouseX + cursorOffset + tooltipWidth >= viewportRight
# show tooltip LEFT of cursor
tooltip.style.left = (mouseX - cursorOffset - tooltipWidth) + 'px'
leftPos = mouseX - cursorOffset - tooltipWidth
if leftPos < 0
leftPos = 0
tooltip.style.left = leftPos + 'px'
else
# show tooltip right of cursor
tooltip.style.left = (mouseX + cursorOffset) + 'px'