views:

233

answers:

1

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

+1  A: 

Found the solution. Se my comment on the original post.

fredrik