jeffreykemp / jk64-plugin-reportmap

Report Google Map APEX Plugin
https://jeffreykemp.github.io/jk64-plugin-reportmap/
MIT License
42 stars 16 forks source link

All infowindow default open #39

Closed bigode88 closed 4 years ago

bigode88 commented 7 years ago

Is there any way to leave all infowindow open by default?

jeffreykemp commented 7 years ago

Anything's possible, but the purpose of the infowindow was to provide information on a particular point of interest to the user if they click on one of the points.

Generally when I want information to be always visible, I place it separately on the page in Apex.

bigode88 commented 7 years ago

Yes it is that my project is a monitoring system on the map and I want the summary information to remain in the infowindow always all open default.

It would help me in this case, because I had difficulty in the plugin to do this.

example: http://www.greenbyte.com/fileadmin/template/images/bright/bright-screenshot-monitor-map.jpg

Only the open infowindow as default.

Thanks!

bigode88 commented 7 years ago

I got it!

    google.maps.event.addListener(reppin, "click", function () {
        apex.debug(opt.regionId+" repPin clicked "+pData.id);
        if (pData.info) {
            if (opt.iw) {
                opt.iw.close();
            } else {
                opt.iw = new google.maps.InfoWindow();
            }
            opt.iw.setOptions({
               content: pData.info
              });

            opt.iw.open(opt.map, this);
        }

    });

    google.maps.event.addListener(opt.map, "tilesloaded", function () {
        opt.iw = new google.maps.InfoWindow();
        opt.iw.setOptions({
               content: pData.info
              });
        opt.iw.open(opt.map, reppin);
        });
jeffreykemp commented 7 years ago

I'm glad you found a way :)

Note that tilesloaded fires whenever the map loads a tile - so it may re-fire when the user pans or zooms.

You might consider using google.maps.event.addListenerOnce instead of addListener.

bigode88 commented 7 years ago

Great idea! :) Thanks for support!!

jeffreykemp commented 5 years ago

This will become possible in the next release by using a new attribute, Marker Callback Javascript. This will be called for each marker when it is placed on the map; your code can then show the info window if it needs to.

jeffreykemp commented 4 years ago

An alternative to this might be to make the markers themselves more customisable - e.g. a square box with multiple lines of text instead of a single teardrop marker.

jeffreykemp commented 4 years ago

In v1.1 it will be possible to add a dynamic action on the markerAdded event which runs the following javascript to show the info window:

$("#map_mymap").reportmap("showInfoWindow", this.data.marker);

This will only be useful if the report only has one marker, however; as the map currently only generates a single InfoWindow object at a time.

jeffreykemp commented 4 years ago

Added in Release 1.1