mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-06-01 05:41:31 +00:00
31 lines
652 B
TypeScript
31 lines
652 B
TypeScript
|
|
||
|
import * as io from "./io";
|
||
|
|
||
|
export class ScriptUISliderType {
|
||
|
readonly uitype = 'slider';
|
||
|
value: number;
|
||
|
constructor(
|
||
|
readonly min: number,
|
||
|
readonly max: number
|
||
|
) {
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export class ScriptUISlider extends ScriptUISliderType implements io.Loadable {
|
||
|
initvalue: number;
|
||
|
initial(value: number) {
|
||
|
this.initvalue = value;
|
||
|
return this;
|
||
|
}
|
||
|
reset() {
|
||
|
this.value = this.initvalue != null ? this.initvalue : this.min;
|
||
|
}
|
||
|
$$getstate() {
|
||
|
return { value: this.value };
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export function slider(min: number, max: number) {
|
||
|
return new ScriptUISlider(min, max);
|
||
|
}
|