Convert utils/snap to TS
Reviewed By: danielbuechele Differential Revision: D16710422 fbshipit-source-id: 2f907904a7df24f6972952d0c7a63d7e6506e2ff
This commit is contained in:
committed by
Facebook Github Bot
parent
a522afd64f
commit
9b6f3684cb
@@ -12,7 +12,7 @@ import {
|
||||
maybeSnapLeft,
|
||||
maybeSnapTop,
|
||||
SNAP_SIZE,
|
||||
} from '../../utils/snap.js';
|
||||
} from '../../utils/snap.tsx';
|
||||
import styled from '../styled/index.js';
|
||||
import invariant from 'invariant';
|
||||
import React from 'react';
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {Rect} from './geometry.js';
|
||||
import {Rect} from './geometry.js';
|
||||
|
||||
export const SNAP_SIZE = 16;
|
||||
|
||||
@@ -19,10 +19,10 @@ export function getPossibleSnappedPosition(
|
||||
getGap,
|
||||
getNew,
|
||||
}: {
|
||||
getNew: (win: Rect) => number,
|
||||
getGap: (win: Rect) => number,
|
||||
getNew: (win: Rect) => number;
|
||||
getGap: (win: Rect) => number;
|
||||
},
|
||||
): ?number {
|
||||
): number | undefined {
|
||||
for (const win of windows) {
|
||||
const gap = Math.abs(getGap(win));
|
||||
if (gap >= 0 && gap < SNAP_SIZE) {
|
||||
@@ -87,7 +87,6 @@ export function maybeSnapLeft(
|
||||
// │A│B│
|
||||
// └─┴─┘
|
||||
const snapRight = getPossibleSnappedPosition(windows, {
|
||||
debug: true,
|
||||
getGap: win => win.left - (props.width + left),
|
||||
getNew: win => win.left - props.width,
|
||||
});
|
||||
Reference in New Issue
Block a user