refactorings + basis of script editor.

This commit is contained in:
2023-09-26 22:43:27 +02:00
parent 2188d489ea
commit 13da56009e
30 changed files with 52989 additions and 521 deletions
@@ -0,0 +1,28 @@
<script lang="ts">
import BFormOption from "./BFormOption.svelte";
import BFormParameter from "./BFormParameter.svelte";
export let value: number | null;
function update(percentage: number) {
if (value !== null) {
value = percentage / 100;
}
}
function toggle() {
if (value === null) {
value = 0.50;
} else {
value = null;
}
}
let percentage: number
$: percentage = Math.max(Math.min((value || 0) * 100, 100), 0);
$: update(percentage);
</script>
<BFormOption on:click={toggle} icon="cirlce_notch" state={(value !== null) || null}>
<BFormParameter type="number" label="%" bind:value={percentage} min={0} max={100} step={1} narrower />
</BFormOption>