zoom_changed only triggers once in google maps api version 3 using MVC

Posted by fredrik on Stack Overflow See other posts from Stack Overflow or by fredrik
Published on 2010-04-22T12:41:37Z Indexed on 2010/04/22 12:43 UTC
Read the original article Hit count: 399

Hi,

I'm trying to use the MVC objects in google maps version 3. What I can't seem to figure out is why my zoom_changed method is only invoked once. When I first load the map the zoom_changed method is invoked. But not when I zoom on the map.

function MarkerWidget (options) {
    this.setValues(options);
    this.set('zoom', this.map.zoom);

    var marker = new google.maps.Marker({
            icon : this.icon,
            mouseOverIcon : this.mouseOverIcon,
            orgIcon : this.orgIcon
    });

    marker.bindTo('map', this);
    marker.bindTo('position', this);

    google.maps.event.addListener(marker, 'mouseover', this.onmouseover);
    google.maps.event.addListener(marker, 'mouseout', this.onmouseout);

}

MarkerWidget.prototype = new google.maps.MVCObject();
MarkerWidget.prototype.zoom_changed = function () {
    $.log(this, new Date());
}

Shouldn't the map object fire the zoom event and notify all object's that has "this.set('zoom', this.map.zoom)" ?

..fredrik

© Stack Overflow or respective owner

Related posts about google-maps

Related posts about google-maps-api-3