Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Bug report: can't open infoWindows on different maps at the same time.
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Chouser  
View profile  
 More options Aug 16 2005, 11:06 pm
From: "Chouser" <chou...@gmail.com>
Date: Tue, 16 Aug 2005 20:06:51 -0700
Local: Tues, Aug 16 2005 11:06 pm
Subject: Bug report: can't open infoWindows on different maps at the same time.
Here is a page that demonstrates the problem:
http://bluweb.com/us/chouser/gmapez/test02.html

This page shows two maps created with identical code.  However, only
the second map has it's infoWindow opened correctly (at least in
Firefox).  Here is the code:

    <div id="map1" style="width: 300px; height: 300px"></div>
    <div id="map2" style="width: 300px; height: 300px"></div>
    <script type="text/javascript">
      function openInfo( mapid ) {
        var point = new GPoint(-122.141944, 37.441944);
        var map = new GMap(document.getElementById( mapid ));
        map.centerAndZoom( point, 4 );
        marker = new GMarker( point );
        map.addOverlay( marker );
        marker.openInfoWindowHtml( mapid );
      }

      openInfo( "map1" );
      openInfo( "map2" );
    </script>

You can work around the problem by using a timer to call
openInfoWindowHtml a second later, rather than trying to do them both
on page load.

Has anyone else seen this?  Know of a better work around?  Anyone at
Google willing to fix it?

--Chouser


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chouser  
View profile  
 More options Aug 17 2005, 10:04 pm
From: "Chouser" <chou...@gmail.com>
Date: Wed, 17 Aug 2005 19:04:55 -0700
Local: Wed, Aug 17 2005 10:04 pm
Subject: Re: Bug report: can't open infoWindows on different maps at the same time.
I now have a workaround for this bug.

For my application, I have added a doOpen() method to each marker which
calls marker.openInfoWindowHtml() with the appropriate HTML for that
marker.  I also have an array autoOpen with a list of the markers I
want to open, each from on a different map.

Here is some code to open all the markers in autoOpen, but only the
last one actually opens because of this bug:

  for( i = 0; i < autoOpen.length; ++i )
    autoOpen[ i ].doOpen();

Here is my workaround:

  function chainOpen( i ) {
    if( i < autoOpen.length ) {
      GEvent.bind( autoOpen[ i ], "infowindowopen", null, function(){
        chainOpen( i + 1 );
      });
      autoOpen[ i ].doOpen();
    }
  };
  chainOpen( 0 );

Pasha, Brett, or any other Googlers watching this group, please see
about fixing this bug for real.

Thanks,
--Chouser


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chouser  
View profile  
 More options Aug 18 2005, 1:06 am
From: "Chouser" <chou...@gmail.com>
Date: Wed, 17 Aug 2005 22:06:40 -0700
Local: Thurs, Aug 18 2005 1:06 am
Subject: Re: Bug report: can't open infoWindows on different maps at the same time.
I missed an unintended side-effect of the work-around given above.
Since the chain of event listeners remained, subsequently re-opening
any of the autoOpen markers would also re-open all markers further down
the list.  I think this is better:

  function chainOpen( i ) {
    if( i < autoOpen.length ) {
      var onOpen = GEvent.bind(
          autoOpen[ i ],
          "infowindowopen",
          null,
          function(){
            GEvent.removeListener( onOpen );
            chainOpen( i + 1 );
          });
      autoOpen[ i ].doOpen();
    }
  };
  chainOpen( 0 );

--Chouser


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »