@eric-emg/symphiq-components 1.2.83 → 1.2.85
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.
- package/fesm2022/symphiq-components.mjs +42 -19
- package/fesm2022/symphiq-components.mjs.map +1 -1
- package/index.d.ts +3 -3
- package/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -11137,13 +11137,27 @@ class TooltipContainerComponent {
|
|
|
11137
11137
|
const tooltipWidth = 384;
|
|
11138
11138
|
const padding = 10;
|
|
11139
11139
|
const bounds = this.viewportBounds();
|
|
11140
|
-
//
|
|
11141
|
-
const
|
|
11142
|
-
const
|
|
11140
|
+
// Find transformed ancestor offset
|
|
11141
|
+
const transformedAncestor = this.findTransformedAncestor();
|
|
11142
|
+
const ancestorOffset = transformedAncestor ? transformedAncestor.getBoundingClientRect().left : 0;
|
|
11143
|
+
// Calculate effective viewport boundaries
|
|
11144
|
+
let effectiveLeft = 0;
|
|
11145
|
+
let effectiveRight = window.innerWidth;
|
|
11146
|
+
if (bounds) {
|
|
11147
|
+
// Bounds are in viewport coordinates, adjust them relative to the transformed ancestor
|
|
11148
|
+
effectiveLeft = bounds.left - ancestorOffset;
|
|
11149
|
+
effectiveRight = bounds.right - ancestorOffset;
|
|
11150
|
+
}
|
|
11151
|
+
// Convert effective bounds back to viewport coordinates for comparison
|
|
11152
|
+
const viewportEffectiveLeft = effectiveLeft + ancestorOffset;
|
|
11153
|
+
const viewportEffectiveRight = effectiveRight + ancestorOffset;
|
|
11143
11154
|
console.log('🎯 [shouldCenter calculation]', {
|
|
11144
11155
|
position,
|
|
11156
|
+
ancestorOffset,
|
|
11145
11157
|
effectiveLeft,
|
|
11146
11158
|
effectiveRight,
|
|
11159
|
+
viewportEffectiveLeft,
|
|
11160
|
+
viewportEffectiveRight,
|
|
11147
11161
|
'rect.left': rect.left,
|
|
11148
11162
|
'rect.width': rect.width
|
|
11149
11163
|
});
|
|
@@ -11155,8 +11169,8 @@ class TooltipContainerComponent {
|
|
|
11155
11169
|
if (position === 'top' || position === 'bottom') {
|
|
11156
11170
|
const centerPosition = rect.left + rect.width / 2;
|
|
11157
11171
|
const halfWidth = tooltipWidth / 2;
|
|
11158
|
-
const wouldGoOffLeft = centerPosition - halfWidth <
|
|
11159
|
-
const wouldGoOffRight = centerPosition + halfWidth >
|
|
11172
|
+
const wouldGoOffLeft = centerPosition - halfWidth < viewportEffectiveLeft + padding;
|
|
11173
|
+
const wouldGoOffRight = centerPosition + halfWidth > viewportEffectiveRight - padding;
|
|
11160
11174
|
const result = !wouldGoOffLeft && !wouldGoOffRight;
|
|
11161
11175
|
console.log('🎯 [shouldCenter] top/bottom', {
|
|
11162
11176
|
centerPosition,
|
|
@@ -11306,37 +11320,46 @@ class TooltipContainerComponent {
|
|
|
11306
11320
|
switch (position) {
|
|
11307
11321
|
case 'top':
|
|
11308
11322
|
case 'bottom': {
|
|
11309
|
-
// rect.left is
|
|
11310
|
-
//
|
|
11323
|
+
// rect.left is in viewport coordinates
|
|
11324
|
+
// We need to check bounds in the same coordinate system (viewport)
|
|
11325
|
+
// So add ancestorOffset back to effectiveLeft/Right for comparison
|
|
11311
11326
|
const centerPosition = rect.left + rect.width / 2;
|
|
11312
11327
|
const halfWidth = tooltipWidth / 2;
|
|
11313
|
-
//
|
|
11314
|
-
const
|
|
11315
|
-
const
|
|
11328
|
+
// Convert effective bounds back to viewport coordinates for comparison
|
|
11329
|
+
const viewportEffectiveLeft = effectiveLeft + ancestorOffset;
|
|
11330
|
+
const viewportEffectiveRight = effectiveRight + ancestorOffset;
|
|
11331
|
+
// Check if centered tooltip would go off bounds (all in viewport coordinates)
|
|
11332
|
+
const wouldGoOffLeft = centerPosition - halfWidth < viewportEffectiveLeft + padding;
|
|
11333
|
+
const wouldGoOffRight = centerPosition + halfWidth > viewportEffectiveRight - padding;
|
|
11316
11334
|
console.log('📍 [Tooltip top/bottom calculation]', {
|
|
11317
11335
|
centerPosition,
|
|
11318
11336
|
halfWidth,
|
|
11337
|
+
ancestorOffset,
|
|
11338
|
+
effectiveLeft,
|
|
11339
|
+
effectiveRight,
|
|
11340
|
+
viewportEffectiveLeft,
|
|
11341
|
+
viewportEffectiveRight,
|
|
11319
11342
|
'centerPosition - halfWidth': centerPosition - halfWidth,
|
|
11320
11343
|
'centerPosition + halfWidth': centerPosition + halfWidth,
|
|
11321
11344
|
wouldGoOffLeft,
|
|
11322
11345
|
wouldGoOffRight,
|
|
11323
|
-
'
|
|
11324
|
-
'
|
|
11346
|
+
'viewportEffectiveLeft + padding': viewportEffectiveLeft + padding,
|
|
11347
|
+
'viewportEffectiveRight - padding': viewportEffectiveRight - padding
|
|
11325
11348
|
});
|
|
11326
11349
|
if (wouldGoOffLeft) {
|
|
11327
|
-
// Align to left edge with padding
|
|
11328
|
-
const result = effectiveLeft + padding
|
|
11329
|
-
console.log('⬅️ [Tooltip adjusting LEFT]', { result,
|
|
11350
|
+
// Align to left edge with padding (no transform applied, so this is the actual left edge)
|
|
11351
|
+
const result = effectiveLeft + padding;
|
|
11352
|
+
console.log('⬅️ [Tooltip adjusting LEFT]', { result, effectiveLeft, tooltipWidth });
|
|
11330
11353
|
return result;
|
|
11331
11354
|
}
|
|
11332
11355
|
else if (wouldGoOffRight) {
|
|
11333
|
-
// Align to right edge with padding
|
|
11334
|
-
const result = effectiveRight - padding -
|
|
11335
|
-
console.log('➡️ [Tooltip adjusting RIGHT]', { result,
|
|
11356
|
+
// Align to right edge with padding (no transform applied, so this is the actual left edge)
|
|
11357
|
+
const result = effectiveRight - padding - tooltipWidth;
|
|
11358
|
+
console.log('➡️ [Tooltip adjusting RIGHT]', { result, effectiveRight, tooltipWidth });
|
|
11336
11359
|
return result;
|
|
11337
11360
|
}
|
|
11338
11361
|
else {
|
|
11339
|
-
// Center normally (transform will be applied)
|
|
11362
|
+
// Center normally (transform will be applied to shift by -50%)
|
|
11340
11363
|
const result = centerPosition - ancestorOffset;
|
|
11341
11364
|
console.log('🎯 [Tooltip centered]', { centerPosition, ancestorOffset, result });
|
|
11342
11365
|
return result;
|