Added map context to scale simplification by map scale

Added distance to quadratic functions to vector
This commit is contained in:
Mitchell McCaffrey
2020-04-29 18:21:44 +10:00
parent 3e5a80e7d1
commit 9975f564fa
6 changed files with 170 additions and 48 deletions

View File

@@ -2,6 +2,8 @@ import React, { useRef, useEffect } from "react";
import { Box } from "theme-ui";
import interact from "interactjs";
import { MapInteractionProvider } from "../../contexts/MapInteractionContext";
const zoomSpeed = -0.005;
const minZoom = 0.1;
const maxZoom = 5;
@@ -134,7 +136,14 @@ function MapInteraction({ map, aspectRatio, isEnabled, children, controls }) {
paddingBottom: `${(1 / aspectRatio) * 100}%`,
}}
/>
{children}
<MapInteractionProvider
value={{
translateRef: mapTranslateRef,
scaleRef: mapScaleRef,
}}
>
{children}
</MapInteractionProvider>
</Box>
</Box>
{controls}