mapcomplete/test.ts

37 lines
1.4 KiB
TypeScript
Raw Normal View History

import { max } from "moment";
import { Store, UIEventSource } from "./Logic/UIEventSource"
2022-07-05 13:44:36 +02:00
import Combine from "./UI/Base/Combine";
import { FixedUiElement } from "./UI/Base/FixedUiElement";
import { VariableUiElement } from "./UI/Base/VariableUIElement";
import { FixedInputElement } from "./UI/Input/FixedInputElement";
import Slider from "./UI/Input/Slider";
import Toggle from "./UI/Input/Toggle";
2022-07-05 13:44:36 +02:00
const testData = ["-1", "0", "0.5", "1", "1.5", "2"]
2022-07-05 13:44:36 +02:00
const values = testData.map((data) => new FixedUiElement(data).onClick(() => {
values.map((val) => {
val.RemoveClass("active bg-blue-200")
if (val.content === data) {
const options = {
value : new UIEventSource<number>(testData.indexOf(val.content)),
}
val.SetClass("active bg-blue-200")
const newSlider = new Slider(0, testData.length-1, options).SetClass("flex vertical m-4 elevatorslider");
new Combine([valCombine, newSlider]).SetClass("flex flex-row h-10").AttachTo("extradiv")
console.log(slider.GetValue())
2022-07-05 13:44:36 +02:00
}
})
}).SetClass("flex flex-column bg-slate-200 w-10 h-10 border-2 border-blue-500 border-solid rounded-full place-content-center items-center m-4"))
2022-07-05 13:44:36 +02:00
const valCombine = new Combine(values.reverse())
// valCombine.AttachTo("maindiv")
2022-07-05 13:44:36 +02:00
const slider = new Slider(0, testData.length-1);
2022-06-09 02:55:14 +02:00
slider.SetClass("flex vertical m-4 elevatorslider")
2022-07-05 13:44:36 +02:00
new Combine([valCombine, slider]).SetClass("flex flex-row h-10").AttachTo("extradiv")
2022-07-05 13:44:36 +02:00
console.log(slider)