This commit is contained in:
Azgaar 2019-09-10 02:44:34 +03:00
parent c0a634bec1
commit 5a1b747da8
11 changed files with 182 additions and 51 deletions

View file

@ -343,17 +343,18 @@ styleClippingInput.addEventListener("change", function() {
styleGridType.addEventListener("change", function() {
if (layerIsOn("toggleGrid")) drawGrid();
calculateFriendlyGridSize();
});
styleGridSize.addEventListener("input", function() {
if (layerIsOn("toggleGrid")) drawGrid();
styleGridSizeOutput.value = this.value;
calculateFriendlyGridSize();
});
function calculateFriendlyGridSize() {
const size = styleGridSize.value * Math.cos(30 * Math.PI / 180) * 2;;
const friendly = "(" + rn(size * distanceScaleInput.value) + " " + distanceUnitInput.value + ")";
const square = styleGridType.value === "square";
const size = square ? styleGridSize.value : styleGridSize.value * Math.cos(30 * Math.PI / 180) * 2;
const friendly = `${rn(size * distanceScaleInput.value, 2)} ${distanceUnitInput.value}`;
styleGridSizeFriendly.value = friendly;
}