-
- No map integration library loaded - use @wq/leaflet or
- @wq/map-gl.
-
+
No map integration library loaded - install @wq/map-gl.
{children}
);
diff --git a/packages/map/src/components/MapProvider.js b/packages/map/src/components/MapProvider.js
new file mode 100644
index 00000000..fbee249b
--- /dev/null
+++ b/packages/map/src/components/MapProvider.js
@@ -0,0 +1,3 @@
+import { Fragment } from "react";
+
+export default Fragment;
diff --git a/packages/map/src/components/MapToolbar.js b/packages/map/src/components/MapToolbar.js
index 9fb6f16d..fc4d59b2 100644
--- a/packages/map/src/components/MapToolbar.js
+++ b/packages/map/src/components/MapToolbar.js
@@ -1,10 +1,9 @@
import React from "react";
import PropTypes from "prop-types";
import { useComponents } from "@wq/react";
-import { useMapInstance } from "../hooks";
export default function MapToolbar({
- name,
+ mapId,
overlays,
basemaps,
showOverlay,
@@ -12,9 +11,15 @@ export default function MapToolbar({
setBasemap,
children,
}) {
- const { SidePanel, List, ListSubheader, OverlayToggle, BasemapToggle } =
- useComponents(),
- map = useMapInstance(name),
+ const {
+ SidePanel,
+ List,
+ ListSubheader,
+ OverlayToggle,
+ BasemapToggle,
+ useMapInstance,
+ } = useComponents(),
+ map = useMapInstance(mapId),
hasMultipleOverlays =
overlays &&
(overlays.length > 1 || overlays.some((conf) => conf.legend)),
@@ -73,7 +78,7 @@ export default function MapToolbar({
}
MapToolbar.propTypes = {
- name: PropTypes.string,
+ mapId: PropTypes.string,
overlays: PropTypes.arrayOf(PropTypes.object),
basemaps: PropTypes.arrayOf(PropTypes.object),
showOverlay: PropTypes.func,
diff --git a/packages/map/src/components/OffscreenMaps.js b/packages/map/src/components/OffscreenMaps.js
deleted file mode 100644
index 63a48698..00000000
--- a/packages/map/src/components/OffscreenMaps.js
+++ /dev/null
@@ -1,85 +0,0 @@
-import React, { useEffect } from "react";
-import { useComponents, usePluginReducer } from "@wq/react";
-import { makeStyles } from "@material-ui/core/styles";
-import { createReparentableSpace } from "react-reparenting";
-
-const { Reparentable, sendReparentableChild } = createReparentableSpace();
-
-export { Reparentable };
-
-const OFFSCREEN_ID = "offscreen-maps";
-
-const useStyles = makeStyles({
- offscreen: {
- "&> *": {
- position: "absolute !important",
- top: "-2000px !important",
- width: "100vw",
- height: "calc(100vh - 120px)",
- },
- },
-});
-
-export function moveOffscreen(mapId) {
- sendReparentableChild(mapId, OFFSCREEN_ID, mapId, 0);
-}
-
-export default function OffscreenMaps() {
- const { AutoMap } = useComponents(),
- classes = useStyles();
- const [{ mapId, stickyMaps, stickyMapId }, { setStickyMapId }] =
- usePluginReducer("map");
-
- useEffect(() => {
- if ((!mapId && !stickyMapId) || mapId === stickyMapId) {
- return;
- }
-
- if (stickyMapId) {
- moveOffscreen(stickyMapId);
- }
-
- if (
- mapId &&
- stickyMaps &&
- stickyMaps[mapId] &&
- stickyMaps[mapId].props
- ) {
- sendReparentableChild(OFFSCREEN_ID, mapId, mapId, 0);
- setStickyMapId(mapId);
- } else {
- setStickyMapId(null);
- }
- }, [mapId, stickyMapId, stickyMaps]);
-
- return (
-