Moved to global image source manager to allow resource sharing

This commit is contained in:
Mitchell McCaffrey
2021-03-12 17:35:26 +11:00
parent b6c6d9b553
commit 5231d14937
11 changed files with 231 additions and 110 deletions

View File

@@ -1,7 +1,8 @@
import React, { useEffect, useState } from "react";
import useImage from "use-image";
import useDataSource from "../../hooks/useDataSource";
import { useImageSource } from "../../contexts/ImageSourceContext";
import { mapSources as defaultMapSources } from "../../maps";
import { getImageLightness } from "../../helpers/image";
@@ -17,7 +18,7 @@ function MapGrid({ map }) {
mapSourceMap = map.resolutions[resolutionArray[0]];
}
}
const mapSource = useDataSource(mapSourceMap, defaultMapSources);
const mapSource = useImageSource(mapSourceMap, defaultMapSources);
const [mapImage, mapLoadingStatus] = useImage(mapSource);
const [isImageLight, setIsImageLight] = useState(true);