diff --git a/.gitignore b/.gitignore index f73dec2..7b45f28 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,6 @@ package-lock.json Podfile.lock Package.resolved .env -test.sh \ No newline at end of file +test.sh +plugin +.vscode \ No newline at end of file diff --git a/ios/Plugin/Map.swift b/ios/Plugin/Map.swift index 71e4a7d..d00ce3d 100644 --- a/ios/Plugin/Map.swift +++ b/ios/Plugin/Map.swift @@ -182,8 +182,9 @@ public class Map { let width = Double((item as? UIScrollView)?.contentSize.width ?? 0) let actualHeight = round(height / 2) - let isWidthEqual = width == self.config.width - let isHeightEqual = actualHeight == self.config.height + let tolerance = 1.0 + let isWidthEqual = abs(width - self.config.width) <= tolerance + let isHeightEqual = abs(actualHeight - self.config.height) <= tolerance if isWidthEqual && isHeightEqual && item.tag < self.targetViewController?.tag ?? Map.MAP_TAG { return item @@ -621,7 +622,21 @@ public class Map { if let iconImage = self.markerIcons[iconUrl] { newMarker.icon = getResizedIcon(iconImage, marker) } else { - if iconUrl.starts(with: "https:") { + if iconUrl.starts(with: "data") { + // Handle base64 encoded image + if let dataRange = iconUrl.range(of: "base64,") { + let base64String = String(iconUrl[dataRange.upperBound...]) + if let imageData = Data(base64Encoded: base64String, options: .ignoreUnknownCharacters), + let iconImage = UIImage(data: imageData) { + self.markerIcons[iconUrl] = iconImage + newMarker.icon = getResizedIcon(iconImage, marker) + } else { + print("CapacitorGoogleMaps Wanring: could not decode base64 image. Using default marker icon.") + } + } else { + print("CapacitorGoogleMaps Warning: invalid data URL format. Using default marker icon.") + } + } else if iconUrl.starts(with: "https:") { if let url = URL(string: iconUrl) { URLSession.shared.dataTask(with: url) { (data, _, _) in DispatchQueue.main.async { diff --git a/package.json b/package.json index fcb50ba..f63323c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@capacitor/google-maps", - "version": "6.0.1", + "version": "6.0.3", "description": "Google maps on Capacitor", "main": "dist/plugin.cjs.js", "module": "dist/esm/index.js", @@ -93,4 +93,4 @@ "@googlemaps/markerclusterer": "~2.0.7", "@types/google.maps": "~3.50.5" } -} +} \ No newline at end of file