From bcade5f2d7e94c8e7b49ffdd2df1c53a488ea48e Mon Sep 17 00:00:00 2001 From: j Date: Wed, 6 Aug 2025 21:49:45 +0200 Subject: [PATCH] add map editor example --- examples/maps/map_editor/index.html | 13 +++++++++ examples/maps/map_editor/js/example.js | 37 ++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 examples/maps/map_editor/index.html create mode 100644 examples/maps/map_editor/js/example.js diff --git a/examples/maps/map_editor/index.html b/examples/maps/map_editor/index.html new file mode 100644 index 00000000..294e941c --- /dev/null +++ b/examples/maps/map_editor/index.html @@ -0,0 +1,13 @@ + + + + World Map with Countries + + + + + + + + + diff --git a/examples/maps/map_editor/js/example.js b/examples/maps/map_editor/js/example.js new file mode 100644 index 00000000..e4a6f93b --- /dev/null +++ b/examples/maps/map_editor/js/example.js @@ -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}); + +});