@lugg/maps 0.2.0-alpha.15 → 0.2.0-alpha.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/luggmaps/LuggGoogleMapView.kt +4 -3
- package/ios/LuggAppleMapView.mm +5 -3
- package/ios/LuggGoogleMapView.mm +8 -6
- package/lib/module/MapView.js +2 -2
- package/lib/module/MapView.js.map +1 -1
- package/lib/module/MapView.web.js +89 -44
- package/lib/module/MapView.web.js.map +1 -1
- package/lib/typescript/src/MapView.d.ts +1 -1
- package/lib/typescript/src/MapView.d.ts.map +1 -1
- package/lib/typescript/src/MapView.types.d.ts +2 -2
- package/lib/typescript/src/MapView.types.d.ts.map +1 -1
- package/lib/typescript/src/MapView.web.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/MapView.tsx +2 -2
- package/src/MapView.types.ts +2 -2
- package/src/MapView.web.tsx +118 -43
|
@@ -291,7 +291,7 @@ class LuggGoogleMapView(private val reactContext: ThemedReactContext) :
|
|
|
291
291
|
|
|
292
292
|
private fun addMarkerViewToMap(markerView: LuggMarkerView) {
|
|
293
293
|
val map = googleMap ?: run {
|
|
294
|
-
RNLog.w(reactContext, "
|
|
294
|
+
RNLog.w(reactContext, "LuggMaps: addMarkerViewToMap called without a map")
|
|
295
295
|
return
|
|
296
296
|
}
|
|
297
297
|
|
|
@@ -380,7 +380,7 @@ class LuggGoogleMapView(private val reactContext: ThemedReactContext) :
|
|
|
380
380
|
if (value.isNullOrEmpty()) return
|
|
381
381
|
|
|
382
382
|
if (mapView != null) {
|
|
383
|
-
RNLog.w(reactContext, "
|
|
383
|
+
RNLog.w(reactContext, "LuggMaps: mapId cannot be changed after map is initialized")
|
|
384
384
|
return
|
|
385
385
|
}
|
|
386
386
|
|
|
@@ -450,7 +450,8 @@ class LuggGoogleMapView(private val reactContext: ThemedReactContext) :
|
|
|
450
450
|
fun moveCamera(latitude: Double, longitude: Double, zoom: Double, duration: Int) {
|
|
451
451
|
val map = googleMap ?: return
|
|
452
452
|
val position = LatLng(latitude, longitude)
|
|
453
|
-
val
|
|
453
|
+
val targetZoom = if (zoom > 0) zoom.toFloat() else map.cameraPosition.zoom
|
|
454
|
+
val cameraUpdate = CameraUpdateFactory.newLatLngZoom(position, targetZoom)
|
|
454
455
|
when {
|
|
455
456
|
duration < 0 -> map.animateCamera(cameraUpdate)
|
|
456
457
|
duration > 0 -> map.animateCamera(cameraUpdate, duration, null)
|
package/ios/LuggAppleMapView.mm
CHANGED
|
@@ -537,16 +537,18 @@ using namespace luggmaps::events;
|
|
|
537
537
|
return;
|
|
538
538
|
}
|
|
539
539
|
|
|
540
|
+
double targetZoom = zoom > 0 ? zoom : _mapView.zoomLevel;
|
|
541
|
+
|
|
540
542
|
if (duration < 0) {
|
|
541
543
|
[self setCameraWithLatitude:latitude
|
|
542
544
|
longitude:longitude
|
|
543
|
-
zoom:
|
|
545
|
+
zoom:targetZoom
|
|
544
546
|
animated:YES];
|
|
545
547
|
} else if (duration > 0) {
|
|
546
548
|
CLLocationCoordinate2D center =
|
|
547
549
|
CLLocationCoordinate2DMake(latitude, longitude);
|
|
548
550
|
MKCoordinateRegion region = [_mapView regionForCenterCoordinate:center
|
|
549
|
-
zoomLevel:
|
|
551
|
+
zoomLevel:targetZoom];
|
|
550
552
|
[UIView animateWithDuration:duration / 1000.0
|
|
551
553
|
animations:^{
|
|
552
554
|
[self->_mapView setRegion:region animated:NO];
|
|
@@ -554,7 +556,7 @@ using namespace luggmaps::events;
|
|
|
554
556
|
} else {
|
|
555
557
|
[self setCameraWithLatitude:latitude
|
|
556
558
|
longitude:longitude
|
|
557
|
-
zoom:
|
|
559
|
+
zoom:targetZoom
|
|
558
560
|
animated:NO];
|
|
559
561
|
}
|
|
560
562
|
}
|
package/ios/LuggGoogleMapView.mm
CHANGED
|
@@ -245,8 +245,10 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
|
|
|
245
245
|
marker.zIndex = (int)markerView.zIndex;
|
|
246
246
|
if (markerView.hasCustomView) {
|
|
247
247
|
UIView *iconView = markerView.iconView;
|
|
248
|
-
|
|
249
|
-
|
|
248
|
+
if (marker.iconView != iconView) {
|
|
249
|
+
[iconView removeFromSuperview];
|
|
250
|
+
marker.iconView = iconView;
|
|
251
|
+
}
|
|
250
252
|
marker.groundAnchor = markerView.anchor;
|
|
251
253
|
} else {
|
|
252
254
|
marker.iconView = nil;
|
|
@@ -396,10 +398,10 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
|
|
|
396
398
|
return;
|
|
397
399
|
}
|
|
398
400
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
401
|
+
float targetZoom = zoom > 0 ? (float)zoom : _mapView.camera.zoom;
|
|
402
|
+
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:latitude
|
|
403
|
+
longitude:longitude
|
|
404
|
+
zoom:targetZoom];
|
|
403
405
|
if (duration < 0) {
|
|
404
406
|
[_mapView animateToCameraPosition:camera];
|
|
405
407
|
} else if (duration > 0) {
|
package/lib/module/MapView.js
CHANGED
|
@@ -25,9 +25,9 @@ export class MapView extends React.Component {
|
|
|
25
25
|
const ref = this.nativeRef.current;
|
|
26
26
|
if (!ref) return;
|
|
27
27
|
const {
|
|
28
|
-
zoom,
|
|
28
|
+
zoom = 0,
|
|
29
29
|
duration = -1
|
|
30
|
-
} = options;
|
|
30
|
+
} = options ?? {};
|
|
31
31
|
this.nativeCommands.moveCamera(ref, coordinate.latitude, coordinate.longitude, zoom, duration);
|
|
32
32
|
}
|
|
33
33
|
fitCoordinates(coordinates, options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Platform","StyleSheet","LuggGoogleMapViewNativeComponent","Commands","GoogleMapCommands","LuggAppleMapViewNativeComponent","AppleMapCommands","LuggMapWrapperViewNativeComponent","jsx","_jsx","jsxs","_jsxs","MapView","Component","defaultProps","provider","OS","initialZoom","zoomEnabled","scrollEnabled","rotateEnabled","pitchEnabled","nativeRef","createRef","nativeCommands","props","isApple","moveCamera","coordinate","options","ref","current","zoom","duration","latitude","longitude","fitCoordinates","coordinates","first","padding","top","left","bottom","right","length","render","mapId","initialCoordinate","minZoom","maxZoom","userLocationEnabled","onCameraMove","onCameraIdle","onReady","children","rest","NativeMapView","style","absoluteFill"],"sourceRoot":"../../src","sources":["MapView.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AACnD,OAAOC,gCAAgC,IACrCC,QAAQ,IAAIC,iBAAiB,QACxB,2CAA2C;AAClD,OAAOC,+BAA+B,IACpCF,QAAQ,IAAIG,gBAAgB,QACvB,0CAA0C;AACjD,OAAOC,iCAAiC,MAAM,4CAA4C;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAS3F,OAAO,MAAMC,OAAO,SACVb,KAAK,CAACc,SAAS,CAEzB;EACE,OAAOC,YAAY,GAA0B;IAC3CC,QAAQ,EAAEf,QAAQ,CAACgB,EAAE,KAAK,KAAK,GAAG,OAAO,GAAG,QAAQ;IACpDC,WAAW,EAAE,EAAE;IACfC,WAAW,EAAE,IAAI;IACjBC,aAAa,EAAE,IAAI;IACnBC,aAAa,EAAE,IAAI;IACnBC,YAAY,EAAE;EAChB,CAAC;EAEOC,SAAS,gBAAGvB,KAAK,CAACwB,SAAS,CAAM,CAAC;EAE1C,IAAYC,cAAcA,CAAA,EAAG;IAC3B,MAAMT,QAAQ,GAAG,IAAI,CAACU,KAAK,CAACV,QAAQ,IAAIH,OAAO,CAACE,YAAY,CAACC,QAAQ;IACrE,MAAMW,OAAO,GAAG1B,QAAQ,CAACgB,EAAE,KAAK,KAAK,IAAID,QAAQ,KAAK,OAAO;IAC7D,OAAOW,OAAO,GAAGpB,gBAAgB,GAAGF,iBAAiB;EACvD;EAEAuB,UAAUA,CAACC,UAAsB,EAAEC,
|
|
1
|
+
{"version":3,"names":["React","Platform","StyleSheet","LuggGoogleMapViewNativeComponent","Commands","GoogleMapCommands","LuggAppleMapViewNativeComponent","AppleMapCommands","LuggMapWrapperViewNativeComponent","jsx","_jsx","jsxs","_jsxs","MapView","Component","defaultProps","provider","OS","initialZoom","zoomEnabled","scrollEnabled","rotateEnabled","pitchEnabled","nativeRef","createRef","nativeCommands","props","isApple","moveCamera","coordinate","options","ref","current","zoom","duration","latitude","longitude","fitCoordinates","coordinates","first","padding","top","left","bottom","right","length","render","mapId","initialCoordinate","minZoom","maxZoom","userLocationEnabled","onCameraMove","onCameraIdle","onReady","children","rest","NativeMapView","style","absoluteFill"],"sourceRoot":"../../src","sources":["MapView.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AACnD,OAAOC,gCAAgC,IACrCC,QAAQ,IAAIC,iBAAiB,QACxB,2CAA2C;AAClD,OAAOC,+BAA+B,IACpCF,QAAQ,IAAIG,gBAAgB,QACvB,0CAA0C;AACjD,OAAOC,iCAAiC,MAAM,4CAA4C;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAS3F,OAAO,MAAMC,OAAO,SACVb,KAAK,CAACc,SAAS,CAEzB;EACE,OAAOC,YAAY,GAA0B;IAC3CC,QAAQ,EAAEf,QAAQ,CAACgB,EAAE,KAAK,KAAK,GAAG,OAAO,GAAG,QAAQ;IACpDC,WAAW,EAAE,EAAE;IACfC,WAAW,EAAE,IAAI;IACjBC,aAAa,EAAE,IAAI;IACnBC,aAAa,EAAE,IAAI;IACnBC,YAAY,EAAE;EAChB,CAAC;EAEOC,SAAS,gBAAGvB,KAAK,CAACwB,SAAS,CAAM,CAAC;EAE1C,IAAYC,cAAcA,CAAA,EAAG;IAC3B,MAAMT,QAAQ,GAAG,IAAI,CAACU,KAAK,CAACV,QAAQ,IAAIH,OAAO,CAACE,YAAY,CAACC,QAAQ;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useImperativeHandle, useRef, useState } from 'react';
|
|
4
|
-
import { View
|
|
3
|
+
import { forwardRef, useCallback, useEffect, useId, useImperativeHandle, useRef, useState } from 'react';
|
|
4
|
+
import { View } from 'react-native';
|
|
5
5
|
import { Map, useMap } from '@vis.gl/react-google-maps';
|
|
6
6
|
import { Marker } from "./components/Marker.web.js";
|
|
7
7
|
import { MapIdContext } from "./MapProvider.web.js";
|
|
@@ -87,9 +87,34 @@ export const MapView = /*#__PURE__*/forwardRef(function MapView(props, ref) {
|
|
|
87
87
|
} = props;
|
|
88
88
|
const id = useId();
|
|
89
89
|
const map = useMap(id);
|
|
90
|
+
const containerRef = useRef(null);
|
|
90
91
|
const readyFired = useRef(false);
|
|
91
92
|
const isDragging = useRef(false);
|
|
92
93
|
const wasGesture = useRef(false);
|
|
94
|
+
const prevPadding = useRef(padding);
|
|
95
|
+
const offsetCenter = useCallback((coord, zoom, paddingOverride, reverse = false) => {
|
|
96
|
+
const p = paddingOverride ?? padding;
|
|
97
|
+
const div = map?.getDiv();
|
|
98
|
+
if (!p || !div) {
|
|
99
|
+
return {
|
|
100
|
+
lat: coord.latitude,
|
|
101
|
+
lng: coord.longitude
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
const dir = reverse ? -1 : 1;
|
|
105
|
+
const scale = 256 * Math.pow(2, zoom);
|
|
106
|
+
const offsetX = dir * ((p.right ?? 0) - (p.left ?? 0)) / 2;
|
|
107
|
+
const offsetY = dir * ((p.bottom ?? 0) - (p.top ?? 0)) / 2;
|
|
108
|
+
const latRad = coord.latitude * Math.PI / 180;
|
|
109
|
+
const x = (coord.longitude + 180) / 360 * scale + offsetX;
|
|
110
|
+
const y = (1 - Math.log(Math.tan(latRad) + 1 / Math.cos(latRad)) / Math.PI) / 2 * scale + offsetY;
|
|
111
|
+
const lng = x / scale * 360 - 180;
|
|
112
|
+
const lat = Math.atan(Math.sinh(Math.PI * (1 - 2 * y / scale))) * 180 / Math.PI;
|
|
113
|
+
return {
|
|
114
|
+
lat,
|
|
115
|
+
lng
|
|
116
|
+
};
|
|
117
|
+
}, [map, padding]);
|
|
93
118
|
useImperativeHandle(ref, () => ({
|
|
94
119
|
moveCamera(coordinate, options) {
|
|
95
120
|
if (!map) return;
|
|
@@ -97,14 +122,12 @@ export const MapView = /*#__PURE__*/forwardRef(function MapView(props, ref) {
|
|
|
97
122
|
zoom,
|
|
98
123
|
duration = -1
|
|
99
124
|
} = options;
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
lng: coordinate.longitude
|
|
103
|
-
};
|
|
125
|
+
const targetZoom = zoom ?? map.getZoom() ?? initialZoom;
|
|
126
|
+
const center = offsetCenter(coordinate, targetZoom, undefined, false);
|
|
104
127
|
if (duration === 0) {
|
|
105
128
|
map.moveCamera({
|
|
106
129
|
center,
|
|
107
|
-
zoom
|
|
130
|
+
zoom: targetZoom
|
|
108
131
|
});
|
|
109
132
|
} else {
|
|
110
133
|
const currentZoom = map.getZoom();
|
|
@@ -137,19 +160,40 @@ export const MapView = /*#__PURE__*/forwardRef(function MapView(props, ref) {
|
|
|
137
160
|
});
|
|
138
161
|
});
|
|
139
162
|
map.fitBounds(bounds, {
|
|
140
|
-
top: fitPadding?.top ?? 0,
|
|
141
|
-
left: fitPadding?.left ?? 0,
|
|
142
|
-
bottom: fitPadding?.bottom ?? 0,
|
|
143
|
-
right: fitPadding?.right ?? 0
|
|
163
|
+
top: (padding?.top ?? 0) + (fitPadding?.top ?? 0),
|
|
164
|
+
left: (padding?.left ?? 0) + (fitPadding?.left ?? 0),
|
|
165
|
+
bottom: (padding?.bottom ?? 0) + (fitPadding?.bottom ?? 0),
|
|
166
|
+
right: (padding?.right ?? 0) + (fitPadding?.right ?? 0)
|
|
144
167
|
});
|
|
145
168
|
}
|
|
146
|
-
}), [map, initialZoom]);
|
|
169
|
+
}), [map, initialZoom, padding, offsetCenter]);
|
|
147
170
|
useEffect(() => {
|
|
148
171
|
if (map && !readyFired.current) {
|
|
149
172
|
readyFired.current = true;
|
|
150
173
|
onReady?.();
|
|
151
174
|
}
|
|
152
175
|
}, [map, onReady]);
|
|
176
|
+
useEffect(() => {
|
|
177
|
+
if (!map || !padding) return;
|
|
178
|
+
const prev = prevPadding.current;
|
|
179
|
+
const paddingChanged = prev?.top !== padding.top || prev?.left !== padding.left || prev?.bottom !== padding.bottom || prev?.right !== padding.right;
|
|
180
|
+
if (paddingChanged) {
|
|
181
|
+
const center = map.getCenter();
|
|
182
|
+
const zoom = map.getZoom() ?? initialZoom;
|
|
183
|
+
if (center) {
|
|
184
|
+
const logicalCenter = offsetCenter({
|
|
185
|
+
latitude: center.lat(),
|
|
186
|
+
longitude: center.lng()
|
|
187
|
+
}, zoom, prev, true);
|
|
188
|
+
const newCenter = offsetCenter({
|
|
189
|
+
latitude: logicalCenter.lat,
|
|
190
|
+
longitude: logicalCenter.lng
|
|
191
|
+
}, zoom, padding, false);
|
|
192
|
+
map.panTo(newCenter);
|
|
193
|
+
}
|
|
194
|
+
prevPadding.current = padding;
|
|
195
|
+
}
|
|
196
|
+
}, [map, padding, initialZoom, offsetCenter]);
|
|
153
197
|
const handleDragStart = () => {
|
|
154
198
|
isDragging.current = true;
|
|
155
199
|
wasGesture.current = true;
|
|
@@ -158,10 +202,14 @@ export const MapView = /*#__PURE__*/forwardRef(function MapView(props, ref) {
|
|
|
158
202
|
isDragging.current = false;
|
|
159
203
|
};
|
|
160
204
|
const handleCameraChanged = event => {
|
|
205
|
+
const logicalCenter = offsetCenter({
|
|
206
|
+
latitude: event.detail.center.lat,
|
|
207
|
+
longitude: event.detail.center.lng
|
|
208
|
+
}, event.detail.zoom, undefined, true);
|
|
161
209
|
const payload = {
|
|
162
210
|
coordinate: {
|
|
163
|
-
latitude:
|
|
164
|
-
longitude:
|
|
211
|
+
latitude: logicalCenter.lat,
|
|
212
|
+
longitude: logicalCenter.lng
|
|
165
213
|
},
|
|
166
214
|
zoom: event.detail.zoom,
|
|
167
215
|
gesture: isDragging.current
|
|
@@ -170,12 +218,17 @@ export const MapView = /*#__PURE__*/forwardRef(function MapView(props, ref) {
|
|
|
170
218
|
};
|
|
171
219
|
const handleIdle = event => {
|
|
172
220
|
const center = event.map.getCenter();
|
|
221
|
+
const zoom = event.map.getZoom() ?? 0;
|
|
222
|
+
const logicalCenter = offsetCenter({
|
|
223
|
+
latitude: center?.lat() ?? 0,
|
|
224
|
+
longitude: center?.lng() ?? 0
|
|
225
|
+
}, zoom, undefined, true);
|
|
173
226
|
const payload = {
|
|
174
227
|
coordinate: {
|
|
175
|
-
latitude:
|
|
176
|
-
longitude:
|
|
228
|
+
latitude: logicalCenter.lat,
|
|
229
|
+
longitude: logicalCenter.lng
|
|
177
230
|
},
|
|
178
|
-
zoom
|
|
231
|
+
zoom,
|
|
179
232
|
gesture: wasGesture.current
|
|
180
233
|
};
|
|
181
234
|
onCameraIdle?.(createSyntheticEvent(payload));
|
|
@@ -186,37 +239,29 @@ export const MapView = /*#__PURE__*/forwardRef(function MapView(props, ref) {
|
|
|
186
239
|
lat: initialCoordinate.latitude,
|
|
187
240
|
lng: initialCoordinate.longitude
|
|
188
241
|
} : undefined;
|
|
189
|
-
const paddingStyle = {
|
|
190
|
-
paddingTop: padding?.top ?? 0,
|
|
191
|
-
paddingLeft: padding?.left ?? 0,
|
|
192
|
-
paddingRight: padding?.right ?? 0,
|
|
193
|
-
paddingBottom: padding?.bottom ?? 0
|
|
194
|
-
};
|
|
195
242
|
return /*#__PURE__*/_jsx(MapIdContext.Provider, {
|
|
196
243
|
value: id,
|
|
197
244
|
children: /*#__PURE__*/_jsx(View, {
|
|
245
|
+
ref: containerRef,
|
|
198
246
|
style: style,
|
|
199
|
-
children: /*#__PURE__*/
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
enabled: userLocationEnabled
|
|
218
|
-
}), children]
|
|
219
|
-
})
|
|
247
|
+
children: /*#__PURE__*/_jsxs(Map, {
|
|
248
|
+
id: id,
|
|
249
|
+
mapId: mapId,
|
|
250
|
+
defaultCenter: defaultCenter,
|
|
251
|
+
defaultZoom: initialZoom,
|
|
252
|
+
minZoom: minZoom,
|
|
253
|
+
maxZoom: maxZoom,
|
|
254
|
+
gestureHandling: gestureHandling,
|
|
255
|
+
disableDefaultUI: true,
|
|
256
|
+
isFractionalZoomEnabled: true,
|
|
257
|
+
tilt: pitchEnabled === false ? 0 : undefined,
|
|
258
|
+
onDragstart: handleDragStart,
|
|
259
|
+
onDragend: handleDragEnd,
|
|
260
|
+
onCameraChanged: handleCameraChanged,
|
|
261
|
+
onIdle: handleIdle,
|
|
262
|
+
children: [/*#__PURE__*/_jsx(UserLocationMarker, {
|
|
263
|
+
enabled: userLocationEnabled
|
|
264
|
+
}), children]
|
|
220
265
|
})
|
|
221
266
|
})
|
|
222
267
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useEffect","useId","useImperativeHandle","useRef","useState","View","StyleSheet","Map","useMap","Marker","MapIdContext","jsx","_jsx","jsxs","_jsxs","createSyntheticEvent","nativeEvent","currentTarget","target","bubbles","cancelable","defaultPrevented","eventPhase","isTrusted","preventDefault","stopPropagation","isDefaultPrevented","isPropagationStopped","persist","timeStamp","Date","now","type","userLocationDotStyle","width","height","backgroundColor","border","borderRadius","boxShadow","UserLocationMarker","enabled","coordinate","setCoordinate","watchId","updateLocation","position","latitude","coords","longitude","navigator","geolocation","getCurrentPosition","watchPosition","clearWatch","anchor","x","y","children","style","MapView","props","ref","mapId","google","maps","DEMO_MAP_ID","initialCoordinate","initialZoom","minZoom","maxZoom","zoomEnabled","scrollEnabled","pitchEnabled","padding","userLocationEnabled","onCameraMove","onCameraIdle","onReady","id","map","readyFired","isDragging","wasGesture","moveCamera","options","zoom","duration","center","lat","lng","currentZoom","getZoom","zoomChanged","undefined","setZoom","panTo","fitCoordinates","coordinates","first","fitPadding","length","bounds","LatLngBounds","forEach","coord","extend","fitBounds","top","left","bottom","right","current","handleDragStart","handleDragEnd","handleCameraChanged","event","payload","detail","gesture","handleIdle","getCenter","gestureHandling","defaultCenter","paddingStyle","paddingTop","paddingLeft","paddingRight","paddingBottom","Provider","value","absoluteFill","defaultZoom","disableDefaultUI","isFractionalZoomEnabled","tilt","onDragstart","onDragend","onCameraChanged","onIdle"],"sourceRoot":"../../src","sources":["MapView.web.tsx"],"mappings":";;AAAA,SACEA,UAAU,EACVC,SAAS,EACTC,KAAK,EACLC,mBAAmB,EACnBC,MAAM,EACNC,QAAQ,QAEH,OAAO;AAEd,SAASC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AAC/C,SACEC,GAAG,EACHC,MAAM,QAGD,2BAA2B;AAClC,SAASC,MAAM,QAAQ,4BAAyB;AAChD,SAASC,YAAY,QAAQ,sBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAWjD,MAAMC,oBAAoB,GAAQC,WAAc,KAC7C;EACCA,WAAW;EACXC,aAAa,EAAE,IAAI;EACnBC,MAAM,EAAE,IAAI;EACZC,OAAO,EAAE,KAAK;EACdC,UAAU,EAAE,KAAK;EACjBC,gBAAgB,EAAE,KAAK;EACvBC,UAAU,EAAE,CAAC;EACbC,SAAS,EAAE,IAAI;EACfC,cAAc,EAAEA,CAAA,KAAM,CAAC,CAAC;EACxBC,eAAe,EAAEA,CAAA,KAAM,CAAC,CAAC;EACzBC,kBAAkB,EAAEA,CAAA,KAAM,KAAK;EAC/BC,oBAAoB,EAAEA,CAAA,KAAM,KAAK;EACjCC,OAAO,EAAEA,CAAA,KAAM,CAAC,CAAC;EACjBC,SAAS,EAAEC,IAAI,CAACC,GAAG,CAAC,CAAC;EACrBC,IAAI,EAAE;AACR,CAAC,CAAuC;AAE1C,MAAMC,oBAAmC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;UAC7BwB,SAAS,EAAEvB,aAAc;UACzBwB,eAAe,EAAEvB,mBAAoB;UACrCwB,MAAM,EAAEnB,UAAW;UAAA9D,QAAA,gBAEnB9C,IAAA,CAAC4B,kBAAkB;YAACC,OAAO,EAAEkC;UAAoB,CAAE,CAAC,EACnDjB,QAAQ;QAAA,CACN;MAAC,CACF;IAAC,CACH;EAAC,CACc,CAAC;AAE5B,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["forwardRef","useCallback","useEffect","useId","useImperativeHandle","useRef","useState","View","Map","useMap","Marker","MapIdContext","jsx","_jsx","jsxs","_jsxs","createSyntheticEvent","nativeEvent","currentTarget","target","bubbles","cancelable","defaultPrevented","eventPhase","isTrusted","preventDefault","stopPropagation","isDefaultPrevented","isPropagationStopped","persist","timeStamp","Date","now","type","userLocationDotStyle","width","height","backgroundColor","border","borderRadius","boxShadow","UserLocationMarker","enabled","coordinate","setCoordinate","watchId","updateLocation","position","latitude","coords","longitude","navigator","geolocation","getCurrentPosition","watchPosition","clearWatch","anchor","x","y","children","style","MapView","props","ref","mapId","google","maps","DEMO_MAP_ID","initialCoordinate","initialZoom","minZoom","maxZoom","zoomEnabled","scrollEnabled","pitchEnabled","padding","userLocationEnabled","onCameraMove","onCameraIdle","onReady","id","map","containerRef","readyFired","isDragging","wasGesture","prevPadding","offsetCenter","coord","zoom","paddingOverride","reverse","p","div","getDiv","lat","lng","dir","scale","Math","pow","offsetX","right","left","offsetY","bottom","top","latRad","PI","log","tan","cos","atan","sinh","moveCamera","options","duration","targetZoom","getZoom","center","undefined","currentZoom","zoomChanged","setZoom","panTo","fitCoordinates","coordinates","first","fitPadding","length","bounds","LatLngBounds","forEach","extend","fitBounds","current","prev","paddingChanged","getCenter","logicalCenter","newCenter","handleDragStart","handleDragEnd","handleCameraChanged","event","detail","payload","gesture","handleIdle","gestureHandling","defaultCenter","Provider","value","defaultZoom","disableDefaultUI","isFractionalZoomEnabled","tilt","onDragstart","onDragend","onCamera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E,EAAG;IAAArB,QAAA,eAC/B9C,IAAA,CAACN,IAAI;MAACwD,GAAG,EAAEmB,YAAa;MAACtB,KAAK,EAAEA,KAAM;MAAAD,QAAA,eACpC5C,KAAA,CAACP,GAAG;QACFwE,EAAE,EAAEA,EAAG;QACPhB,KAAK,EAAEA,KAAM;QACbsF,aAAa,EAAEA,aAAc;QAC7BG,WAAW,EAAEpF,WAAY;QACzBC,OAAO,EAAEA,OAAQ;QACjBC,OAAO,EAAEA,OAAQ;QACjB8E,eAAe,EAAEA,eAAgB;QACjCK,gBAAgB;QAChBC,uBAAuB;QACvBC,IAAI,EAAElF,YAAY,KAAK,KAAK,GAAG,CAAC,GAAG8C,SAAU;QAC7CqC,WAAW,EAAEhB,eAAgB;QAC7BiB,SAAS,EAAEhB,aAAc;QACzBiB,eAAe,EAAEhB,mBAAoB;QACrCiB,MAAM,EAAEZ,UAAW;QAAAzF,QAAA,gBAEnB9C,IAAA,CAAC4B,kBAAkB;UAACC,OAAO,EAAEkC;QAAoB,CAAE,CAAC,EACnDjB,QAAQ;MAAA,CACN;IAAC,CACF;EAAC,CACc,CAAC;AAE5B,CAAC,CAAC","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ export declare class MapView extends React.Component<MapViewProps> implements Ma
|
|
|
5
5
|
static defaultProps: Partial<MapViewProps>;
|
|
6
6
|
private nativeRef;
|
|
7
7
|
private get nativeCommands();
|
|
8
|
-
moveCamera(coordinate: Coordinate, options
|
|
8
|
+
moveCamera(coordinate: Coordinate, options?: MoveCameraOptions): void;
|
|
9
9
|
fitCoordinates(coordinates: Coordinate[], options?: FitCoordinatesOptions): void;
|
|
10
10
|
render(): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapView.d.ts","sourceRoot":"","sources":["../../../src/MapView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,qBAAa,OACX,SAAQ,KAAK,CAAC,SAAS,CAAC,YAAY,CACpC,YAAW,UAAU;IAErB,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,CAOxC;IAEF,OAAO,CAAC,SAAS,CAA0B;IAE3C,OAAO,KAAK,cAAc,GAIzB;IAED,UAAU,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,iBAAiB;
|
|
1
|
+
{"version":3,"file":"MapView.d.ts","sourceRoot":"","sources":["../../../src/MapView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,qBAAa,OACX,SAAQ,KAAK,CAAC,SAAS,CAAC,YAAY,CACpC,YAAW,UAAU;IAErB,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,CAOxC;IAEF,OAAO,CAAC,SAAS,CAA0B;IAE3C,OAAO,KAAK,cAAc,GAIzB;IAED,UAAU,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,iBAAiB;IAc9D,cAAc,CAAC,WAAW,EAAE,UAAU,EAAE,EAAE,OAAO,CAAC,EAAE,qBAAqB;IAyBzE,MAAM;CAkDP"}
|
|
@@ -6,7 +6,7 @@ import type { MapProvider, Coordinate, EdgeInsets } from './types';
|
|
|
6
6
|
* @default duration -1
|
|
7
7
|
*/
|
|
8
8
|
export interface MoveCameraOptions {
|
|
9
|
-
zoom
|
|
9
|
+
zoom?: number;
|
|
10
10
|
duration?: number;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
@@ -21,7 +21,7 @@ export interface FitCoordinatesOptions {
|
|
|
21
21
|
* MapView ref methods
|
|
22
22
|
*/
|
|
23
23
|
export interface MapViewRef {
|
|
24
|
-
moveCamera(coordinate: Coordinate, options
|
|
24
|
+
moveCamera(coordinate: Coordinate, options?: MoveCameraOptions): void;
|
|
25
25
|
fitCoordinates(coordinates: Coordinate[], options?: FitCoordinatesOptions): void;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapView.types.d.ts","sourceRoot":"","sources":["../../../src/MapView.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEnE;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"MapView.types.d.ts","sourceRoot":"","sources":["../../../src/MapView.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEnE;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,UAA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,CAAC,EAAE,SAAS,CAAC;CACtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapView.web.d.ts","sourceRoot":"","sources":["../../../src/MapView.web.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MapView.web.d.ts","sourceRoot":"","sources":["../../../src/MapView.web.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EAIX,MAAM,iBAAiB,CAAC;AAoEzB,eAAO,MAAM,OAAO,qGAiPlB,CAAC"}
|
package/package.json
CHANGED
package/src/MapView.tsx
CHANGED
|
@@ -36,11 +36,11 @@ export class MapView
|
|
|
36
36
|
return isApple ? AppleMapCommands : GoogleMapCommands;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
moveCamera(coordinate: Coordinate, options
|
|
39
|
+
moveCamera(coordinate: Coordinate, options?: MoveCameraOptions) {
|
|
40
40
|
const ref = this.nativeRef.current;
|
|
41
41
|
if (!ref) return;
|
|
42
42
|
|
|
43
|
-
const { zoom, duration = -1 } = options;
|
|
43
|
+
const { zoom = 0, duration = -1 } = options ?? {};
|
|
44
44
|
this.nativeCommands.moveCamera(
|
|
45
45
|
ref,
|
|
46
46
|
coordinate.latitude,
|
package/src/MapView.types.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { MapProvider, Coordinate, EdgeInsets } from './types';
|
|
|
7
7
|
* @default duration -1
|
|
8
8
|
*/
|
|
9
9
|
export interface MoveCameraOptions {
|
|
10
|
-
zoom
|
|
10
|
+
zoom?: number;
|
|
11
11
|
duration?: number;
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -24,7 +24,7 @@ export interface FitCoordinatesOptions {
|
|
|
24
24
|
* MapView ref methods
|
|
25
25
|
*/
|
|
26
26
|
export interface MapViewRef {
|
|
27
|
-
moveCamera(coordinate: Coordinate, options
|
|
27
|
+
moveCamera(coordinate: Coordinate, options?: MoveCameraOptions): void;
|
|
28
28
|
fitCoordinates(
|
|
29
29
|
coordinates: Coordinate[],
|
|
30
30
|
options?: FitCoordinatesOptions
|
package/src/MapView.web.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
forwardRef,
|
|
3
|
+
useCallback,
|
|
3
4
|
useEffect,
|
|
4
5
|
useId,
|
|
5
6
|
useImperativeHandle,
|
|
@@ -7,8 +8,8 @@ import {
|
|
|
7
8
|
useState,
|
|
8
9
|
type CSSProperties,
|
|
9
10
|
} from 'react';
|
|
10
|
-
import type { NativeSyntheticEvent
|
|
11
|
-
import { View
|
|
11
|
+
import type { NativeSyntheticEvent } from 'react-native';
|
|
12
|
+
import { View } from 'react-native';
|
|
12
13
|
import {
|
|
13
14
|
Map,
|
|
14
15
|
useMap,
|
|
@@ -116,9 +117,46 @@ export const MapView = forwardRef<MapViewRef, MapViewProps>(function MapView(
|
|
|
116
117
|
|
|
117
118
|
const id = useId();
|
|
118
119
|
const map = useMap(id);
|
|
120
|
+
const containerRef = useRef<View>(null);
|
|
119
121
|
const readyFired = useRef(false);
|
|
120
122
|
const isDragging = useRef(false);
|
|
121
123
|
const wasGesture = useRef(false);
|
|
124
|
+
const prevPadding = useRef(padding);
|
|
125
|
+
|
|
126
|
+
const offsetCenter = useCallback(
|
|
127
|
+
(
|
|
128
|
+
coord: Coordinate,
|
|
129
|
+
zoom: number,
|
|
130
|
+
paddingOverride?: typeof padding,
|
|
131
|
+
reverse = false
|
|
132
|
+
) => {
|
|
133
|
+
const p = paddingOverride ?? padding;
|
|
134
|
+
const div = map?.getDiv();
|
|
135
|
+
if (!p || !div) {
|
|
136
|
+
return { lat: coord.latitude, lng: coord.longitude };
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const dir = reverse ? -1 : 1;
|
|
140
|
+
const scale = 256 * Math.pow(2, zoom);
|
|
141
|
+
const offsetX = (dir * ((p.right ?? 0) - (p.left ?? 0))) / 2;
|
|
142
|
+
const offsetY = (dir * ((p.bottom ?? 0) - (p.top ?? 0))) / 2;
|
|
143
|
+
|
|
144
|
+
const latRad = (coord.latitude * Math.PI) / 180;
|
|
145
|
+
const x = ((coord.longitude + 180) / 360) * scale + offsetX;
|
|
146
|
+
const y =
|
|
147
|
+
((1 - Math.log(Math.tan(latRad) + 1 / Math.cos(latRad)) / Math.PI) /
|
|
148
|
+
2) *
|
|
149
|
+
scale +
|
|
150
|
+
offsetY;
|
|
151
|
+
|
|
152
|
+
const lng = (x / scale) * 360 - 180;
|
|
153
|
+
const lat =
|
|
154
|
+
(Math.atan(Math.sinh(Math.PI * (1 - (2 * y) / scale))) * 180) / Math.PI;
|
|
155
|
+
|
|
156
|
+
return { lat, lng };
|
|
157
|
+
},
|
|
158
|
+
[map, padding]
|
|
159
|
+
);
|
|
122
160
|
|
|
123
161
|
useImperativeHandle(
|
|
124
162
|
ref,
|
|
@@ -127,10 +165,11 @@ export const MapView = forwardRef<MapViewRef, MapViewProps>(function MapView(
|
|
|
127
165
|
if (!map) return;
|
|
128
166
|
|
|
129
167
|
const { zoom, duration = -1 } = options;
|
|
130
|
-
const
|
|
168
|
+
const targetZoom = zoom ?? map.getZoom() ?? initialZoom;
|
|
169
|
+
const center = offsetCenter(coordinate, targetZoom, undefined, false);
|
|
131
170
|
|
|
132
171
|
if (duration === 0) {
|
|
133
|
-
map.moveCamera({ center, zoom });
|
|
172
|
+
map.moveCamera({ center, zoom: targetZoom });
|
|
134
173
|
} else {
|
|
135
174
|
const currentZoom = map.getZoom();
|
|
136
175
|
const zoomChanged = zoom !== undefined && zoom !== currentZoom;
|
|
@@ -162,14 +201,14 @@ export const MapView = forwardRef<MapViewRef, MapViewProps>(function MapView(
|
|
|
162
201
|
});
|
|
163
202
|
|
|
164
203
|
map.fitBounds(bounds, {
|
|
165
|
-
top: fitPadding?.top ?? 0,
|
|
166
|
-
left: fitPadding?.left ?? 0,
|
|
167
|
-
bottom: fitPadding?.bottom ?? 0,
|
|
168
|
-
right: fitPadding?.right ?? 0,
|
|
204
|
+
top: (padding?.top ?? 0) + (fitPadding?.top ?? 0),
|
|
205
|
+
left: (padding?.left ?? 0) + (fitPadding?.left ?? 0),
|
|
206
|
+
bottom: (padding?.bottom ?? 0) + (fitPadding?.bottom ?? 0),
|
|
207
|
+
right: (padding?.right ?? 0) + (fitPadding?.right ?? 0),
|
|
169
208
|
});
|
|
170
209
|
},
|
|
171
210
|
}),
|
|
172
|
-
[map, initialZoom]
|
|
211
|
+
[map, initialZoom, padding, offsetCenter]
|
|
173
212
|
);
|
|
174
213
|
|
|
175
214
|
useEffect(() => {
|
|
@@ -179,6 +218,38 @@ export const MapView = forwardRef<MapViewRef, MapViewProps>(function MapView(
|
|
|
179
218
|
}
|
|
180
219
|
}, [map, onReady]);
|
|
181
220
|
|
|
221
|
+
useEffect(() => {
|
|
222
|
+
if (!map || !padding) return;
|
|
223
|
+
|
|
224
|
+
const prev = prevPadding.current;
|
|
225
|
+
const paddingChanged =
|
|
226
|
+
prev?.top !== padding.top ||
|
|
227
|
+
prev?.left !== padding.left ||
|
|
228
|
+
prev?.bottom !== padding.bottom ||
|
|
229
|
+
prev?.right !== padding.right;
|
|
230
|
+
|
|
231
|
+
if (paddingChanged) {
|
|
232
|
+
const center = map.getCenter();
|
|
233
|
+
const zoom = map.getZoom() ?? initialZoom;
|
|
234
|
+
if (center) {
|
|
235
|
+
const logicalCenter = offsetCenter(
|
|
236
|
+
{ latitude: center.lat(), longitude: center.lng() },
|
|
237
|
+
zoom,
|
|
238
|
+
prev,
|
|
239
|
+
true
|
|
240
|
+
);
|
|
241
|
+
const newCenter = offsetCenter(
|
|
242
|
+
{ latitude: logicalCenter.lat, longitude: logicalCenter.lng },
|
|
243
|
+
zoom,
|
|
244
|
+
padding,
|
|
245
|
+
false
|
|
246
|
+
);
|
|
247
|
+
map.panTo(newCenter);
|
|
248
|
+
}
|
|
249
|
+
prevPadding.current = padding;
|
|
250
|
+
}
|
|
251
|
+
}, [map, padding, initialZoom, offsetCenter]);
|
|
252
|
+
|
|
182
253
|
const handleDragStart = () => {
|
|
183
254
|
isDragging.current = true;
|
|
184
255
|
wasGesture.current = true;
|
|
@@ -189,10 +260,16 @@ export const MapView = forwardRef<MapViewRef, MapViewProps>(function MapView(
|
|
|
189
260
|
};
|
|
190
261
|
|
|
191
262
|
const handleCameraChanged = (event: MapCameraChangedEvent) => {
|
|
263
|
+
const logicalCenter = offsetCenter(
|
|
264
|
+
{ latitude: event.detail.center.lat, longitude: event.detail.center.lng },
|
|
265
|
+
event.detail.zoom,
|
|
266
|
+
undefined,
|
|
267
|
+
true
|
|
268
|
+
);
|
|
192
269
|
const payload: CameraEventPayload = {
|
|
193
270
|
coordinate: {
|
|
194
|
-
latitude:
|
|
195
|
-
longitude:
|
|
271
|
+
latitude: logicalCenter.lat,
|
|
272
|
+
longitude: logicalCenter.lng,
|
|
196
273
|
},
|
|
197
274
|
zoom: event.detail.zoom,
|
|
198
275
|
gesture: isDragging.current,
|
|
@@ -202,12 +279,19 @@ export const MapView = forwardRef<MapViewRef, MapViewProps>(function MapView(
|
|
|
202
279
|
|
|
203
280
|
const handleIdle = (event: MapEvent) => {
|
|
204
281
|
const center = event.map.getCenter();
|
|
282
|
+
const zoom = event.map.getZoom() ?? 0;
|
|
283
|
+
const logicalCenter = offsetCenter(
|
|
284
|
+
{ latitude: center?.lat() ?? 0, longitude: center?.lng() ?? 0 },
|
|
285
|
+
zoom,
|
|
286
|
+
undefined,
|
|
287
|
+
true
|
|
288
|
+
);
|
|
205
289
|
const payload: CameraEventPayload = {
|
|
206
290
|
coordinate: {
|
|
207
|
-
latitude:
|
|
208
|
-
longitude:
|
|
291
|
+
latitude: logicalCenter.lat,
|
|
292
|
+
longitude: logicalCenter.lng,
|
|
209
293
|
},
|
|
210
|
-
zoom
|
|
294
|
+
zoom,
|
|
211
295
|
gesture: wasGesture.current,
|
|
212
296
|
};
|
|
213
297
|
onCameraIdle?.(createSyntheticEvent(payload));
|
|
@@ -225,37 +309,28 @@ export const MapView = forwardRef<MapViewRef, MapViewProps>(function MapView(
|
|
|
225
309
|
? { lat: initialCoordinate.latitude, lng: initialCoordinate.longitude }
|
|
226
310
|
: undefined;
|
|
227
311
|
|
|
228
|
-
const paddingStyle: ViewStyle = {
|
|
229
|
-
paddingTop: padding?.top ?? 0,
|
|
230
|
-
paddingLeft: padding?.left ?? 0,
|
|
231
|
-
paddingRight: padding?.right ?? 0,
|
|
232
|
-
paddingBottom: padding?.bottom ?? 0,
|
|
233
|
-
};
|
|
234
|
-
|
|
235
312
|
return (
|
|
236
313
|
<MapIdContext.Provider value={id}>
|
|
237
|
-
<View style={style}>
|
|
238
|
-
<
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
</Map>
|
|
258
|
-
</View>
|
|
314
|
+
<View ref={containerRef} style={style}>
|
|
315
|
+
<Map
|
|
316
|
+
id={id}
|
|
317
|
+
mapId={mapId}
|
|
318
|
+
defaultCenter={defaultCenter}
|
|
319
|
+
defaultZoom={initialZoom}
|
|
320
|
+
minZoom={minZoom}
|
|
321
|
+
maxZoom={maxZoom}
|
|
322
|
+
gestureHandling={gestureHandling}
|
|
323
|
+
disableDefaultUI
|
|
324
|
+
isFractionalZoomEnabled
|
|
325
|
+
tilt={pitchEnabled === false ? 0 : undefined}
|
|
326
|
+
onDragstart={handleDragStart}
|
|
327
|
+
onDragend={handleDragEnd}
|
|
328
|
+
onCameraChanged={handleCameraChanged}
|
|
329
|
+
onIdle={handleIdle}
|
|
330
|
+
>
|
|
331
|
+
<UserLocationMarker enabled={userLocationEnabled} />
|
|
332
|
+
{children}
|
|
333
|
+
</Map>
|
|
259
334
|
</View>
|
|
260
335
|
</MapIdContext.Provider>
|
|
261
336
|
);
|