Skip to content

Commit

Permalink
fix bug (#356)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas Thrane authored and GitHub committed Apr 22, 2024
1 parent 21e89f6 commit 831f6ef
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions frontend/src/components/homeComponents/homeGlobe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ export default function SatelliteGlobe() {
globeRef.current.controls().enablePan = false;
globeRef.current.controls().enableRotate = true;

const setGlobeSize = () => {
// lock the initial height of the globe
const setInitialGlobeSize = () => {
if (globeRef.current && chart.current) {
const { width, height } =
chart.current.getBoundingClientRect();
Expand All @@ -68,7 +69,15 @@ export default function SatelliteGlobe() {
};

// Initially set the globe size to match the container
setGlobeSize();
setInitialGlobeSize();

// set globesize on screen resize
const setGlobeSize = () => {
if (globeRef.current && chart.current) {
const { width } = chart.current.getBoundingClientRect();
globeRef.current.width(width);
}
};

// Resize listener to update the globe size
if (typeof window !== "undefined") {
Expand Down

0 comments on commit 831f6ef

Please sign in to comment.