Skip to content

Commit

Permalink
Merge pull request #25891 from pasyukevich/migrate-ts/getPopoverWithM…
Browse files Browse the repository at this point in the history
…easuredContentStyles

[No QA] [TS migration] Migrate 'getPopoverWithMeasuredContentStyles.js' style to TypeScript
  • Loading branch information
madmax330 authored Sep 1, 2023
2 parents ca03d22 + 76d7993 commit 62e2a0c
Showing 1 changed file with 8 additions and 10 deletions.
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

0 comments on commit 62e2a0c

Please sign in to comment.