2022-07-18 10:21:16 +02:00
|
|
|
import { max } from "moment";
|
|
|
|
import { Store, UIEventSource } from "./Logic/UIEventSource"
|
2022-07-05 13:44:36 +02:00
|
|
|
import Combine from "./UI/Base/Combine";
|
2022-07-18 10:21:16 +02:00
|
|
|
import { FixedUiElement } from "./UI/Base/FixedUiElement";
|
|
|
|
import { VariableUiElement } from "./UI/Base/VariableUIElement";
|
|
|
|
import { FixedInputElement } from "./UI/Input/FixedInputElement";
|
|
|
|
import Slider from "./UI/Input/Slider";
|
2022-07-18 11:51:49 +02:00
|
|
|
import Toggle, { ClickableToggle } from "./UI/Input/Toggle";
|
2022-07-05 13:44:36 +02:00
|
|
|
|
2022-07-18 10:21:16 +02:00
|
|
|
const testData = ["-1", "0", "0.5", "1", "1.5", "2"]
|
2022-07-18 13:50:14 +02:00
|
|
|
let slider = new Slider(0, testData.length - 1, {vertical: true});
|
2022-07-05 13:44:36 +02:00
|
|
|
|
2022-07-18 16:28:12 +02:00
|
|
|
slider.SetClass("flex m-1 elevatorslider mb-0 mt-8").SetStyle("height: "+2.5*testData.length+"rem ")
|
|
|
|
|
|
|
|
const toggleClass = "flex border-2 border-blue-500 w-10 h-10 place-content-center items-center"
|
2022-07-18 11:51:49 +02:00
|
|
|
|
|
|
|
const values = testData.map((data, i) => new ClickableToggle(
|
|
|
|
new FixedUiElement(data).SetClass("active bg-subtle " + toggleClass), new FixedUiElement(data).SetClass(toggleClass), slider.GetValue().sync(
|
|
|
|
(sliderVal) => {
|
|
|
|
return sliderVal === i
|
|
|
|
},
|
|
|
|
[],
|
|
|
|
(isSelected) => {
|
|
|
|
return isSelected ? i : slider.GetValue().data
|
2022-07-05 13:44:36 +02:00
|
|
|
}
|
2022-07-18 11:51:49 +02:00
|
|
|
))
|
|
|
|
.ToggleOnClick()
|
2022-07-18 16:28:12 +02:00
|
|
|
.SetClass("flex flex-column ml-5 bg-slate-200 w-10 h-10 valuesContainer"))
|
2022-07-05 13:44:36 +02:00
|
|
|
|
2022-07-18 10:21:16 +02:00
|
|
|
const valCombine = new Combine(values.reverse())
|
2022-06-09 02:55:14 +02:00
|
|
|
|
2022-07-18 13:50:14 +02:00
|
|
|
new Combine([valCombine.SetClass("mt-8"), slider]).SetClass("flex flex-row h-14").AttachTo("extradiv")
|