Bounds guard on zoom.

This commit is contained in:
Bill Thiede 2023-01-15 13:34:24 -08:00
parent d7dcbbd318
commit 1f5a377194

View File

@ -23,8 +23,8 @@ const Sidebar = (props) => {
if (pix === undefined) { return <p key={md.name}>Loading...</p>; } if (pix === undefined) { return <p key={md.name}>Loading...</p>; }
let max = binaryMax[md.name]; let max = binaryMax[md.name];
let [w, h] = md.size; let [w, h] = md.size;
let xOff = mouseX; // Math.min(w, Math.max(0, Math.round(x*w))); let xOff = Math.min(mouseX,w-1); // Math.min(w, Math.max(0, Math.round(x*w)));
let yOff = mouseY; // Math.min(h, Math.max(0, Math.round(y*h))); let yOff = Math.min(mouseY,h-1); // Math.min(h, Math.max(0, Math.round(y*h)));
let v = pix[xOff+yOff*w]; let v = pix[xOff+yOff*w];
let color = "#fff"; let color = "#fff";
let rgb = ""; let rgb = "";