diff --git a/CHANGELOG.md b/CHANGELOG.md index a052e3647..f997b679e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix issue where changing the dimensions of a sprite png image could cause the sprite editor's tile palette to display incorrectly - Fix line numbers in code editor for GBVM scripts with more than 999 lines - Fix issue preventing projects being created with the name "project" +- Fix issue preventing checkbox type working in engine fields [@pau-tomas](https://github.com/pau-tomas) - Fix UI palette text control code. Palette indices now go from 1 to 8, because zero byte is a string terminator [@untoxa](https://github.com/untoxa) - Fix issue where migrating old projects could cause gbvm symbols to become empty, preventing build from completing (opening a broken project will now automatically fix this issue) diff --git a/src/components/settings/EngineFieldsEditor.tsx b/src/components/settings/EngineFieldsEditor.tsx index 4660fdfcc..4a49ff124 100644 --- a/src/components/settings/EngineFieldsEditor.tsx +++ b/src/components/settings/EngineFieldsEditor.tsx @@ -124,14 +124,12 @@ export const EngineFieldInput: FC = ({ ); } if (field.type === "checkbox") { - const theValue = - typeof value === "boolean" ? Boolean(value) : Boolean(field.defaultValue); return ( onChange(e.currentTarget.checked)} + checked={value === 1 ? true : false} + onChange={(e) => onChange(e.currentTarget.checked === true ? 1 : 0)} /> ); } diff --git a/src/shared/lib/entities/entitiesTypes.ts b/src/shared/lib/entities/entitiesTypes.ts index 9f8f30a8c..a628e4710 100644 --- a/src/shared/lib/entities/entitiesTypes.ts +++ b/src/shared/lib/entities/entitiesTypes.ts @@ -333,7 +333,7 @@ export type CustomEventNormalized = Omit & { export type EngineFieldValue = { id: string; - value?: number | string | boolean | undefined; + value?: number | string | undefined; }; export type MetaspriteTile = { diff --git a/src/shared/lib/resources/types.ts b/src/shared/lib/resources/types.ts index 69d6fe432..3b155c56b 100644 --- a/src/shared/lib/resources/types.ts +++ b/src/shared/lib/resources/types.ts @@ -715,9 +715,7 @@ export type VariablesResource = Static; export const EngineFieldValueData = Type.Object({ id: Type.String(), - value: Type.Optional( - Type.Union([Type.String(), Type.Boolean(), Type.Number()]) - ), + value: Type.Optional(Type.Union([Type.String(), Type.Number()])), }); export type EngineFieldValueData = Static; diff --git a/src/store/features/entities/entitiesState.ts b/src/store/features/entities/entitiesState.ts index 4f4c2fe3f..9b479de95 100644 --- a/src/store/features/entities/entitiesState.ts +++ b/src/store/features/entities/entitiesState.ts @@ -4171,7 +4171,7 @@ const editEngineFieldValue: CaseReducer< EntitiesState, PayloadAction<{ engineFieldId: string; - value: string | number | boolean | undefined; + value: string | number | undefined; }> > = (state, action) => { engineFieldValuesAdapter.upsertOne(state.engineFieldValues, {