@ship-ui/core 0.15.17 → 0.15.18
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.
|
@@ -1113,7 +1113,7 @@ class ShipPopoverComponent {
|
|
|
1113
1113
|
}
|
|
1114
1114
|
return this.#document.documentElement;
|
|
1115
1115
|
}
|
|
1116
|
-
#alignLeftUnder(triggerRect) {
|
|
1116
|
+
#alignLeftUnder(triggerRect, menuRect) {
|
|
1117
1117
|
const newLeft = triggerRect.left;
|
|
1118
1118
|
const newTop = triggerRect.bottom + BASE_SPACE;
|
|
1119
1119
|
return {
|
|
@@ -1121,7 +1121,7 @@ class ShipPopoverComponent {
|
|
|
1121
1121
|
top: newTop,
|
|
1122
1122
|
};
|
|
1123
1123
|
}
|
|
1124
|
-
#alignTopRight(triggerRect) {
|
|
1124
|
+
#alignTopRight(triggerRect, menuRect) {
|
|
1125
1125
|
const newLeft = triggerRect.right + BASE_SPACE;
|
|
1126
1126
|
const newTop = triggerRect.top;
|
|
1127
1127
|
return {
|
|
@@ -1129,7 +1129,7 @@ class ShipPopoverComponent {
|
|
|
1129
1129
|
top: newTop,
|
|
1130
1130
|
};
|
|
1131
1131
|
}
|
|
1132
|
-
#alignBottomRight(triggerRect) {
|
|
1132
|
+
#alignBottomRight(triggerRect, menuRect) {
|
|
1133
1133
|
const newLeft = triggerRect.right + BASE_SPACE;
|
|
1134
1134
|
const newTop = triggerRect.bottom;
|
|
1135
1135
|
return {
|
|
@@ -1137,9 +1137,9 @@ class ShipPopoverComponent {
|
|
|
1137
1137
|
top: newTop,
|
|
1138
1138
|
};
|
|
1139
1139
|
}
|
|
1140
|
-
#alignLeftOver(triggerRect) {
|
|
1140
|
+
#alignLeftOver(triggerRect, menuRect) {
|
|
1141
1141
|
const newLeft = triggerRect.left;
|
|
1142
|
-
const newTop = triggerRect.bottom - triggerRect.height - BASE_SPACE;
|
|
1142
|
+
const newTop = triggerRect.bottom - triggerRect.height - menuRect.height - BASE_SPACE;
|
|
1143
1143
|
return {
|
|
1144
1144
|
left: newLeft,
|
|
1145
1145
|
top: newTop,
|
|
@@ -1152,7 +1152,7 @@ class ShipPopoverComponent {
|
|
|
1152
1152
|
const tryOrderDefault = [this.#alignLeftUnder, this.#alignLeftOver];
|
|
1153
1153
|
const tryOrder = this.asMultiLayer() ? tryOrderMultiLayer : tryOrderDefault;
|
|
1154
1154
|
for (let i = 0; i < tryOrder.length; i++) {
|
|
1155
|
-
const position = tryOrder[i](triggerRect);
|
|
1155
|
+
const position = tryOrder[i](triggerRect, menuRect);
|
|
1156
1156
|
const outOfBoundsRight = position.left + (menuRect?.width || 0) > window.innerWidth;
|
|
1157
1157
|
const outOfBoundsBottom = position.top + (menuRect?.height || 0) > window.innerHeight;
|
|
1158
1158
|
if (!outOfBoundsRight && !outOfBoundsBottom) {
|
|
@@ -1163,7 +1163,7 @@ class ShipPopoverComponent {
|
|
|
1163
1163
|
return;
|
|
1164
1164
|
}
|
|
1165
1165
|
}
|
|
1166
|
-
const fallbackPosition = tryOrder[0](triggerRect);
|
|
1166
|
+
const fallbackPosition = tryOrder[0](triggerRect, menuRect);
|
|
1167
1167
|
this.menuStyle.set({
|
|
1168
1168
|
left: fallbackPosition.left + 'px',
|
|
1169
1169
|
top: fallbackPosition.top + 'px',
|