From 0b8746fe9f325c8b63df7b5d99341d1265c0d488 Mon Sep 17 00:00:00 2001 From: Bill Date: Thu, 24 Mar 2022 13:15:21 -0400 Subject: [PATCH] Fix wired check boxes --- .../actions/WiredActionSetFurniStateToView.tsx | 12 ++++++------ .../WiredConditionFurniMatchesSnapshotView.tsx | 14 ++++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/components/wired/views/actions/WiredActionSetFurniStateToView.tsx b/src/components/wired/views/actions/WiredActionSetFurniStateToView.tsx index 8916de4a..96261ddc 100644 --- a/src/components/wired/views/actions/WiredActionSetFurniStateToView.tsx +++ b/src/components/wired/views/actions/WiredActionSetFurniStateToView.tsx @@ -7,9 +7,9 @@ import { WiredActionBaseView } from './WiredActionBaseView'; export const WiredActionSetFurniStateToView: FC<{}> = props => { - const [ stateFlag, setStateFlag ] = useState(-1); - const [ directionFlag, setDirectionFlag ] = useState(-1); - const [ positionFlag, setPositionFlag ] = useState(-1); + const [ stateFlag, setStateFlag ] = useState(0); + const [ directionFlag, setDirectionFlag ] = useState(0); + const [ positionFlag, setPositionFlag ] = useState(0); const { trigger = null, setIntParams = null } = useWiredContext(); const save = () => setIntParams([ stateFlag, directionFlag, positionFlag ]); @@ -29,15 +29,15 @@ export const WiredActionSetFurniStateToView: FC<{}> = props => { LocalizeText('wiredfurni.params.conditions') } - setStateFlag(event.target.checked ? 1 : 0) } /> + setStateFlag(event.target.checked ? 1 : 0) } /> { LocalizeText('wiredfurni.params.condition.state') } - setDirectionFlag(event.target.checked ? 1 : 0) } /> + setDirectionFlag(event.target.checked ? 1 : 0) } /> { LocalizeText('wiredfurni.params.condition.direction') } - setPositionFlag(event.target.checked ? 1 : 0) } /> + setPositionFlag(event.target.checked ? 1 : 0) } /> { LocalizeText('wiredfurni.params.condition.position') } diff --git a/src/components/wired/views/conditions/WiredConditionFurniMatchesSnapshotView.tsx b/src/components/wired/views/conditions/WiredConditionFurniMatchesSnapshotView.tsx index 74420669..646a7c14 100644 --- a/src/components/wired/views/conditions/WiredConditionFurniMatchesSnapshotView.tsx +++ b/src/components/wired/views/conditions/WiredConditionFurniMatchesSnapshotView.tsx @@ -7,9 +7,9 @@ import { WiredConditionBaseView } from './WiredConditionBaseView'; export const WiredConditionFurniMatchesSnapshotView: FC<{}> = props => { - const [ stateFlag, setStateFlag ] = useState(-1); - const [ directionFlag, setDirectionFlag ] = useState(-1); - const [ positionFlag, setPositionFlag ] = useState(-1); + const [ stateFlag, setStateFlag ] = useState(0); + const [ directionFlag, setDirectionFlag ] = useState(0); + const [ positionFlag, setPositionFlag ] = useState(0); const { trigger = null, setIntParams = null } = useWiredContext(); const save = () => setIntParams([ stateFlag, directionFlag, positionFlag ]); @@ -23,21 +23,23 @@ export const WiredConditionFurniMatchesSnapshotView: FC<{}> = props => setPositionFlag(trigger.getBoolean(2) ? 1 : 0); }); }, [ trigger ]); + + console.log(stateFlag, directionFlag, positionFlag); return ( { LocalizeText('wiredfurni.params.conditions') } - setStateFlag(event.target.checked ? 1 : 0) } /> + setStateFlag(event.target.checked ? 1 : 0) } /> { LocalizeText('wiredfurni.params.condition.state') } - setDirectionFlag(event.target.checked ? 1 : 0) } /> + setDirectionFlag(event.target.checked ? 1 : 0) } /> { LocalizeText('wiredfurni.params.condition.direction') } - setPositionFlag(event.target.checked ? 1 : 0) } /> + setPositionFlag(event.target.checked ? 1 : 0) } /> { LocalizeText('wiredfurni.params.condition.position') }