Browse Source

Add useMapBounds to SummaryMap

Kirk Trombley 4 years ago
parent
commit
b37c81b1b4

+ 4 - 0
client/src/components/screens/GameSummary/SummaryMap/SummaryMap.jsx

@@ -1,8 +1,10 @@
 import { useEffect, useRef, useState } from 'react';
 import flagLookup from '../../../../domain/flagLookup';
 import useMap from '../../../../hooks/useMap';
+import { useGameConfig } from '../../../../hooks/useGameInfo';
 import useMarkersFromGuesses from '../../../../hooks/useMarkersFromGuesses';
 import styles from './SummaryMap.module.css';
+import useMapBounds from '../../../../hooks/useMapBounds';
 
 const RoundSelect = ({ rounds, coords, selected, onSelect }) => (
   <div className={styles.tabs}>
@@ -25,10 +27,12 @@ const RoundSelect = ({ rounds, coords, selected, onSelect }) => (
 const SummaryMap = ({ players, coords }) => {
   const rounds = Object.keys(coords).length;
   const singleRound = rounds === 1;
+  const { countryLock } = useGameConfig();
 
   // create the map
   const mapDivRef = useRef(null);
   const mapRef = useMap(mapDivRef, 0, 0, 1);
+  useMapBounds(mapRef, countryLock);
 
   // set up round number selection
   const [ roundNum, setRoundNum ] = useState('0');