forked from FOSS/BangleApps
Merge pull request #1275 from myxor/osm_searchbox
OpenStreepMap custom: Add leaflet geosearch controlmaster
commit
1f744e8949
|
@ -2,6 +2,7 @@
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" />
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" />
|
||||||
<link rel="stylesheet" href="../../css/spectre.min.css">
|
<link rel="stylesheet" href="../../css/spectre.min.css">
|
||||||
|
<link rel="stylesheet" href="https://unpkg.com/leaflet-geosearch@3.6.0/dist/geosearch.css"/>
|
||||||
</head>
|
</head>
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
|
@ -44,6 +45,7 @@
|
||||||
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
|
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
|
||||||
<script src="../../core/lib/heatshrink.js"></script>
|
<script src="../../core/lib/heatshrink.js"></script>
|
||||||
<script src="../../core/lib/imageconverter.js"></script>
|
<script src="../../core/lib/imageconverter.js"></script>
|
||||||
|
<script src="https://unpkg.com/leaflet-geosearch@3.6.0/dist/bundle.min.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
/*
|
/*
|
||||||
|
@ -79,6 +81,19 @@ TODO:
|
||||||
});
|
});
|
||||||
// Could optionally overlay trails: https://wiki.openstreetmap.org/wiki/Tiles
|
// Could optionally overlay trails: https://wiki.openstreetmap.org/wiki/Tiles
|
||||||
|
|
||||||
|
// Search box:
|
||||||
|
const searchProvider = new window.GeoSearch.OpenStreetMapProvider();
|
||||||
|
const searchControl = new GeoSearch.GeoSearchControl({
|
||||||
|
provider: searchProvider,
|
||||||
|
style: 'button',
|
||||||
|
updateMap: true,
|
||||||
|
autoClose: true,
|
||||||
|
showMarker: false,
|
||||||
|
keepResult: true,
|
||||||
|
autoComplete: false
|
||||||
|
});
|
||||||
|
map.addControl(searchControl);
|
||||||
|
|
||||||
function onInit(device) {
|
function onInit(device) {
|
||||||
if (device && device.info && device.info.g) {
|
if (device && device.info && device.info.g) {
|
||||||
// On 3 bit devices, don't even offer the option. 3 bit is the only way
|
// On 3 bit devices, don't even offer the option. 3 bit is the only way
|
||||||
|
|
Loading…
Reference in New Issue