diff --git a/phone/src/apps/twitter/components/tweet/ShowMore.tsx b/phone/src/apps/twitter/components/tweet/ShowMore.tsx index 0b776b1..ce0d2a3 100644 --- a/phone/src/apps/twitter/components/tweet/ShowMore.tsx +++ b/phone/src/apps/twitter/components/tweet/ShowMore.tsx @@ -6,30 +6,8 @@ import { usePhone } from '../../../../os/phone/hooks/usePhone'; import Nui from '../../../../os/nui-events/utils/Nui'; import ReportButton from '../buttons/ReportButton'; -/** - * Ok this is some bullshit. Due to either scaling issues or the NUI - * overlay being different than the display resolution just letting - * material-ui determine what the anchor positioning of the popover - * is not reliable and has some error that appears to scale vertically. - * - * This vertical offset raises the popover positioning implementing the - * transformOrigin prop that material-ui's Popover element provides. - * - * These coefficients are NOT based on any known offsets or calc() - * functions. They are empiricallly determined. The actual scaling issue - * does NOT appear to be linear, but over the comparatively low height - * of the phone compared to the window it produces results that are within - * acceptable tolerances from the player's perspective. - * @param top - the computed distance from the top of the window to the top - * of the anchor element - */ -function calculateVerticalOffset(top: number): number { - return top * 0.2 - 38; -} - export const ShowMore = ({ id, isReported, isMine }) => { const [anchorEl, setAnchorEl] = useState(null); - const [verticalOffset, setVerticalOffset] = useState(0); const { t } = useTranslation(); const { config } = usePhone(); @@ -38,14 +16,10 @@ export const ShowMore = ({ id, isReported, isMine }) => { const handleClick = (event: React.MouseEvent) => { const element = event.currentTarget; setAnchorEl(element); - - const top = window.pageYOffset + element.getBoundingClientRect().top; - setVerticalOffset(calculateVerticalOffset(top)); }; const handleClose = () => { setAnchorEl(null); - setVerticalOffset(0); }; const handleDeleteTweet = () => { @@ -72,7 +46,7 @@ export const ShowMore = ({ id, isReported, isMine }) => { open={Boolean(anchorEl)} onClose={handleClose} transformOrigin={{ - vertical: verticalOffset, + vertical: -30, horizontal: 'left', }} >