4CBMNZWFOZRTXXNX2GWVFHVYXZGCFCJEJJZGM6O73LLW5A7RZKWAC
DNNKTYMMT2SXGZDMTFYZOQPZ3IX5EF6ESQAMGO5UUDFUA44FXMGAC
DPJCZOPIKAKQIS4YRXETBSJA5ZTL2KQESSJE2TEZFLRQARXUVFXQC
EMED7UWAGESRTWJJWVXRL27O4XMBGZDDAU4LNVF3MQAYKFKRDNXQC
HXHNGFB2VCXB6YXDND35HJI22GBJC3QTSUR2TK3M3LXGJHVNXVHAC
Y7VEWZEPUKX2WWPTQCUSIF7YMRUC6JZQNUU5OX3HQDB4GSDSTQZAC
OPUQ6NVYM2BN4H2FENH6EBGVU25XQBY2GRRZANPZEBEACZMDOGEAC
6EXHALB3E5HP3IQVC47M4RVZE2JERJHX37GOOHPYIVAFBWSWUX7QC
const handleFocusedNodeChange = useCallback(
(selection: PointNodeRef) => {
console.log("GOT TO on node change callback ", selection);
setGame((game) => {
game.playerUI.selectedPointNode = selection;
return { ...game };
const updateGameState = useCallback(
(updater: (oldGameState: GameState) => GameState) => {
console.log("fancy update");
setGame((oldGameState) => {
let newGameState = updater(oldGameState);
return { ...newGameState };
},
[setGame]
);
}, [setGame]);
const updateSelectedPointNode = (updater: (old: PointNodeRef | undefined, oldState: GameState) => PointNodeRef) => {
updateGameState(oldGameState => {
oldGameState.playerUI.selectedPointNode =
updater(oldGameState.playerUI.selectedPointNode, oldGameState);
return oldGameState;
})
}
const setSelectedPointNode = (newSelectedPointNode: PointNodeRef) => updateSelectedPointNode(() => newSelectedPointNode);