const enum DirectionFlag { horizontal = 1 << 0 , negativeHorizontal = 1 << 1 , vertical = 1 << 2 , negativeVertical = 1 << 3 , horizontalLsh = 32 - 2 , horizontalRsh = 32 - 2 , verticalLsh = 32 - 4 , verticalRsh = 32 - 2 } export const enum Direction { none = 0 , left = DirectionFlag . horizontal | DirectionFlag . negativeHorizontal , right = DirectionFlag . horizontal , up = DirectionFlag . vertical | DirectionFlag . negativeVertical , down = DirectionFlag . vertical } export const enum TabDirection { backward = - 1 , forward = 1 } export function getDeltaX ( direction ) { return ( direction << DirectionFlag . horizontalLsh ) >> DirectionFlag . horizontalRsh ; } export function getDeltaY ( direction ) { return ( direction << DirectionFlag . verticalLsh ) >> DirectionFlag . verticalRsh ; } export function getTabDirection ( direction ) { return getDeltaX ( direction ) || getDeltaY ( direction ) ; }