add map editor example
This commit is contained in:
parent
8dbfcc0ece
commit
bcade5f2d7
2 changed files with 50 additions and 0 deletions
13
examples/maps/map_editor/index.html
Normal file
13
examples/maps/map_editor/index.html
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>World Map with Countries</title>
|
||||||
|
<meta http-equiv="Keywords" content="Lists"/>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||||
|
<link rel="shortcut icon" type="image/png" href="../../../source/UI/themes/oxlight/png/icon16.png"/>
|
||||||
|
<script type="text/javascript" src="../../../dev/Ox.js"></script>
|
||||||
|
<script type="text/javascript" src="js/example.js"></script>
|
||||||
|
<script>window.addEventListener('message', function(e) { e.origin == window.location.origin && eval('(' + e.data + ')'); });</script>
|
||||||
|
</head>
|
||||||
|
<body></body>
|
||||||
|
</html>
|
||||||
37
examples/maps/map_editor/js/example.js
Normal file
37
examples/maps/map_editor/js/example.js
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
In this example, we use Ox.MapEditor
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Ox.load(['UI', 'Geo'], function() {
|
||||||
|
var $map = Ox.MapEditor({
|
||||||
|
addPlace: function(place, callback) {
|
||||||
|
console.log("addPlace", place)
|
||||||
|
},
|
||||||
|
editPlace: function(place, callback) {
|
||||||
|
console.log("editPlace", place)
|
||||||
|
},
|
||||||
|
getMatches: function(names, callback) {
|
||||||
|
console.log("getMatches", names)
|
||||||
|
callback(23);
|
||||||
|
},
|
||||||
|
hasMatches: true, // FIXME: getMatches is enough
|
||||||
|
height: 800,
|
||||||
|
mode: 'add', // 'define',
|
||||||
|
names: null,
|
||||||
|
places: [],
|
||||||
|
removePlace: function(place, callback) {
|
||||||
|
console.log("removePlace", place)
|
||||||
|
},
|
||||||
|
selected: '',
|
||||||
|
showControls: false,
|
||||||
|
showLabels: false,
|
||||||
|
showTypes: true,
|
||||||
|
width: 600
|
||||||
|
})
|
||||||
|
.appendTo(Ox.$body);
|
||||||
|
|
||||||
|
Ox.$window.bind({resize: $map.resizeMap});
|
||||||
|
|
||||||
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue