From 7d0c7f0955543328235d3b4a5b043c3b2088ec59 Mon Sep 17 00:00:00 2001 From: "Ahmad K. Bawaneh" Date: Sun, 8 Dec 2024 16:56:24 +0300 Subject: [PATCH] fix #985 Tooltip Clipped Upon Icon Click --- .../dominokit/domino/ui/config/PopoverConfig.java | 2 +- .../org/dominokit/domino/ui/popover/BasePopover.java | 7 ++++++- .../dominokit/domino/ui/utils/BaseDominoElement.java | 12 ++++++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/config/PopoverConfig.java b/domino-ui/src/main/java/org/dominokit/domino/ui/config/PopoverConfig.java index 2095e5b97..5a449b2f3 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/config/PopoverConfig.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/config/PopoverConfig.java @@ -20,7 +20,7 @@ public interface PopoverConfig extends ZIndexConfig { - default DropDirection getDefaultDropDirection() { + default DropDirection getDefaultPopoverDropDirection() { return DropDirection.BEST_MIDDLE_UP_DOWN; } diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/popover/BasePopover.java b/domino-ui/src/main/java/org/dominokit/domino/ui/popover/BasePopover.java index b6c1c1198..596debb0c 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/popover/BasePopover.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/popover/BasePopover.java @@ -99,7 +99,7 @@ public BasePopover(Element target) { .appendChild(body = div().addCss(dui_popover_body))); init((T) this); - this.popupPosition = getConfig().getDefaultDropDirection(); + this.popupPosition = getConfig().getDefaultPopoverDropDirection(); this.closeOnBlur = getConfig().closeOnBlur(); this.openDelay = getConfig().openDelay(); @@ -317,9 +317,14 @@ public void discard() { public T setPosition(DropDirection position) { this.popupPosition.cleanup(this.element()); this.popupPosition = position; + doPosition(); return (T) this; } + public DropDirection getPopupPosition() { + return popupPosition; + } + /** * Specifies whether the popover should automatically close when other popovers are opened. * diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/utils/BaseDominoElement.java b/domino-ui/src/main/java/org/dominokit/domino/ui/utils/BaseDominoElement.java index d4d02b1ea..1bf372e77 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/utils/BaseDominoElement.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/utils/BaseDominoElement.java @@ -2232,7 +2232,11 @@ public T blur() { */ @Editor.Ignore public T setTooltip(String text) { - return setTooltip(text, DropDirection.BEST_SIDE_UP_DOWN); + return setTooltip( + text, + isNull(this.tooltip) + ? config().getUIConfig().getDefaultPopoverDropDirection() + : tooltip.getPopupPosition()); } /** @@ -2256,7 +2260,11 @@ public T setTooltip(String text, DropDirection position) { */ @Editor.Ignore public T setTooltip(Node node) { - return setTooltip(node, DropDirection.BEST_SIDE_UP_DOWN); + return setTooltip( + node, + isNull(this.tooltip) + ? config().getUIConfig().getDefaultPopoverDropDirection() + : tooltip.getPopupPosition()); } /**