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