Skip to content

Commit 69345a0

Browse files
author
Philipp Grosswiler
committed
Fixed double conversion check.
1 parent ad36a15 commit 69345a0

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/android/plugin/google/maps/GoogleMaps.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,10 +1796,12 @@ public View getInfoContents(Marker marker) {
17961796

17971797
width = (int)((double)mapView.getWidth() * (widthDouble / 100));
17981798
} else if (isNumeric(widthString)) {
1799-
width = (int)Double.parseDouble(widthString);
1799+
double widthDouble = Double.parseDouble(widthString);
18001800

1801-
if (width <= 1) { // for percentage values (e.g. 0.5 = 50%).
1802-
width = mapView.getWidth() * width;
1801+
if (widthDouble <= 1.0) { // for percentage values (e.g. 0.5 = 50%).
1802+
width = (int)((double)mapView.getWidth() * (widthDouble));
1803+
} else {
1804+
width = (int)widthDouble;
18031805
}
18041806
}
18051807

src/ios/GoogleMaps/GoogleMapsViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ -(UIView *)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker*)marker
385385
} else if ([widthString isNumeric:widthString]) {
386386
double widthDouble = [widthString doubleValue];
387387

388-
if (widthDouble <= 1) {
388+
if (widthDouble <= 1.0) {
389389
width = (int)((double)mapView.frame.size.width * (widthDouble));
390390
} else {
391391
width = (int)widthDouble;

0 commit comments

Comments
 (0)