Various fixes for browser compatibility issues (#12740)

* Replace Math.log2 with ol/math.log2
* TypedArray.from() browser compatibility fallback
* listen for input and change events for range
This commit is contained in:
mike-000
2021-09-15 15:45:12 +01:00
committed by GitHub
parent f9454ba8e3
commit cb6995d71a
15 changed files with 70 additions and 47 deletions

View File

@@ -38,18 +38,20 @@ const map = new Map({
}),
});
for (const name in variables) {
let variable;
for (variable in variables) {
const name = variable;
const element = document.getElementById(name);
const value = variables[name];
element.value = value.toString();
document.getElementById(`${name}-value`).innerText = `(${value})`;
element.addEventListener('input', function (event) {
document.getElementById(name + '-value').innerText = value.toFixed(2);
const listener = function (event) {
const value = parseFloat(event.target.value);
document.getElementById(`${name}-value`).innerText = `(${value})`;
document.getElementById(name + '-value').innerText = value.toFixed(2);
const updates = {};
updates[name] = value;
layer.updateStyleVariables(updates);
});
};
element.addEventListener('input', listener);
element.addEventListener('change', listener);
}