Skip to content

Commit

Permalink
Fix incorrect tooltipBottomOverflow
Browse files Browse the repository at this point in the history
  • Loading branch information
binrysearch committed Sep 11, 2024
1 parent 9ccc18e commit 3b688c0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/packages/tooltip/tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const TooltipArrow = (props: {
classNames.push("bottom");
break;
case "right":
if (props.tooltipBottomOverflow) {
if (props.tooltipBottomOverflow.val) {
// In this case, right would have fallen below the bottom of the screen.
// Modify so that the bottom of the tooltip connects with the target
classNames.push("left-bottom");
Expand All @@ -37,7 +37,7 @@ export const TooltipArrow = (props: {
}
break;
case "left":
if (props.tooltipBottomOverflow) {
if (props.tooltipBottomOverflow.val) {
// In this case, left would have fallen below the bottom of the screen.
// Modify so that the bottom of the tooltip connects with the target
classNames.push("right-bottom");
Expand Down Expand Up @@ -226,7 +226,7 @@ const alignTooltip = (
case "right":
tooltipLeft.val = `${targetOffset.width + 20}px`;

if (tooltipBottomOverflow) {
if (tooltipBottomOverflow.val) {
// In this case, right would have fallen below the bottom of the screen.
// Modify so that the bottom of the tooltip connects with the target
tooltipTop.val = `-${tooltipHeight - targetOffset.height - 20}px`;
Expand All @@ -237,7 +237,7 @@ const alignTooltip = (
tooltipTop.val = "15px";
}

if (tooltipBottomOverflow) {
if (tooltipBottomOverflow.val) {
// In this case, left would have fallen below the bottom of the screen.
// Modify so that the bottom of the tooltip connects with the target
tooltipTop.val = `-${tooltipHeight - targetOffset.height - 20}px`;
Expand Down Expand Up @@ -353,7 +353,7 @@ export const Tooltip = (
// windowSize can change if the window is resized
const windowSize = dom.state(getWindowSize());
const targetOffset = dom.state<Offset>(getOffset(element));
const tooltipBottomOverflow = dom.derive(
const tooltipBottomOverflow = dom.derive<boolean>(
() => targetOffset.val!.top + tooltipHeight.val! > windowSize.val!.height
);

Expand Down

0 comments on commit 3b688c0

Please sign in to comment.