This repository has been archived by the owner on Oct 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 152
Util
tmcw edited this page Mar 23, 2012
·
4 revisions
Modest Maps contains a set of utility functions in src/utils.js
. This is a minimal set of utilities that are useful to get maps working. Like the rest of MM, they need to be compatible with older browsers like IE7 and FF 3.x.
Used internally for inheritance, MM.extend
is sometimes
useful for implementing new projections and map providers. For example, to implement
var LinearProjection = function(zoom, transformation) {
// this is a bit like 'super'
MM.Projection.call(this, zoom, transformation);
};
LinearProjection.prototype = {
rawProject: function(point) {
return new MM.Point(point.x, point.y);
},
rawUnproject: function(point) {
return new MM.Point(point.x, point.y);
}
};
MM.extend(LinearProjection, MM.Projection);
MM uses cancelEvent
,
addEvent
, removeEvent
and getStyle
functions for normalizing some DOM manipulation.
To respond to events in the map such as panning, zooming, see addCallback
.