html2canvas/src/parsing/position.js
2017-08-01 00:25:58 +08:00

28 lines
551 B
JavaScript

/* @flow */
'use strict';
export const POSITION = {
STATIC: 0,
RELATIVE: 1,
ABSOLUTE: 2,
FIXED: 3,
STICKY: 4
};
export type Position = $Values<typeof POSITION>;
export const parsePosition = (position: string): Position => {
switch (position) {
case 'relative':
return POSITION.RELATIVE;
case 'absolute':
return POSITION.ABSOLUTE;
case 'fixed':
return POSITION.FIXED;
case 'sticky':
return POSITION.STICKY;
}
return POSITION.STATIC;
};