Skip to content
Open
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
51 changes: 39 additions & 12 deletions sd-card/html/edit_analog.html
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ <h2>Analog ROI</h2>
<input type="checkbox" id="showall" name="showall" value="1" onclick="draw()" checked tabindex=9><label for="showall"> Show all ROIs</label><br>
<input type="checkbox" id="lockAspectRatio" name="lockAspectRatio" value="1" onclick="changelockAspectRatio()" checked tabindex=6><label for="lockAspectRatio"> Lock aspect ratio </label><br>
<input type="checkbox" id="lockSizes" name="lockSizes" value="1" onclick="changelockSizes()" checked tabindex=7><label for="lockSizes"> Synchronize y, Δx and Δy between ROIs</label><br>
<input type="checkbox" id="drawFromCenter" name="drawFromCenter" value="1" onclick="changeDrawFromCenter()" checked tabindex=8><label for="drawFromCenter"> Draw from center</label><br>
<hr>

<table>
Expand Down Expand Up @@ -196,6 +197,7 @@ <h2>Analog ROI</h2>
enhanceCon = false,
lockAspectRatio = true,
lockSizes = false,
drawFromCenter = true,
domainname = getDomainname();

function doReboot() {
Expand Down Expand Up @@ -316,7 +318,11 @@ <h2>Analog ROI</h2>

function changelockSizes() {
lockSizes = document.getElementById("lockSizes").checked;
UpdateROIs();
UpdateROIs();
}

function changeDrawFromCenter() {
drawFromCenter = document.getElementById("drawFromCenter").checked;
}

function changeCCW() {
Expand Down Expand Up @@ -800,8 +806,12 @@ <h2>Analog ROI</h2>
zw = getCoords(this)
rect.startX = e.pageX - zw.left;
rect.startY = e.pageY - zw.top;
if (drawFromCenter) {
rect.centerX = rect.startX;
rect.centerY = rect.startY;
}
document.getElementById("refx").value = rect.startX;
document.getElementById("refy").value = rect.startY;
document.getElementById("refy").value = rect.startY;
drag = true;
}

Expand All @@ -822,16 +832,33 @@ <h2>Analog ROI</h2>
}

function mouseMove(e) {
const mouseX = e.pageX - zw.left;
const mouseY = e.pageY - zw.top;

if (drag) {
zw = getCoords(this)
zw = getCoords(this)

if (drawFromCenter) {
if (lockAspectRatio) {
rect.h = Math.abs(mouseY - rect.centerY) * 2;
rect.w = Math.round(rect.h * ROIInfo[aktindex]["ar"]);
} else {
rect.w = Math.abs(mouseX - rect.centerX) * 2;
rect.h = Math.abs(mouseY - rect.centerY) * 2;
}

if (lockAspectRatio) {
rect.h = (e.pageY - zw.top) - rect.startY;
rect.w = Math.round(rect.h * ROIInfo[aktindex]["ar"]);
}
else {
rect.w = (e.pageX - zw.left) - rect.startX;
rect.h = (e.pageY - zw.top) - rect.startY;
rect.startX = rect.centerX - rect.w / 2;
rect.startY = rect.centerY - rect.h / 2;
document.getElementById("refx").value = Math.round(rect.startX);
document.getElementById("refy").value = Math.round(rect.startY);
} else {
if (lockAspectRatio) {
rect.h = mouseY - rect.startY;
rect.w = Math.round(rect.h * ROIInfo[aktindex]["ar"]);
} else {
rect.w = mouseX - rect.startX;
rect.h = mouseY - rect.startY;
}
}
document.getElementById("refdx").value = rect.w;
document.getElementById("refdy").value = rect.h;
Expand All @@ -843,8 +870,8 @@ <h2>Analog ROI</h2>
var context = canvas.getContext('2d');

zw = getCoords(this);
x = e.pageX - zw.left;
y = e.pageY - zw.top;
x = mouseX;
y = mouseY;

context.lineWidth = 2;
context.strokeStyle = "#00FF00";
Expand Down