Skip to content

Commit

Permalink
Added world size iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenwf committed Apr 2, 2024
1 parent b6e9aef commit 42594a6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/modules/react-reconciler/Atlas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export const Atlas: React.FC<
// Used to instantiate the controller and viewer with the correct HTML element.
const [isReady, setIsReady] = useState(false);
const strictModeDoubleRender = useRef(false);
const [worldSizeIteration, setWorldSizeIteration] = useState(0);

const renderPreset = useMemo<PresetNames | Presets>(() => {
if (typeof _renderPreset === 'string') {
Expand Down Expand Up @@ -275,7 +276,7 @@ export const Atlas: React.FC<
}
}
}
}, [preset, bounds.height, bounds.width, homeCover]);
}, [preset, bounds.height, bounds.width, homeCover, worldSizeIteration]);

// When the window resizes we need to recalculate the width.
// @todo possibly move to controller.
Expand Down Expand Up @@ -326,6 +327,7 @@ export const Atlas: React.FC<
if (type === 'recalculate-world-size') {
recalculateNavigatorDimensions();
rt.resize(viewport.current.width, restProps.width, viewport.current.height, restProps.height);
setWorldSizeIteration((n) => n + 1);
}
});
}
Expand Down

0 comments on commit 42594a6

Please sign in to comment.