question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom infoWindow

See original GitHub issue

Dear Masashi and All,

First of all, thank you indeed for this plugin and community, it is a real pleasure to use native Google maps from Cordova/Ionic.

There is only one thing that prevents me from using this plugin in production-ready mobile app: absence of custom infoWindow support. I know, I know, that this was asked thousand times and I know about canvas workaround but imho it is just too hacky and unnatural to generate images for this purpose.

Earlier it was mentioned that it is possible to use custom JS infoWindow with plugin however I couldn’t find any good code example or gist implementing such approach. I’ve also tried to utilize infoBubble library (https://github.com/googlemaps/js-info-bubble) developed for GoogleMaps JS API but it doesn’t seem to be compatible with plugin, at least I get the following error:

Error: undefined is not an object (evaluating 'object.prototype')
http://192.168.1.34:8100/js/infobubble.js:199:32
extend@http://192.168.1.34:8100/js/infobubble.js:203:11
InfoBubble@http://192.168.1.34:8100/js/infobubble.js:37:14
http://192.168.1.34:8100/js/app.js:152:46

Could you please advise me if there is any existing solution for my issue or any plans to implement it?

Thank you a lot in advance!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
wf9a5m75commented, Jul 6, 2016

Current possible way is only this. https://github.com/mapsplugin/cordova-plugin-googlemaps/blob/v1.2.5/example/DemoApp/www/pages/customInfoWindow.html

As you may know, the infoWindow is drawn in the native side, but you guys want to write your code in JavaScript side. So another possible way is that providing infoWindow as a picture (filepath or base64 encoded, something). In that case, the plugin might able to display an image as infoWindow.

just an example idea

map.addMarker({
  position : ... ,
  infoWindowImage: "file://...../myInfoWnd.png"    // <-- Just idea
}, function(marker) {
    marker.showInfoWindow();
})
0reactions
wf9a5m75commented, Nov 4, 2016

From the v2-beta supports HTML infoWindow, you can customize the InfoWindow design (or create own one. See the InfoWindow.js)

var infoWindow = new plugin.google.maps.InfoWindow();

map.addMarker({
  position: {lat: 0, lng: 0},
  draggable: true,
  title: [
    'This is <b>Html</b> InfoWindow',
    '<br>',
    '<button onclick="javascript:alert(\'clicked!\');">click here</button>',
  ].join(""),
  infoWindow: infoWindow
});

I close this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Info Windows | Maps JavaScript API - Google Developers
An InfoWindow displays content (usually text or images) in a popup window above the map, at a given location. The info window has...
Read more >
Google Maps: How to create a custom InfoWindow?
The default Google Maps InfoWindow for a map marker is very round. How do I create a custom InfoWindow with square corners?
Read more >
custom_info_window | Flutter Package - Pub.dev
A widget based custom info window for google_maps_flutter package.
Read more >
Custom info window | ArcGIS API for JavaScript 3.42
This sample shows how to use the InfoWindowBase class to create a custom info window. This class was introduced at version 2.2 of...
Read more >
5 ways to customize the Google Maps infowindow - CodePen
How you can create an infowindow header, repositioning of its tail, change the infowindow size and background color, give a new look to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found