Fix showDiagramMessage function not exposed enough
This commit is contained in:
parent
8f3bdd6188
commit
6f55d3a67b
37
mibpov.js
37
mibpov.js
@ -873,8 +873,30 @@ function getSelectedBiomeIDAndElement() {
|
||||
return [null, null];
|
||||
}
|
||||
|
||||
// Show a message in the center of the given draw
|
||||
// context.
|
||||
function showDiagramMessage(context, text) {
|
||||
context.textAlign = "center";
|
||||
context.fillStyle = "black";
|
||||
context.textBaseline = "middle";
|
||||
if (voronoiCanvas.width < 300) {
|
||||
context.font = "100% sans-serif";
|
||||
} else if (voronoiCanvas.width < 450) {
|
||||
context.font = "150% sans-serif";
|
||||
} else {
|
||||
context.font = "200% sans-serif";
|
||||
}
|
||||
context.fillText(text, voronoiCanvas.width/2, voronoiCanvas.height/2);
|
||||
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;
|
||||
@ -888,21 +910,6 @@ function checkDrawValid(context) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let showDiagramMessage = function(context, text) {
|
||||
context.textAlign = "center";
|
||||
context.fillStyle = "black";
|
||||
context.textBaseline = "middle";
|
||||
if (voronoiCanvas.width < 300) {
|
||||
context.font = "100% sans-serif";
|
||||
} else if (voronoiCanvas.width < 450) {
|
||||
context.font = "150% sans-serif";
|
||||
} else {
|
||||
context.font = "200% sans-serif";
|
||||
}
|
||||
context.fillText(text, voronoiCanvas.width/2, voronoiCanvas.height/2);
|
||||
updateAltitudeText();
|
||||
}
|
||||
|
||||
// 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)) {
|
||||
showDiagramMessage(context, "Value range is too small.");
|
||||
|
Loading…
x
Reference in New Issue
Block a user