-
Notifications
You must be signed in to change notification settings - Fork 153
Util
tmcw edited this page Jan 18, 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);
These are likely to change or be replaced with an existing toolkit
but are currently available for helping manage cross browser DOM event
handling and CSS style querying. For the record, they are cancelEvent
,
addEvent
, removeEvent
and getStyle
.
To respond to events in the map such as panning, zooming, see addCallback
.