google.maps.event.trigger for map.controls

284 views
Skip to first unread message

Tee Cee

unread,
Sep 18, 2010, 9:44:18 PM9/18/10
to Google Maps JavaScript API v3
now I know how to trigger an event on a marker
marker = new google.maps.Marker({ ,,,, });
google.maps.event.trigger(marker,"click");

I assume you should be able to pass any gmap object to
google.maps.event.trigger
but the constructor for map.control does not return a map.control
object

myMap.map.trafficInfo = new google.maps.TrafficLayer();
var trafficDiv = getTrafficControlDiv(.....)

myMap.map.controls[google.maps.ControlPosition.TOP_RIGHT].push(trafficDiv.div);
myMap.map.controls.length has a length but how do get a ierrator on
the controls

or is there a right way to programmtically click a map control ?

Tee Cee

unread,
Sep 18, 2010, 10:08:45 PM9/18/10
to Google Maps JavaScript API v3
Well almost there there is mvc forEach operator I saw in another post
but even though the myMap.map.controls.length == 4
this iterator only see's the firsdt contol i added


myMap.map.controls[google.maps.ControlPosition.TOP_RIGHT].forEach(function(element,
index) {

alert(element.id);
if (element == controlDiv) {
alert(element.id);
}
});


any hints and if it does iterrate is the element the object to pass
to
google.maps.event.trigger ?

On Sep 18, 6:44 pm, Tee Cee <teerce...@gmail.com> wrote:
> now I know how to trigger an event on  a marker
> marker = new google.maps.Marker({ ,,,, });
> google.maps.event.trigger(marker,"click");
>
> I assume you should be able to pass any gmap  object to
> google.maps.event.trigger
> but the constructor for map.control does not return a map.control
> object
>
>   myMap.map.trafficInfo = new google.maps.TrafficLayer();
>   var trafficDiv = getTrafficControlDiv(.....)
>
> myMap.map.controls[google.maps.ControlPosition.TOP_RIGHT].push(trafficDiv.d­iv);

Tee Cee

unread,
Sep 18, 2010, 10:42:15 PM9/18/10
to Google Maps JavaScript API v3
OK that does work to iterrate the
controls but element is the div object for the control & thats not an
object
that google.maps.event.trigger can digest

OK maybe i need to figure out how to iterrate google.maps.event
then if that is just a collection of objects & it holds all the
object on a map that are eventable
I can just invoke that maps.control click from there
On Sep 18, 7:08 pm, Tee Cee <teerce...@gmail.com> wrote:
> Well almost there there is mvc forEach operator I saw in another post
> but even though the  myMap.map.controls.length == 4
> this iterator only see's the firsdt contol i added
>
> myMap.map.controls[google.maps.ControlPosition.TOP_RIGHT].forEach(function(­element,
> index) {
>
>     alert(element.id);
>     if (element == controlDiv) {
>       alert(element.id);
>     }
>   });
>
> any hints and if it does iterrate is the element the object to pass
> to
> google.maps.event.trigger ?
>
> On Sep 18, 6:44 pm, Tee Cee <teerce...@gmail.com> wrote:
>
>
>
> > now I know how to trigger an event on  a marker
> > marker = new google.maps.Marker({ ,,,, });
> > google.maps.event.trigger(marker,"click");
>
> > I assume you should be able to pass any gmap  object to
> > google.maps.event.trigger
> > but the constructor for map.control does not return a map.control
> > object
>
> >   myMap.map.trafficInfo = new google.maps.TrafficLayer();
> >   var trafficDiv = getTrafficControlDiv(.....)
>
> > myMap.map.controls[google.maps.ControlPosition.TOP_RIGHT].push(trafficDiv.d­­iv);
> > myMap.map.controls.length has a length but how do get a ierrator on
> > the controls
>
> > or is there a right way to programmtically click a map control ?- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages