@brickclay-org/ui 0.0.51 → 0.0.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3030,37 +3030,37 @@ class BKTooltipDirective {
|
|
|
3030
3030
|
return;
|
|
3031
3031
|
const hostRect = this.el.nativeElement.getBoundingClientRect();
|
|
3032
3032
|
const tooltipRect = this.tooltipElement.getBoundingClientRect();
|
|
3033
|
-
const scrollTop = window.scrollY || document.documentElement.scrollTop;
|
|
3034
|
-
const scrollLeft = window.scrollX || document.documentElement.scrollLeft;
|
|
3035
3033
|
const triangle = this.tooltipElement.querySelector('.bk-tooltip-triangle');
|
|
3036
3034
|
const padding = 10;
|
|
3037
3035
|
let top = 0, left = 0;
|
|
3038
|
-
// Position logic
|
|
3036
|
+
// Position logic — using viewport-relative coords (getBoundingClientRect)
|
|
3037
|
+
// since the tooltip uses position: fixed (no scroll offset needed)
|
|
3039
3038
|
switch (this.tooltipPosition) {
|
|
3040
3039
|
case 'right':
|
|
3041
3040
|
case 'left':
|
|
3042
|
-
top = hostRect.top +
|
|
3043
|
-
left =
|
|
3044
|
-
|
|
3045
|
-
|
|
3041
|
+
top = hostRect.top + hostRect.height / 2;
|
|
3042
|
+
left =
|
|
3043
|
+
this.tooltipPosition === 'right'
|
|
3044
|
+
? hostRect.right + padding
|
|
3045
|
+
: hostRect.left - tooltipRect.width - padding;
|
|
3046
3046
|
// Auto flip if out of viewport
|
|
3047
3047
|
if (this.tooltipPosition === 'right' && left + tooltipRect.width > window.innerWidth) {
|
|
3048
|
-
left = hostRect.left
|
|
3048
|
+
left = hostRect.left - tooltipRect.width - padding;
|
|
3049
3049
|
}
|
|
3050
3050
|
else if (this.tooltipPosition === 'left' && left < 0) {
|
|
3051
|
-
left = hostRect.right +
|
|
3051
|
+
left = hostRect.right + padding;
|
|
3052
3052
|
}
|
|
3053
3053
|
this.setStyle(this.tooltipElement, {
|
|
3054
3054
|
transform: 'translateY(-50%)',
|
|
3055
3055
|
});
|
|
3056
|
-
this.setTriangleStyles(triangle, this.tooltipPosition, left < hostRect.left
|
|
3056
|
+
this.setTriangleStyles(triangle, this.tooltipPosition, left < hostRect.left);
|
|
3057
3057
|
break;
|
|
3058
3058
|
case 'top':
|
|
3059
3059
|
case 'bottom':
|
|
3060
|
-
left = hostRect.left +
|
|
3060
|
+
left = hostRect.left + hostRect.width / 2 - tooltipRect.width / 2;
|
|
3061
3061
|
top = this.tooltipPosition === 'top'
|
|
3062
|
-
? hostRect.top
|
|
3063
|
-
: hostRect.bottom +
|
|
3062
|
+
? hostRect.top - tooltipRect.height - padding
|
|
3063
|
+
: hostRect.bottom + padding;
|
|
3064
3064
|
// Prevent overflow
|
|
3065
3065
|
left = Math.max(10, Math.min(left, window.innerWidth - tooltipRect.width - 10));
|
|
3066
3066
|
this.setStyle(this.tooltipElement, {
|