UNPKG

1.09 kBJavaScriptView Raw
1export var anchorType;
2
3(function (anchorType) {
4 anchorType["CENTER"] = "center";
5 anchorType["TOP"] = "top";
6 anchorType["TOP-LEFT"] = "top-left";
7 anchorType["TOP-RIGHT"] = "top-right";
8 anchorType["BOTTOM"] = "bottom";
9 anchorType["BOTTOM-LEFT"] = "bottom-left";
10 anchorType["LEFT"] = "left";
11 anchorType["RIGHT"] = "right";
12})(anchorType || (anchorType = {}));
13
14export var anchorTranslate = {
15 center: 'translate(-50%,-50%)',
16 top: 'translate(-50%,0)',
17 'top-left': 'translate(0,0)',
18 'top-right': 'translate(-100%,0)',
19 bottom: 'translate(-50%,-100%)',
20 'bottom-left': 'translate(0,-100%)',
21 'bottom-right': 'translate(-100%,-100%)',
22 left: 'translate(0,-50%)',
23 right: 'translate(-100%,-50%)'
24};
25export function applyAnchorClass(element, anchor, prefix) {
26 var classList = element.classList;
27
28 for (var _key in anchorTranslate) {
29 if (anchorTranslate.hasOwnProperty(_key)) {
30 classList.remove("l7-".concat(prefix, "-anchor-").concat(_key));
31 }
32 }
33
34 classList.add("l7-".concat(prefix, "-anchor-").concat(anchor));
35}
36//# sourceMappingURL=anchor.js.map
\No newline at end of file