forked from 0x2620/oxjs
geo/map bugfixes
This commit is contained in:
parent
b6c74551fa
commit
dfd2787438
14 changed files with 892 additions and 809 deletions
|
|
@ -1,10 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>ox.js listmap demo</title
|
||||
<title>OxJS ListMap Demo</title
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<script type="text/javascript" src="../../build/Ox.js"></script>
|
||||
<script type="text/javascript" src="../../source/_/ox.map.js"></script>
|
||||
<script type="text/javascript" src="../../dev/Ox.js"></script>
|
||||
<script type="text/javascript" src="js/listmap.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
|||
|
|
@ -1,52 +1,71 @@
|
|||
Ox.load('UI', {
|
||||
debug: true,
|
||||
theme: 'modern'
|
||||
}, function() {
|
||||
Ox.load({UI: {}, Geo: {}}, function() {
|
||||
|
||||
Ox.load('Geo', function() {
|
||||
var markerColor = {
|
||||
'Northern America': [64, 64, 255],
|
||||
'Central America': [0, 0, 255],
|
||||
'Caribbean': [0, 0, 128],
|
||||
'Southern America': [0, 255, 0],
|
||||
'Northern Europe': [255, 255, 192],
|
||||
'Western Europe': [255, 255, 0],
|
||||
'Eastern Europe': [255, 128, 0],
|
||||
'Southern Europe': [128, 128, 0],
|
||||
'Northern Africa': [128, 128, 128],
|
||||
'Western Africa': [64, 64, 128],
|
||||
'Middle Africa': [64, 64, 64],
|
||||
'Eastern Africa': [128, 64, 64],
|
||||
'Southern Africa': [64, 128, 64],
|
||||
'Western Asia': [255, 128, 128],
|
||||
'Central Asia': [255, 0, 0],
|
||||
'Eastern Asia': [128, 0, 0],
|
||||
'Southern Asia': [255, 0, 255],
|
||||
'South-Eastern Asia': [128, 0, 128],
|
||||
'Australia and New Zealand': [0, 128, 128],
|
||||
'Micronesia': [192, 255, 255],
|
||||
'Melanesia': [0, 255, 255],
|
||||
'Polynesia': [128, 128, 255],
|
||||
'Antarctica': [192, 192, 192]
|
||||
},
|
||||
|
||||
var listmap = new Ox.ListMap({
|
||||
height: window.innerHeight,
|
||||
places: Ox.map(Ox.COUNTRIES, function(place) {
|
||||
return {
|
||||
alternativeNames: place.googleName ? [place.googleName] : [],
|
||||
area: place.area,
|
||||
countryCode: place.code,
|
||||
editable: true,
|
||||
flag: place.code,
|
||||
geoname: place.name,
|
||||
id: place.code,
|
||||
name: place.name,
|
||||
type: 'country',
|
||||
lat: place.lat,
|
||||
lng: place.lng,
|
||||
south: place.south,
|
||||
west: place.west,
|
||||
north: place.north,
|
||||
east: place.east
|
||||
};
|
||||
}),
|
||||
showTypes: true,
|
||||
width: window.innerWidth
|
||||
})
|
||||
.bindEvent({
|
||||
geocode: function(event, data) {
|
||||
Ox.print(event)
|
||||
Ox.print(JSON.stringify(data))
|
||||
}
|
||||
})
|
||||
.appendTo(Ox.UI.$body);
|
||||
$listmap = new Ox.ListMap({
|
||||
height: window.innerHeight,
|
||||
places: Ox.COUNTRIES.map(function(place) {
|
||||
return {
|
||||
alternativeNames: Ox.compact([place.google, place.imdb, place.wikipedia]),
|
||||
area: place.area,
|
||||
countryCode: place.code,
|
||||
editable: true,
|
||||
flag: place.code,
|
||||
geoname: place.name,
|
||||
id: place.code,
|
||||
markerColor: markerColor[place.region] || [128,128,128],
|
||||
name: place.name,
|
||||
type: 'country',
|
||||
lat: place.lat,
|
||||
lng: place.lng,
|
||||
south: place.south,
|
||||
west: place.west,
|
||||
north: place.north,
|
||||
east: place.east
|
||||
};
|
||||
}),
|
||||
width: window.innerWidth
|
||||
})
|
||||
.bindEvent({
|
||||
geocode: function(event, data) {
|
||||
Ox.print(event)
|
||||
Ox.print(JSON.stringify(data))
|
||||
}
|
||||
})
|
||||
.appendTo(Ox.UI.$body);
|
||||
|
||||
$(window).resize(function() {
|
||||
Ox.print('RESIZE', window.innerHeight)
|
||||
listmap.options({
|
||||
height: window.innerHeight,
|
||||
width: window.innerWidth
|
||||
});
|
||||
$(window).resize(function() {
|
||||
Ox.print('RESIZE', window.innerHeight)
|
||||
$listmap.options({
|
||||
height: window.innerHeight,
|
||||
width: window.innerWidth
|
||||
});
|
||||
|
||||
window.listmap = listmap;
|
||||
|
||||
});
|
||||
|
||||
window.$listmap = $listmap;
|
||||
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue