-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
Hey all, I'm evaluating using this project for a small demo.
I'm using this code, where marker and coords are identical objects.
<Map
token={process.env.REACT_APP_MAPKIT_KEY || ""}
initialRegion={{
centerLatitude: coords.lat,
centerLongitude: coords.lng,
latitudeDelta: 0.2,
longitudeDelta: 0.2
}}
cameraBoundary={{
centerLatitude: coords.lat,
centerLongitude: coords.lng,
latitudeDelta: 0.2,
longitudeDelta: 0.2
}}
>
{marker && <Marker
latitude={marker.lat}
longitude={marker.lng}
title={marker.location}
/>}
</Map>The Map is part of a flexbox component that looks roughly like;
._____________________.
| MAP HERE | |
|----------| |
|__________|__________|
Whenever I update coordinates with cameraBoundary, the map always centers on the bottom left of the boundary area.
Something I noticed when inspecting the HTML;
<div class="mk-map-view mk-disable-all-gestures" style="position: relative;">
<canvas width="1122" height="494" class="syrup-canvas" aria-hidden="true" style="width: 561px; height: 247px; background-color: rgb(249, 245, 237);"></canvas>
<canvas class="rt-root" lang="en-US" dir="ltr" aria-hidden="true" width="1122" height="494" style="width: 561px; height: 247px;"></canvas>
<div class="mk-map-node-element" style="width: 561px; height: 247px;">
<div class="mk-annotation-container" lang="en-US"></div>
<div class="mk-controls-container" lang="en-US" style="inset: 0px;"></div>
</div>
</div>You'll notice the canvas width and height values are double the style values. My window.devicePixelRatio setting is set to 2, and I think this may be related to the cause.
Any chance y'all can fix this? I'm happy to just use the default MapKit library but this seemed like a neat and simple solution.
BrianHung
Metadata
Metadata
Assignees
Labels
No labels