Add fixed setting to allow tooltip to be permanently rendered

This commit is contained in:
Andrew Kingston 2023-07-07 12:11:19 +01:00
parent 35150af784
commit 4129f166e6
1 changed files with 6 additions and 3 deletions

View File

@ -22,12 +22,15 @@
export let position = TooltipPosition.Top
export let type = TooltipType.Default
export let text = ""
export let fixed = false
let wrapper
let visible = false
let hovered = false
let left = 0
let top = 0
$: visible = hovered || fixed
const show = () => {
const node = wrapper?.children?.[0]
if (!node) {
@ -51,10 +54,10 @@
return
}
visible = true
hovered = true
}
const hide = () => {
visible = false
hovered = false
}
</script>