@cashub/ui 0.19.6 → 0.19.8
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.
|
@@ -196,18 +196,13 @@ var Map = function Map(_ref4) {
|
|
|
196
196
|
map = _useState4[0],
|
|
197
197
|
setMap = _useState4[1];
|
|
198
198
|
|
|
199
|
-
var _useState5 = (0, _react.useState)({
|
|
200
|
-
lat: 1,
|
|
201
|
-
lng: 1
|
|
202
|
-
}),
|
|
203
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
204
|
-
center = _useState6[0],
|
|
205
|
-
setCenter = _useState6[1];
|
|
206
|
-
|
|
207
199
|
var options = (0, _react.useMemo)(function () {
|
|
208
200
|
return {
|
|
209
201
|
zoom: zoom,
|
|
210
|
-
center:
|
|
202
|
+
center: {
|
|
203
|
+
lat: 1,
|
|
204
|
+
lng: 1
|
|
205
|
+
},
|
|
211
206
|
scrollwheel: true,
|
|
212
207
|
zoomControl: true,
|
|
213
208
|
zoomControlOptions: {
|
|
@@ -229,7 +224,7 @@ var Map = function Map(_ref4) {
|
|
|
229
224
|
strictBounds: true
|
|
230
225
|
}
|
|
231
226
|
};
|
|
232
|
-
}, [zoom
|
|
227
|
+
}, [zoom]);
|
|
233
228
|
|
|
234
229
|
var handleError = function handleError(errorCode) {
|
|
235
230
|
if (onError) {
|
|
@@ -252,7 +247,8 @@ var Map = function Map(_ref4) {
|
|
|
252
247
|
latlng = _context2.sent;
|
|
253
248
|
|
|
254
249
|
if (latlng) {
|
|
255
|
-
map.
|
|
250
|
+
map.setZoom(15);
|
|
251
|
+
map.panTo(latlng);
|
|
256
252
|
handleChangeLatlng(latlng);
|
|
257
253
|
} else {
|
|
258
254
|
handleError('NO_RESULT');
|
|
@@ -283,18 +279,19 @@ var Map = function Map(_ref4) {
|
|
|
283
279
|
(0, _react.useEffect)(function () {
|
|
284
280
|
if (map) {
|
|
285
281
|
map.setOptions(options);
|
|
282
|
+
}
|
|
283
|
+
}, [map, options]); // click to choose location
|
|
284
|
+
|
|
285
|
+
(0, _react.useEffect)(function () {
|
|
286
|
+
if (map) {
|
|
286
287
|
map.addListener('click', function (event) {
|
|
287
|
-
handleChangeLatlng(event.latLng);
|
|
288
|
-
});
|
|
289
|
-
map.addListener('idle', function () {
|
|
290
|
-
setCenter(map.getCenter());
|
|
288
|
+
handleChangeLatlng(event.latLng.toJSON());
|
|
291
289
|
});
|
|
292
290
|
return function () {
|
|
293
291
|
window.google.maps.event.clearListeners(map, 'click');
|
|
294
|
-
window.google.maps.event.clearListeners(map, 'idle');
|
|
295
292
|
};
|
|
296
293
|
}
|
|
297
|
-
}, [map,
|
|
294
|
+
}, [map, handleChangeLatlng]); // render marker cluster
|
|
298
295
|
|
|
299
296
|
(0, _react.useEffect)(function () {
|
|
300
297
|
if (map && markerLatLng.lat && markerLatLng.lng) {
|