Fix showDiagramMessage function not exposed enough
This commit is contained in:
parent
8f3bdd6188
commit
6f55d3a67b
39
mibpov.js
39
mibpov.js
@ -873,22 +873,9 @@ function getSelectedBiomeIDAndElement() {
|
|||||||
return [null, null];
|
return [null, null];
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkDrawValid(context) {
|
// Show a message in the center of the given draw
|
||||||
if (!context) {
|
// context.
|
||||||
if (!voronoiCanvas.hidden) {
|
function showDiagramMessage(context, text) {
|
||||||
voronoiCanvas.hidden = true;
|
|
||||||
coordinateDisplay.hidden = true;
|
|
||||||
altitudeDisplay.hidden = true;
|
|
||||||
rangeDisplay.hidden = true;
|
|
||||||
configDiv.hidden = true;
|
|
||||||
|
|
||||||
errorMessage.innerText = "ERROR: Could not get the canvas context which means this tool won't work for you. Maybe your browser does not support the HTML canvas element properly.";
|
|
||||||
console.error("Could not get the canvas context!");
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
let showDiagramMessage = function(context, text) {
|
|
||||||
context.textAlign = "center";
|
context.textAlign = "center";
|
||||||
context.fillStyle = "black";
|
context.fillStyle = "black";
|
||||||
context.textBaseline = "middle";
|
context.textBaseline = "middle";
|
||||||
@ -903,6 +890,26 @@ function checkDrawValid(context) {
|
|||||||
updateAltitudeText();
|
updateAltitudeText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if a diagram can be drawn on the draw context and
|
||||||
|
// if not, draws a message and return false.
|
||||||
|
// If everything is fine, return true.
|
||||||
|
function checkDrawValid(context) {
|
||||||
|
if (!context) {
|
||||||
|
// We don't even have a valid draw context!
|
||||||
|
// Write an error message in the error message element
|
||||||
|
if (!voronoiCanvas.hidden) {
|
||||||
|
voronoiCanvas.hidden = true;
|
||||||
|
coordinateDisplay.hidden = true;
|
||||||
|
altitudeDisplay.hidden = true;
|
||||||
|
rangeDisplay.hidden = true;
|
||||||
|
configDiv.hidden = true;
|
||||||
|
|
||||||
|
errorMessage.innerText = "ERROR: Could not get the canvas context which means this tool won't work for you. Maybe your browser does not support the HTML canvas element properly.";
|
||||||
|
console.error("Could not get the canvas context!");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Fail and render a special message if the value range is tiny
|
// Fail and render a special message if the value range is tiny
|
||||||
if ((limit_heat_max - limit_heat_min < 0.01) || (limit_humidity_max - limit_humidity_min < 0.01)) {
|
if ((limit_heat_max - limit_heat_min < 0.01) || (limit_humidity_max - limit_humidity_min < 0.01)) {
|
||||||
showDiagramMessage(context, "Value range is too small.");
|
showDiagramMessage(context, "Value range is too small.");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user