@cashub/ui 0.24.5 → 0.25.1
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/map/GoogleMap.js +26 -0
- package/package.json +1 -1
package/map/GoogleMap.js
CHANGED
|
@@ -341,11 +341,37 @@ const Map = _ref2 => {
|
|
|
341
341
|
});
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
|
+
let repositionButton;
|
|
345
|
+
if (geoFenceOptions.enabledReposition) {
|
|
346
|
+
repositionButton = document.createElement('button');
|
|
347
|
+
repositionButton.style.margin = 'var(--spacing-s)';
|
|
348
|
+
repositionButton.style.padding = 'var(--spacing-xs)';
|
|
349
|
+
repositionButton.style.boxShadow = 'rgba(0, 0, 0, 0.3) 0px 1px 4px -1px';
|
|
350
|
+
repositionButton.style.border = 'none';
|
|
351
|
+
repositionButton.style.borderRadius = '2px';
|
|
352
|
+
repositionButton.style.cursor = 'pointer';
|
|
353
|
+
repositionButton.style.backgroundColor = 'rgb(255, 255, 255)';
|
|
354
|
+
repositionButton.style.fontSize = '1rem';
|
|
355
|
+
repositionButton.textContent = 'Reposition';
|
|
356
|
+
repositionButton.title = 'Click to reposition the map to geofence';
|
|
357
|
+
repositionButton.type = 'button';
|
|
358
|
+
repositionButton.addEventListener('click', () => {
|
|
359
|
+
map.setCenter({
|
|
360
|
+
lat: geoFenceOptions.latitude,
|
|
361
|
+
lng: geoFenceOptions.longitude
|
|
362
|
+
});
|
|
363
|
+
});
|
|
364
|
+
const controlDiv = document.createElement('div');
|
|
365
|
+
controlDiv.appendChild(repositionButton);
|
|
366
|
+
map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(controlDiv);
|
|
367
|
+
}
|
|
344
368
|
return () => {
|
|
345
369
|
circle.setMap(null);
|
|
346
370
|
window.google.maps.event.clearListeners(circle, 'click');
|
|
347
371
|
window.google.maps.event.clearListeners(circle, 'radius_changed');
|
|
348
372
|
window.google.maps.event.clearListeners(circle, 'center_changed');
|
|
373
|
+
const rightBottonControls = map.controls[google.maps.ControlPosition.RIGHT_BOTTOM];
|
|
374
|
+
rightBottonControls.removeAt(0);
|
|
349
375
|
};
|
|
350
376
|
}
|
|
351
377
|
}, [map, geoFence, geoFenceOptions.latitude, geoFenceOptions.longitude, geoFenceOptions.radius, geoFenceOptions.minRadius, geoFenceOptions.editable, geoFenceOptions.eventHandlers]);
|