1. UI Event
ex. 'click', 'dbclick', 'mouseup', 'mousedown', 'mouseover', 'mouseout'
2. MVC State Changes
- object의 속성이 바뀐경우 API가 이벤트를 날려준다.
API가 'zoom_changed' 이벤트를 날려주면 맵의 줌레벨을 수정해주게 된다.
Event 이름인 addListener() event handler를 등록.
3. Map Events
var map;
function initialize() {
var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
var myOptions = {
zoom: 4, center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
google.maps.event.addListener(map, 'zoom_changed', function() { setTimeout(moveToDarwin, 3000);
});
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title:"Hello World!"
});
google.maps.event.addListener(marker, 'click', function() {
map.setZoom(8);
});
}
function moveToDarwin() {
var darwin = new google.maps.LatLng(-12.461334, 130.841904);
map.setCenter(darwin);
}
REF.
http://code.google.com/intl/ko/apis/maps/documentation/v3/events.html