-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathindex.js
More file actions
48 lines (38 loc) · 1.5 KB
/
Copy pathindex.js
File metadata and controls
48 lines (38 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
var map;
window.onload = function() {
var mm = com.modestmaps;
var dmap = document.getElementById('map');
wax.tilejson('https://a.tiles.mapbox.com/v3/examples.map-i86l3621.jsonp',
function(tj) {
map = new com.modestmaps.Map(dmap,
new wax.mm.connector(tj), null, [
easey_handlers.DragHandler(),
easey_handlers.TouchHandler(),
easey_handlers.MouseWheelHandler(),
easey_handlers.DoubleClickHandler()
]);
map.setCenterZoom(new com.modestmaps.Location(-10, 50), 3);
map.addCallback('zoomed', function() {
// console.log(map.getZoom());
});
var pres = document.getElementsByTagName('pre');
for (var i = 0; i < pres.length; i++) {
pres[i].onclick = function() {
eval(this.innerHTML);
};
}
var scrolly = document.getElementById('scrolly');
var positions = [
map.locationCoordinate({ lat: 33.5, lon: 65.6 }).zoomTo(6),
map.locationCoordinate({ lat: 33.1, lon: 44.6 }).zoomTo(6),
map.locationCoordinate({ lat: 28.7, lon: 69.2 }).zoomTo(6)];
var ea = easey().map(map).easing('easeInOut');
function update() {
var pos = scrolly.scrollTop / 200;
ea.from(positions[Math.floor(pos)])
.to(positions[Math.ceil(pos)])
.t(pos - Math.floor(pos));
}
scrolly.addEventListener('scroll', update, false);
});
};