Merge pull request #281 from skiphansen/oepl_pr_4

Fixed drag and drop image resizing.
This commit is contained in:
atc1441
2024-04-04 22:06:14 +02:00
committed by GitHub

View File

@@ -64,9 +64,9 @@ window.addEventListener("loadConfig", function () {
if (data.hasBLE == 0) {
$("#apcfgble").parentNode.style.display = 'none';
}
if (data.hasSubGhz == 0) {
$("#apcfgsubgigchid").parentNode.style.display = 'none';
}
if (data.hasSubGhz == 0) {
$("#apcfgsubgigchid").parentNode.style.display = 'none';
}
if (data.savespace) {
}
if (data.apstate) {
@@ -1472,7 +1472,7 @@ function dropUpload() {
const canvas = createCanvas(width, height);
const ctx = canvas.getContext('2d');
const scaleFactor = Math.max(
const scaleFactor = Math.min(
canvas.width / image.width,
canvas.height / image.height
);
@@ -1483,6 +1483,8 @@ function dropUpload() {
const x = (canvas.width - newWidth) / 2;
const y = (canvas.height - newHeight) / 2;
ctx.fillStyle = "white";
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.drawImage(image, x, y, newWidth, newHeight);
canvas.toBlob(async (blob) => {