Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions 2.ui-tweaking/4.difference-video-size.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,18 @@ <h1 style="font-size: 1.5em;">Enlarge the Video Stream</h1>
backToNormal.addEventListener('click', () => {
exitFullPage();
});
fitPage.addEventListener('click', () => {
fitPage.addEventListener('click', async () => {
fitPage.hidden = true;
UIElement.classList.add("fullscreen");
await updateDisplayArea();
backToNormal.hidden = false;
});

function exitFullPage() {
UIElement.classList.remove("fullscreen");
async function exitFullPage() {
backToNormal.hidden = true;
UIElement.classList.remove("fullscreen");
await updateDisplayArea();
fitPage.hidden = false;
}
// decode video from camera
async function showScanner() {
Expand All @@ -77,7 +81,8 @@ <h1 style="font-size: 1.5em;">Enlarge the Video Stream</h1>
await scanner.setUIElement(document.getElementById('div-ui-container'));
scanner.onUniqueRead = (txt, result) => {
document.getElementById('result').value = result.barcodeFormatString + ": " + txt;
exitFullPage();
if(fitPage.hidden)
exitFullPage();
document.getElementById('result').focus();
setTimeout(() => {
document.getElementById('result').blur();
Expand All @@ -92,6 +97,12 @@ <h1 style="font-size: 1.5em;">Enlarge the Video Stream</h1>
throw ex;
}
}
async function updateDisplayArea() {
let scanner = await pScanner;
// trigger the resize event to adjust the positioning of the code area
const resizeEvent = new Event('resize');
window.dispatchEvent(resizeEvent);
}
</script>
</body>
<style>
Expand Down