You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

17 lines
459 B

// @flow
import memoizeOne from 'memoize-one';
import { type Position } from 'css-box-model';
import type { Axis, DisplacedBy } from '../types';
import { patch } from './position';
// TODO: memoization needed?
export default memoizeOne(function getDisplacedBy(
axis: Axis,
displaceBy: Position,
): DisplacedBy {
const displacement: number = displaceBy[axis.line];
return {
value: displacement,
point: patch(axis.line, displacement),
};
});