Files
KSP-MGA-Planner/dist/main/editor/range.js
Krafpy 824af087c1 Modified file structure.
Modified the file structure to have the `index.html` at the root
of the repository. Needed for Github Pages.
2021-08-15 21:31:25 +02:00

26 lines
644 B
JavaScript

export class DiscreteRange {
constructor(id) {
this._rangeInput = document.getElementById(id);
this._rangeInput.step = "1";
}
setMinMax(min, max) {
this._rangeInput.min = min.toString();
this._rangeInput.max = max.toString();
}
input(onInput) {
this._rangeInput.oninput = () => onInput(this.value);
}
get value() {
return parseInt(this._rangeInput.value);
}
set value(val) {
this._rangeInput.value = val.toString();
}
disable() {
this._rangeInput.disabled = true;
}
enable() {
this._rangeInput.disabled = false;
}
}