Skip to content

Commit

Permalink
(webui/number sequences): Fix visualization glitch when reference ima…
Browse files Browse the repository at this point in the history
…ge loading failed (#199)
  • Loading branch information
Slider0007 authored Jan 10, 2025
1 parent bbc15a0 commit e62a80d
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions sd-card/html/edit_sequence.html
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,25 @@ <h2>Number Sequences</h2>
canvas.height = this.height;
RefreshDraw();

canvas.addEventListener('mousedown', mouseDown, false);
canvas.addEventListener('mouseup', mouseUp, false);
canvas.addEventListener('mousemove', mouseMove, false);

$("#img_loading").hide();
$("#canvas").show();
};

imageObj.onerror = function() {
context.clearRect(0, 0, canvas.width, canvas.height);
context.textBaseline = "top";
context.textAlign = "left";
context.font = "16px arial";
context.fillText("No reference image", 10, 10);

canvas.removeEventListener('mousedown', mouseDown, false);
canvas.removeEventListener('mouseup', mouseUp, false);
canvas.removeEventListener('mousemove', mouseMove, false);

$("#img_loading").hide();
$("#canvas").show();
};
Expand Down Expand Up @@ -1534,9 +1553,6 @@ <h2>Number Sequences</h2>
function loadReferenceImage()
{
loadCanvas(getDomainname() + "/fileserver/config/reference.jpg?" + Math.floor((Math.random() * 1000000) + 1));
canvas.addEventListener('mousedown', mouseDown, false);
canvas.addEventListener('mouseup', mouseUp, false);
canvas.addEventListener('mousemove', mouseMove, false);
}


Expand All @@ -1551,6 +1567,7 @@ <h2>Number Sequences</h2>
jsonConfigModifiedDelta.analog = new Object();
jsonConfigModifiedDelta.analog = structuredClone(jsonConfig.analog);

loadReferenceImage();
fillSequenceSelectionOptions();
analogProcessingChanged(true);
digitProcessingChanged(true);
Expand All @@ -1566,7 +1583,6 @@ <h2>Number Sequences</h2>
openDescription();

$("#img_loading").attr("src", getDomainname() + '/img_loading.gif?v=$COMMIT_HASH');
loadReferenceImage();

//if (noConfigInStorage())
loadConfig().then(() => loadConfigData());
Expand Down

0 comments on commit e62a80d

Please sign in to comment.