-
Notifications
You must be signed in to change notification settings - Fork 152
/
index.html
79 lines (68 loc) · 1.73 KB
/
index.html
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!DOCTYPE html>
<html>
<head>
<title>Modest Maps JS - Nav Window Test</title>
<script type="text/javascript" src="../../modestmaps.js"></script>
<script type="text/javascript">
var MM = com.modestmaps; // "import" namespace
var map, nav;
window.onload = function() {
var provider = new MM.TemplatedLayer('http://tile.openstreetmap.org/{Z}/{X}/{Y}.png');
map = new MM.Map('map', provider);
nav = new MM.Map('nav', provider);
var changingMap = null;
function sync(m) {
if (!changingMap) {
// FIXME: sync needs to be more subtle than this, since it shouldn't mess with zoom unless the user has zoomed
changingMap = m;
if (m == map) {
nav.setCenterZoom(map.getCenter(), map.getZoom()-3);
}
else {
map.setCenterZoom(nav.getCenter(), nav.getZoom()+3);
}
changingMap = null;
}
}
nav.addCallback('drawn', sync);
map.addCallback('drawn', sync);
// FIXME: it would be nice if nav was resizeable
// FIXME: nav should have a little box that shows the current view
// and you should drag the box instead of panning the map
nav.setCenterZoom(map.getCenter(), map.getZoom()-3);
}
</script>
<style type="text/css">
html, body, #map, #nav {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
border: 0;
}
#nav {
background: #eee;
}
#navbox {
z-index: 1000;
width: 100px;
height: 100px;
background: #fff;
position: absolute;
right: 0;
bottom: 0;
padding: 6px 0 0 6px;
border-left: 1px solid #ddd;
border-top: 1px solid #ddd;
}
</style>
</head>
<body>
<div id="map">
<div id="navbox">
<div id="nav">
</div>
</div>
</div>
</body>
</html>