document.addEventListener('DOMContentLoaded', () => { const infoButton = document.querySelector("#info-button"); const infoPopup = document.querySelector("#info-popup"); const closeButton = document.querySelector(".close-button"); const infoForm = document.querySelector("#info-form"); infoButton.addEventListener('click', () => { disableUnityKeyboardListening(); objectSizesRequest(); }); closeButton.addEventListener('click', () => { infoPopup.classList.add('hidden'); }); infoForm.addEventListener('submit', (e) => { e.preventDefault(); let width = document.getElementById('field1').value; let height = document.getElementById('field2').value; let depth = document.getElementById('field3').value; if (!width && !height && !depth) { alert("Please fill at least one field."); return; } if (width === '') width = -1; if (height === '') height = -1; if (depth === '') depth = -1; if (!isValidInteger(width) || !isValidInteger(height) || !isValidInteger(depth)) { alert("Please enter valid numeric values for Width, Height, and Depth."); return; } applicationInstance.SendMessage('ApplicationAPI', 'ResizeObject', `${width};${height};${depth}`); document.querySelector('#field1').value = ''; document.querySelector('#field2').value = ''; document.querySelector('#field3').value = ''; infoPopup.classList.add('hidden'); }); }); function setObjectSizes(sizes) { const [width, height, depth] = sizes.split(';').map(Number); document.getElementById('field1').value = width; document.getElementById('field2').value = height; document.getElementById('field3').value = depth; const infoPopup = document.querySelector("#info-popup"); infoPopup.classList.remove('hidden'); }