From 031142136fe86e23188e8f799517bad9b8719573 Mon Sep 17 00:00:00 2001 From: sD Date: Wed, 27 May 2020 00:53:34 +0200 Subject: let the user change the viewport size to 16:9 --- webAO/client.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'webAO/client.js') diff --git a/webAO/client.js b/webAO/client.js index de269be..ebaa09e 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -2197,6 +2197,37 @@ export async function iniedit() { } window.iniedit = iniedit; +/** + * Triggered by the change aspect ratio checkbox + */ +export async function switchAspectRatio() { + const background = document.getElementById("client_background"); + const offsetCheck = document.getElementById("client_hdviewport_offset"); + if(document.getElementById("client_hdviewport").checked) { + background.style.paddingBottom = "56.25%"; + offsetCheck.disabled = false; + } else { + background.style.paddingBottom = "75%"; + offsetCheck.disabled = true; + } +} +window.switchAspectRatio = switchAspectRatio; + +/** + * Triggered by the change aspect ratio checkbox + */ +export async function switchChatOffset() { + const container = document.getElementById("client_chatcontainer"); + if(document.getElementById("client_hdviewport_offset").checked) { + container.style.width = "80%"; + container.style.left = "10%"; + } else { + container.style.width = "100%"; + container.style.left = 0; + } +} +window.switchChatOffset = switchChatOffset; + /** * Triggered when a character icon is clicked in the character selection menu. * @param {MouseEvent} event -- cgit