mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2025-07-18 19:24:06 +00:00
scripting: working on notebook, functions, files, setItem(), fixed tests
This commit is contained in:
30
src/common/script/lib/scriptui.ts
Normal file
30
src/common/script/lib/scriptui.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
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);
|
||||
}
|
Reference in New Issue
Block a user