Google マップ バージョン 3 で MVC オブジェクトを使用しようとしています。理解できないのは、zoom_changed
メソッドが 1 回しか呼び出されない理由です。最初にマップをロードすると、zoom_changed
メソッドが呼び出されます。しかし、地図をズームしたときはそうではありません。
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());
}
マップ オブジェクトはズーム イベントを発生させ、「this.set('zoom', this.map.zoom)」を持つすべてのオブジェクトに通知するべきではありませんか?