-
Notifications
You must be signed in to change notification settings - Fork 2
/
Direction.ts
97 lines (89 loc) · 3.05 KB
/
Direction.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
* @module Toolbar
*/
/** Available directions.
* @public
*/
export enum Direction {
Left = 1,
Top,
Right,
Bottom,
}
/** Helpers for [[Direction]].
* @internal
*/
export class DirectionHelpers {
/** Class name of [[Direction.Left]] */
public static readonly LEFT_CLASS_NAME = "components-direction-left";
/** Class name of [[Direction.Top]] */
public static readonly TOP_CLASS_NAME = "components-direction-top";
/** Class name of [[Direction.Right]] */
public static readonly RIGHT_CLASS_NAME = "components-direction-right";
/** Class name of [[Direction.Bottom]] */
public static readonly BOTTOM_CLASS_NAME = "components-direction-bottom";
/** @returns Class name of specified [[Direction]] */
public static getCssClassName(direction: Direction): string {
switch (direction) {
case Direction.Left:
return DirectionHelpers.LEFT_CLASS_NAME;
case Direction.Top:
return DirectionHelpers.TOP_CLASS_NAME;
case Direction.Right:
return DirectionHelpers.RIGHT_CLASS_NAME;
case Direction.Bottom:
return DirectionHelpers.BOTTOM_CLASS_NAME;
}
}
/** @returns Orthogonal direction of specified [[Direction]] */
public static getOrthogonalDirection(
direction: Direction
): OrthogonalDirection {
switch (direction) {
case Direction.Left:
case Direction.Right:
return OrthogonalDirection.Horizontal;
case Direction.Top:
case Direction.Bottom:
return OrthogonalDirection.Vertical;
}
}
}
/** Available orthogonal directions.
* @alpha
*/
export enum OrthogonalDirection {
Vertical,
Horizontal,
}
/** Helpers for [[OrthogonalDirection]].
* @internal
*/
export class OrthogonalDirectionHelpers {
/** Class name of [[OrthogonalDirection.Vertical]] */
public static readonly VERTICAL_CLASS_NAME = "components-vertical";
/** Class name of [[OrthogonalDirection.Horizontal]] */
public static readonly HORIZONTAL_CLASS_NAME = "components-horizontal";
/** @returns Class name of specified [[OrthogonalDirection]] */
public static getCssClassName(direction: OrthogonalDirection): string {
switch (direction) {
case OrthogonalDirection.Vertical:
return OrthogonalDirectionHelpers.VERTICAL_CLASS_NAME;
case OrthogonalDirection.Horizontal:
return OrthogonalDirectionHelpers.HORIZONTAL_CLASS_NAME;
}
}
/** @returns Opposite of specified [[OrthogonalDirection]] */
public static inverse(direction: OrthogonalDirection): OrthogonalDirection {
switch (direction) {
case OrthogonalDirection.Vertical:
return OrthogonalDirection.Horizontal;
case OrthogonalDirection.Horizontal:
return OrthogonalDirection.Vertical;
}
}
}