diff --git a/src/components/tooltip/Tooltip.vue b/src/components/tooltip/Tooltip.vue index ba8d323..b38d0f4 100644 --- a/src/components/tooltip/Tooltip.vue +++ b/src/components/tooltip/Tooltip.vue @@ -8,20 +8,27 @@ const open = defineModel('open', { default: false }); const { width, height } = useSharedWindowSize(); const mainDiv = ref(null); -const { top, left } = useElementBounding(mainDiv); +const { top, bottom, left, right } = useElementBounding(mainDiv); -const positions = computed(() => { - if (top.value < height.value / 2) { - if (left.value < width.value / 2) { - return ['top', 'left']; - } - return ['top', 'right']; +const positions = computed(() => [ + top.value < height.value / 2 ? 'top' : 'bottom', + left.value < width.value / 2 ? 'left' : 'right', +]); + +const floatingStyle = computed(() => { + const style: Record = {}; + if (positions.value.includes('top')) { + style.top = `${bottom.value}px`; + } else { + style.bottom = `${height.value - top.value}px`; } - if (left.value < width.value / 2) { - return ['bottom', 'left']; + if (positions.value.includes('left')) { + style.left = `${left.value}px`; + } else { + style.right = `${width.value - right.value}px`; } - return ['bottom', 'right']; -}) + return style; +}); \ No newline at end of file + + + diff --git a/src/market/acquisition/AcquisitionQuartilesTooltip.vue b/src/market/acquisition/AcquisitionQuartilesTooltip.vue index 537d5cd..241dd4b 100644 --- a/src/market/acquisition/AcquisitionQuartilesTooltip.vue +++ b/src/market/acquisition/AcquisitionQuartilesTooltip.vue @@ -43,7 +43,7 @@ const lineColor = computed(() => {