mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-23 06:40:50 +01:00
Fix dimmer again
This commit is contained in:
parent
34ad458f87
commit
7ee1a68987
@ -55,16 +55,8 @@ export const FurnitureDimmerView: FC<{}> = props =>
|
||||
|
||||
BatchUpdates(() =>
|
||||
{
|
||||
let prevDimmerState = 0;
|
||||
|
||||
setDimmerState(prevValue =>
|
||||
{
|
||||
setLastDimmerState(prevValue);
|
||||
|
||||
return widgetEvent.state;
|
||||
});
|
||||
|
||||
setLastDimmerState(prevDimmerState);
|
||||
setLastDimmerState(dimmerState);
|
||||
setDimmerState(widgetEvent.state);
|
||||
setSelectedPresetId(widgetEvent.presetId);
|
||||
setEffectId(widgetEvent.effectId);
|
||||
setSelectedEffectId(widgetEvent.effectId);
|
||||
@ -73,10 +65,11 @@ export const FurnitureDimmerView: FC<{}> = props =>
|
||||
setBrightness(widgetEvent.brightness);
|
||||
setSelectedBrightness(widgetEvent.brightness);
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
}, [ dimmerState ]);
|
||||
|
||||
CreateEventDispatcherHook(RoomWidgetUpdateDimmerEvent.PRESETS, eventDispatcher, onNitroEvent);
|
||||
CreateEventDispatcherHook(RoomWidgetUpdateDimmerEvent.HIDE, eventDispatcher, onNitroEvent);
|
||||
@ -144,6 +137,8 @@ export const FurnitureDimmerView: FC<{}> = props =>
|
||||
{
|
||||
if((dimmerState === 0) && (lastDimmerState === 0)) return;
|
||||
|
||||
console.log('ye')
|
||||
|
||||
widgetHandler.processWidgetMessage(new RoomWidgetDimmerPreviewMessage(selectedColor, selectedBrightness, (selectedEffectId === 2)));
|
||||
}, [ widgetHandler, dimmerState, lastDimmerState, selectedColor, selectedBrightness, selectedEffectId ]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user