I am looking at the Google Maps API MVC usage example. See https://developers.google.com/maps/articles/mvcfun?csw=1
In the first simple example, I am unable to understand the marker.bindTo() call. The bindTo() is actually a method of the MVC object (See https://developers.google.com/maps/documentation/javascript/reference#MVCObject). marker itself is not an MVC object but a property of an object that has a MVC object as its prototype. So how is this bindTo method associated as a property of marker?
May be something elementary that I am missing here!
Thanks for any explanation.
/**
* A distance widget that will display a circle that can be resized and will
* provide the radius in km.
*
* @param {google.maps.Map} map The map on which to attach the distance widget.
*
* @constructor
*/
function DistanceWidget(map) {
this.set('map', map);
this.set('position', map.getCenter());
var marker = new google.maps.Marker({
draggable: true,
title: 'Move me!'
});
// Bind the marker map property to the DistanceWidget map property
marker.bindTo('map', this);
// Bind the marker position property to the DistanceWidget position
// property
marker.bindTo('position', this);
}
DistanceWidget.prototype = new google.maps.MVCObject();