Center
This commit is contained in:
Vendored
+3
-1
@@ -148,8 +148,10 @@ export function openSwitcher() {
|
|||||||
backdrop.onclick = close;
|
backdrop.onclick = close;
|
||||||
const anchor = document.querySelector(".task-picker").getBoundingClientRect();
|
const anchor = document.querySelector(".task-picker").getBoundingClientRect();
|
||||||
box.style.top = `${anchor.bottom + 4}px`;
|
box.style.top = `${anchor.bottom + 4}px`;
|
||||||
box.style.right = `${document.documentElement.clientWidth - anchor.right}px`;
|
|
||||||
document.body.append(backdrop, box);
|
document.body.append(backdrop, box);
|
||||||
|
const viewport = document.documentElement.clientWidth;
|
||||||
|
const left = anchor.left + anchor.width / 2 - box.offsetWidth / 2;
|
||||||
|
box.style.left = `${Math.max(8, Math.min(left, viewport - box.offsetWidth - 8))}px`;
|
||||||
render();
|
render();
|
||||||
input.focus();
|
input.focus();
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+3
-1
@@ -164,8 +164,10 @@ export function openSwitcher(): void {
|
|||||||
|
|
||||||
const anchor = document.querySelector(".task-picker")!.getBoundingClientRect();
|
const anchor = document.querySelector(".task-picker")!.getBoundingClientRect();
|
||||||
box.style.top = `${anchor.bottom + 4}px`;
|
box.style.top = `${anchor.bottom + 4}px`;
|
||||||
box.style.right = `${document.documentElement.clientWidth - anchor.right}px`;
|
|
||||||
document.body.append(backdrop, box);
|
document.body.append(backdrop, box);
|
||||||
|
const viewport = document.documentElement.clientWidth;
|
||||||
|
const left = anchor.left + anchor.width / 2 - box.offsetWidth / 2;
|
||||||
|
box.style.left = `${Math.max(8, Math.min(left, viewport - box.offsetWidth - 8))}px`;
|
||||||
render();
|
render();
|
||||||
input.focus();
|
input.focus();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user