A Polyline is a MVCObject which holds both MVCArrays and MVCObjects
properties. I can detect changes to things like the "map" property.
But CAN NOT detect a Change Event of the "path" variable MVCArray or
contents within.
--------------------------------------------------------------------------------------------------------------------------
<script type="text/javascript">
var newyork = new google.maps.LatLng(40.69847032728747,
-73.9514422416687);
var siberia = new google.maps.LatLng(53.478893,117.06665);
function initialize() {
var myOptions = {
zoom: 5,
center: newyork,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new
google.maps.Map(document.getElementById('map_canvas'), myOptions);
var poly = new google.maps.Polyline();
var path_1 = new google.maps.MVCArray();
var path_2 = new google.maps.MVCArray([newyork]);
//
google.maps.event.addListener(poly, 'path_changed', function() {
alert('THIS NEVER HAPPENS..... poly.path has changed');
});
poly.setPath(path_1);
path_1.push(siberia); // add value in MVCArray
//
poly.setPath(path_2); // change path var .. add change to
path_2.push(siberia);
//
google.maps.event.addListener(poly, 'map_changed', function() {
alert('poly.map has changed and the new map is '+
poly.getMap());
});
poly.setMap(map);
}
</script>
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.