From b78c71641cdbd87b0e0993c60aab2b503fe7bcfd Mon Sep 17 00:00:00 2001 From: Tyler Clarke Date: Mon, 24 Mar 2025 09:07:15 -0400 Subject: [PATCH] final updates --- frog-realestate-pwa/main.js | 25 ++++++++++++++++++------- frog-realestate-pwa/manifest.json | 7 ++++++- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/frog-realestate-pwa/main.js b/frog-realestate-pwa/main.js index f7acd6b..fc06107 100644 --- a/frog-realestate-pwa/main.js +++ b/frog-realestate-pwa/main.js @@ -15,16 +15,26 @@ let video = document.getElementById("magic_video"); function takepicture() { let box = video.getBoundingClientRect(); - canvas.width = box.width; - canvas.height = box.height; video.classList.add("unbounded"); document.getElementById("endcamera").style.display = ""; ctx.canvas.classList.remove("offscreen"); document.getElementById("camview").classList.add("took") - requestAnimationFrame(() => { + // si c'est portrait, nous doivons le tourner à landscape (parce que le canvas ont besoin d'un photo landscape pour marcher bien) + if (box.height > box.width) { + canvas.width = box.height; + canvas.height = box.width; + ctx.translate(box.width/2, box.height/2); + ctx.rotate(Math.PI / 2); + ctx.drawImage(video, -box.width/2, -box.height/2, box.width, box.height); + ctx.rotate(-Math.PI / 2); + ctx.translate(-box.width/2, -box.height/2); + } + else { + canvas.width = box.width; + canvas.height = box.height; ctx.drawImage(video, 0, 0, box.width, box.height); - video.classList.remove("unbounded"); - }) + } + video.classList.remove("unbounded"); } function setdetails() { @@ -85,9 +95,9 @@ window.app = { ctx.fillText(new Date().toLocaleString(), 0, 76); let lat = document.getElementById("lat").value; let long = document.getElementById("long").value; - /*reverse_geocode(lat, long).then(res => { + reverse_geocode(lat, long).then(res => { ctx.fillText(res, 0, 104); - });*/ + }); ctx.fillText("https://maps.google.com/maps?q=" + lat + "," + long, 0, 128); ctx.fillText("Notes: " + document.getElementById("notes").value, 0, 154); let image = document.getElementById("precanvas"); @@ -117,6 +127,7 @@ function maps_static(lat, long, cbk) { document.body.appendChild(img); img.classList.add("offscreen"); img.src = "https://maps.googleapis.com/maps/api/staticmap?size=355x300&key=AIzaSyD_zbdxwN7_aOMNH69eAL9bSS814Ix-UM8&markers=label:S%7C" + lat + "," + long; + img.crossOrigin = "anonymous"; img.onload = () => { cbk(img); }; diff --git a/frog-realestate-pwa/manifest.json b/frog-realestate-pwa/manifest.json index b372ec9..8665922 100644 --- a/frog-realestate-pwa/manifest.json +++ b/frog-realestate-pwa/manifest.json @@ -5,7 +5,12 @@ { "src": "icon.png", "type": "image/png", - "sizes": "64x64" + "sizes": "512x512" + }, + { + "src": "icon.png", + "type": "image/png", + "sizes": "192x192" } ], "display": "standalone"