Merge pull request #1 from Tormak9970/reorderable-list

Reorderable list now saves on backout
This commit is contained in:
Travis Lane
2023-03-29 10:18:32 -04:00
committed by GitHub

View File

@@ -52,6 +52,13 @@ export function ReorderableList<T>(props: ReorderableListProps<T>) {
}
}
function saveOnBackout(e: Event) {
const event = e as CustomEvent;
if (event.detail.button == GamepadButton.CANCEL) {
toggleReorderEnabled();
}
}
return (
<Fragment>
<div
@@ -70,6 +77,7 @@ export function ReorderableList<T>(props: ReorderableListProps<T>) {
onSecondaryButton={toggleReorderEnabled}
onSecondaryActionDescription={reorderEnabled ? 'Save Order' : 'Reorder'}
onClick={toggleReorderEnabled}
onButtonDown={saveOnBackout}
>
{entryList.map((entry: ReorderableEntry<T>) => (
<ReorderableItem