Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[No QA] [TS migration] Migrate 'getPopoverWithMeasuredContentStyles.js' style to TypeScript #25891

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ import variables from './variables';
* Compute the amount that the Context menu's Anchor needs to be horizontally shifted
* in order to keep it from displaying in the gutters.
*
* @param {Number} anchorLeftEdge - Menu's anchor Left edge.
* @param {Number} menuWidth - The width of the menu itself.
* @param {Number} windowWidth - The width of the Window.
* @returns {Number}
* @param anchorLeftEdge - Menu's anchor Left edge.
* @param menuWidth - The width of the menu itself.
* @param windowWidth - The width of the Window.
*/
function computeHorizontalShift(anchorLeftEdge, menuWidth, windowWidth) {
function computeHorizontalShift(anchorLeftEdge: number, menuWidth: number, windowWidth: number): number {
const popoverRightEdge = anchorLeftEdge + menuWidth;
if (anchorLeftEdge < variables.gutterWidth) {
// Anchor is in left gutter, shift right by a multiple of four.
Expand All @@ -30,12 +29,11 @@ function computeHorizontalShift(anchorLeftEdge, menuWidth, windowWidth) {
* Compute the amount that the Context menu's Anchor needs to be vertically shifted
* in order to keep it from displaying in the window.
*
* @param {Number} anchorTopEdge - Menu's anchor Top edge.
* @param {Number} menuHeight - The height of the menu itself.
* @param {Number} windowHeight - The height of the Window.
* @returns {Number}
* @param anchorTopEdge - Menu's anchor Top edge.
* @param menuHeight - The height of the menu itself.
* @param windowHeight - The height of the Window.
*/
function computeVerticalShift(anchorTopEdge, menuHeight, windowHeight) {
function computeVerticalShift(anchorTopEdge: number, menuHeight: number, windowHeight: number): number {
const popoverBottomEdge = anchorTopEdge + menuHeight;

if (anchorTopEdge < 0) {
Expand Down
Loading