mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-09-09 04:19:29 -05:00
Fix trainercard alignment
Clicking on a user with a very large trainercard (generally, a bot in a lot of rooms) would often push the trainercard offscreen even if it fit, or push the trainercard to unscrollable areas. With this change, the trainercard will no longer go offscreen unless it doesn't fit, and if it doesn't fit, it will always be scrollable.
This commit is contained in:
@@ -400,8 +400,10 @@ class PSMain extends preact.Component {
|
||||
if (availableHeight > offset.top + height + 5 &&
|
||||
(offset.top < availableHeight * 2 / 3 || offset.top + 200 < availableHeight)) {
|
||||
style.top = offset.top;
|
||||
} else {
|
||||
} else if (offset.top + sourceHeight >= height) {
|
||||
style.bottom = Math.max(availableHeight - offset.top - sourceHeight, 0);
|
||||
} else {
|
||||
style.top = Math.max(0, availableHeight - height);
|
||||
}
|
||||
let offsetLeft = offset.left + sourceWidth;
|
||||
if (offsetLeft + width > document.documentElement.clientWidth) {
|
||||
|
||||
Reference in New Issue
Block a user