mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
Change viewport based on device orientation.
This commit is contained in:
parent
55c7ce34a3
commit
ffbd8d5821
@ -23,6 +23,9 @@ export function ApplyInputEventHandlers() {
|
||||
window.addEventListener("resize", ev => {
|
||||
PositionCommandCompletionWindow();
|
||||
});
|
||||
|
||||
setViewportWidth();
|
||||
window.addEventListener("orientationchange", setViewportWidth);
|
||||
}
|
||||
|
||||
function addGridPaginationHandlers() {
|
||||
@ -258,4 +261,16 @@ function keyDownOnWindow() {
|
||||
UI.ConsoleOutputDiv.innerHTML = "";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function setViewportWidth() {
|
||||
if (window.screen?.orientation?.type?.includes("portrait")) {
|
||||
var desiredWidth = Math.max(550, window.screen.width);
|
||||
document.querySelector('meta[name="viewport"').setAttribute("content", `width=${desiredWidth}, user-scalable=no`);
|
||||
}
|
||||
else {
|
||||
var desiredHeight = Math.max(700, window.screen.height);
|
||||
document.querySelector('meta[name="viewport"').setAttribute("content", `width=device-width, height=${desiredHeight}, user-scalable=no`);
|
||||
}
|
||||
console.log(window.screen);
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user