diff --git a/src/lib/3d/TransformControls.svelte b/src/lib/3d/TransformControls.svelte index bf40de8..5678020 100644 --- a/src/lib/3d/TransformControls.svelte +++ b/src/lib/3d/TransformControls.svelte @@ -14,6 +14,7 @@ export let visible = true export let snap: boolean + export let useAbsolute = false let controls: TC const dispatch = createEventDispatcher() @@ -58,7 +59,10 @@ {option.label} -{#if $tooltipOpen} +{#if $tooltipOpen && option.key !== null}
const allOptions = Array.isArray(options) ? options : Object.values(options).flat() - const toOption = (option: Option): SelectOptionProps => ({ - value: option.key, - label: option.label, - disabled: false, - }) + const toOption = (option: Option | undefined): SelectOptionProps => + option + ? { value: option.key, label: option.label, disabled: false } + : { value: '', label: '', disabled: true } export let value: string export let clazz: string = '' @@ -41,7 +40,7 @@ // This DX is pretty bad. const sync = createSync({ selected }) - $: sync.selected(toOption(allOptions.find((opt) => opt.key == value)!), (v) => v && (value = v.value)) + $: sync.selected(toOption(allOptions.find((opt) => opt.key == value)), (v) => v && (value = v.value)) export let component: ComponentType> export let labelComponent: ComponentType> @@ -51,15 +50,11 @@
-
diff --git a/src/routes/beta/lib/editor/VisualEditor2.svelte b/src/routes/beta/lib/editor/VisualEditor2.svelte index e4c5906..077bc64 100644 --- a/src/routes/beta/lib/editor/VisualEditor2.svelte +++ b/src/routes/beta/lib/editor/VisualEditor2.svelte @@ -1043,20 +1043,23 @@ [ - s, - notNull(MICROCONTROLLER_NAME) - .filter( - (m) => BOARD_PROPERTIES[m].sizeName == s && (flags.draftuc || !BOARD_PROPERTIES[m].draft) - ) - .sort(sortMicrocontrollers) - .map((m) => ({ - key: m, - label: BOARD_PROPERTIES[m].name + ' ' + (BOARD_PROPERTIES[m].extraName || ''), - })), - ]) - )} + options={{ + ...Object.fromEntries( + MICROCONTROLLER_SIZES.map((s) => [ + s, + notNull(MICROCONTROLLER_NAME) + .filter( + (m) => BOARD_PROPERTIES[m].sizeName == s && (flags.draftuc || !BOARD_PROPERTIES[m].draft) + ) + .sort(sortMicrocontrollers) + .map((m) => ({ + key: m, + label: BOARD_PROPERTIES[m].name + ' ' + (BOARD_PROPERTIES[m].extraName || ''), + })), + ]) + ), + More: [{ key: null, label: 'None' }], + }} component={SelectMicrocontrollerInner} />