-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.html
92 lines (87 loc) · 3.93 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
80
81
82
83
84
85
86
87
88
89
90
91
92
<!doctype html>
<!--
# (c) Wong Hoi Sing Edison <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-->
<html lang="en">
<head>
<title>Leaflet.ResetView</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="icon" href="dist/redo-solid.svg" sizes="any" type="image/svg+xml">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/gh-fork-ribbon.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.css">
<link rel="stylesheet" href="./dist/L.Control.ResetView.min.css">
<style>
#map {
width: 100%;
height: 600px;
}
</style>
</head>
<body>
<a class="github-fork-ribbon" href="https://github.com/drustack/Leaflet.ResetView" data-ribbon="Fork me on GitHub" title="Fork me on GitHub">Fork me on GitHub</a>
<div class="container">
<div class="row mb-3">
<div class="col">
<h1>Leaflet.ResetView</h1>
<p>A reset view control for Leaflet. Move the map then click the reset button to see the reset effect.</p>
</div>
</div>
<form class="row mb-3">
<div class="col-md-4">
<label class="form-label">Latitude</label>
<input type="text" class="form-control latitude" value="51.505">
</div>
<div class="col-md-4">
<label class="form-label">Longitude</label>
<input type="text" class="form-control longitude" value="-0.09">
</div>
<div class="col-md-4">
<label class="form-label">Zoom</label>
<input type="text" class="form-control zoom" value="13">
</div>
</form>
<div class="row mb-3">
<div class="col">
<div id="map"></div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.js"></script>
<script src="./dist/L.Control.ResetView.min.js"></script>
<script>
var map = L.map("map").setView([51.505, -0.09], 13);
L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
maxZoom: 19,
attribution: "© <a href='https://openstreetmap.org/copyright'>OpenStreetMap contributors</a>"
}).addTo(map);
L.control.resetView({
position: "topleft",
title: "Reset view",
latlng: L.latLng([51.505, -0.09]),
zoom: 13,
}).addTo(map);
// For demo only.
L.DomEvent.on(map, "moveend", function(e) {
$(".latitude").val(map.getCenter().lat);
$(".longitude").val(map.getCenter().lng);
$(".zoom").val(map.getZoom());
}, this);
</script>
</body>
</html>