Skip to content

Commit

Permalink
debug log dropdown caluclations, fix lower half of window check
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerwyn committed Nov 21, 2024
1 parent 4a4593a commit d2c9fba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/custom-features-row.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion src/classes/custom-feature-dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,21 @@ export class CustomFeatureDropdown extends BaseCustomFeature {
const rect = this.getBoundingClientRect();
const edgeOffset = 48;

console.log(`Dropdown initial height: ${dropdown.offsetHeight}`);
console.log(
`Available height down: ${window.innerHeight - edgeOffset - rect.bottom}`,
);
console.log(
`Available height up: ${window.innerHeight - edgeOffset - rect.bottom}`,
);

let down = true;
if (
// If dropdown is too large
dropdown.offsetHeight >
window.innerHeight - edgeOffset - rect.bottom &&
// If dropdown is on lower half of window
rect.top + rect.bottom < window.innerHeight
rect.top + rect.bottom > window.innerHeight
) {
down = false;
}
Expand Down

0 comments on commit d2c9fba

Please sign in to comment.