Skip to content

Commit 736cdf4

Browse files
committed
fixed bug with vertical alignment
1 parent 5ab567c commit 736cdf4

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

index.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
<!-- <script src="./dist/bundle/mgt-loader.js"></script> -->
1515

1616
<script type="module" src="dist/es6/index.js"></script>
17-
<script type="module" src="dist/es6/components/sub-components/mgt-flyout/mgt-flyout.js"></script>
1817
<script type="module" src="./dist/es6/mock/mgt-mock-provider.js"></script>
1918
</head>
2019

@@ -33,7 +32,10 @@
3332
<!-- <mgt-mock-provider></mgt-mock-provider> -->
3433

3534
<mgt-login></mgt-login>
36-
<mgt-person person-query="me" person-card="click"></mgt-person>
37-
<mgt-tasks></mgt-tasks>
35+
<mgt-person person-query="me" show-name show-email person-card="hover"></mgt-person>
36+
<mgt-people-picker></mgt-people-picker>
37+
<mgt-tasks data-source="todo"></mgt-tasks>
38+
<mgt-agenda group-by-day></mgt-agenda>
39+
<mgt-people></mgt-people>
3840
</body>
3941
</html>

src/components/sub-components/mgt-flyout/mgt-flyout.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ export class MgtFlyout extends LitElement {
109109
if (flyout && anchor) {
110110
let left: number;
111111
let bottom: number;
112+
let top: number;
112113

113114
if (this.isOpen) {
114115
const flyoutRect = flyout.getBoundingClientRect();
@@ -152,13 +153,16 @@ export class MgtFlyout extends LitElement {
152153
}
153154
}
154155

155-
if (windowHeight < flyoutBottom) {
156+
if (flyoutRect.height > windowHeight || (windowHeight < flyoutBottom && anchorRect.top < flyoutRect.height)) {
157+
top = -flyoutTop + anchorRect.height;
158+
} else if (windowHeight < flyoutBottom) {
156159
bottom = anchorRect.height;
157160
}
158161
}
159162

160163
flyout.style.left = typeof left !== 'undefined' ? `${left}px` : '';
161164
flyout.style.bottom = typeof bottom !== 'undefined' ? `${bottom}px` : '';
165+
flyout.style.top = typeof top !== 'undefined' ? `${top}px` : '';
162166
}
163167
}
164168
}

0 commit comments

Comments
 (0)