Skip to content

Commit 0413bac

Browse files
authored
Fix/google maps ground overlay (#303)
* fixes android ground overlay from position * adds ground overlay from bounds * fixes map style
1 parent 5616f22 commit 0413bac

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

packages/google-maps/index.d.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ export type ElementTypeGeometry = 'geometry' | 'geometry.fill' | 'geometry.strok
1717

1818
export type ElementTypeLabels = 'labels' | 'labels.icon' | 'labels.text' | 'labels.text.fill' | 'labels.text.stroke';
1919

20+
export type StylersVisibility = 'on' | 'off' | 'simplified';
21+
2022
export interface Stylers {
2123
hue?: string;
2224
lightness?: number;
2325
saturation?: number;
2426
gamma?: number;
2527
invert_lightness?: boolean;
26-
visibility?: boolean;
28+
visibility?: StylersVisibility;
2729
color?: string;
2830
weight?: number;
2931
}
@@ -410,7 +412,7 @@ export interface IGoogleMap {
410412
}
411413

412414
export class GoogleMap implements IGoogleMap {
413-
mapStyle: Style;
415+
mapStyle: Style[];
414416
addTileOverlay(options: TileOverlayOptions): TileOverlay;
415417
removeTileOverlay(overlay: TileOverlay);
416418
buildingsEnabled: boolean;

packages/google-maps/utils/index.android.ts

+12-5
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,11 @@ export function intoNativePolylineOptions(options: PolylineOptions) {
253253
export function intoNativeGroundOverlayOptions(options: GroundOverlayOptions) {
254254
const opts = new com.google.android.gms.maps.model.GroundOverlayOptions();
255255

256+
if (options?.position) {
257+
const coords = <Coordinate>options.position;
258+
opts.position(new com.google.android.gms.maps.model.LatLng(coords.lat, coords.lng), options.width);
259+
}
260+
256261
if (typeof options?.width === 'number') {
257262
opts.position(opts.getLocation(), options.width);
258263
}
@@ -261,6 +266,13 @@ export function intoNativeGroundOverlayOptions(options: GroundOverlayOptions) {
261266
opts.position(opts.getLocation(), opts.getWidth(), options.height);
262267
}
263268

269+
if (options?.bounds) {
270+
opts.positionFromBounds(new com.google.android.gms.maps.model.LatLngBounds(
271+
new com.google.android.gms.maps.model.LatLng(options.bounds.southwest.lat, options.bounds.southwest.lng),
272+
new com.google.android.gms.maps.model.LatLng(options.bounds.northeast.lat, options.bounds.northeast.lng)
273+
));
274+
}
275+
264276
if (typeof options?.transparency) {
265277
opts.transparency(options.transparency);
266278
}
@@ -273,11 +285,6 @@ export function intoNativeGroundOverlayOptions(options: GroundOverlayOptions) {
273285
opts.clickable(options.tappable);
274286
}
275287

276-
if (options?.position) {
277-
const coords = <Coordinate>options.position;
278-
opts.position(new com.google.android.gms.maps.model.LatLng(coords.lat, coords.lng), opts.getWidth());
279-
}
280-
281288
if (typeof options?.tappable === 'boolean') {
282289
opts.clickable(options.tappable);
283290
}

packages/google-maps/utils/index.ios.ts

+7
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,13 @@ export function intoNativeGroundOverlayOptions(options: GroundOverlayOptions) {
259259
// TODO
260260
}
261261

262+
if (options?.bounds) {
263+
opts.bounds = new GMSCoordinateBounds({
264+
coordinate: CLLocationCoordinate2DMake(options.bounds.southwest.lat, options.bounds.southwest.lng),
265+
coordinate2: CLLocationCoordinate2DMake(options.bounds.northeast.lat, options.bounds.northeast.lng)
266+
});
267+
}
268+
262269
if (typeof options?.anchorU === 'number' || typeof options?.anchorV === 'number') {
263270
opts.anchor = CGPointMake(options?.anchorU ?? opts.anchor.x, options?.anchorV ?? opts.anchor.y);
264271
}

0 commit comments

Comments
 (0)