UNPKG

2.25 kBJavaScriptView Raw
1/*
2 * Copyright 2015 Palantir Technologies, Inc. All rights reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16export var Position = {
17 BOTTOM: "bottom",
18 BOTTOM_LEFT: "bottom-left",
19 BOTTOM_RIGHT: "bottom-right",
20 LEFT: "left",
21 LEFT_BOTTOM: "left-bottom",
22 LEFT_TOP: "left-top",
23 RIGHT: "right",
24 RIGHT_BOTTOM: "right-bottom",
25 RIGHT_TOP: "right-top",
26 TOP: "top",
27 TOP_LEFT: "top-left",
28 TOP_RIGHT: "top-right",
29};
30export function isPositionHorizontal(position) {
31 /* istanbul ignore next */
32 return (position === Position.TOP ||
33 position === Position.TOP_LEFT ||
34 position === Position.TOP_RIGHT ||
35 position === Position.BOTTOM ||
36 position === Position.BOTTOM_LEFT ||
37 position === Position.BOTTOM_RIGHT);
38}
39export function isPositionVertical(position) {
40 /* istanbul ignore next */
41 return (position === Position.LEFT ||
42 position === Position.LEFT_TOP ||
43 position === Position.LEFT_BOTTOM ||
44 position === Position.RIGHT ||
45 position === Position.RIGHT_TOP ||
46 position === Position.RIGHT_BOTTOM);
47}
48export function getPositionIgnoreAngles(position) {
49 if (position === Position.TOP || position === Position.TOP_LEFT || position === Position.TOP_RIGHT) {
50 return Position.TOP;
51 }
52 else if (position === Position.BOTTOM ||
53 position === Position.BOTTOM_LEFT ||
54 position === Position.BOTTOM_RIGHT) {
55 return Position.BOTTOM;
56 }
57 else if (position === Position.LEFT || position === Position.LEFT_TOP || position === Position.LEFT_BOTTOM) {
58 return Position.LEFT;
59 }
60 else {
61 return Position.RIGHT;
62 }
63}
64//# sourceMappingURL=position.js.map
\No newline at end of file