Patrick Brosi il y a 4 ans
Parent
commit
3f5fe9de50
2 fichiers modifiés avec 35 ajouts et 3 suppressions
  1. 32 0
      web/index.html
  2. 3 3
      web/script.js

+ 32 - 0
web/index.html

@@ -11,6 +11,8 @@
11 11
     <script src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js" integrity="sha512-GffPMF3RvMeYyc1LWMHtK8EbPv0iNZ8/oTtHPx9/cc2ILxQ+u905qIwdpULaqDkyBKgOaB57QTMg7ztg8Jm2Og==" crossorigin=""></script>
12 12
     <script src="leaflet-heat.js"></script>
13 13
 
14
+    <link href="https://fonts.googleapis.com/css?family=Nunito:600&display=swap" rel="stylesheet">
15
+
14 16
     <style>
15 17
         body {
16 18
             padding: 0;
@@ -83,6 +85,34 @@
83 85
             font-style: italic;
84 86
         }
85 87
 
88
+        #logo {
89
+            font-family: 'Nunito', sans-serif;
90
+            font-size: 50px;
91
+                position: absolute;
92
+    z-index:1000;
93
+    top: 0.3em;
94
+    right: 1em;
95
+    text-shadow: -1px -1px 0 #333, 1px -1px 0 #333, -1px 1px 0 #333, 1px 1px 0 #333;
96
+    color: #fff;
97
+    opacity: 0.7;
98
+        }
99
+
100
+        .leaflet-control-zoom {
101
+            font-family: 'Nunito', sans-serif;
102
+        }
103
+
104
+        .leaflet-control-zoom-in,
105
+        .leaflet-control-zoom-out {
106
+            border-radius: 25px !important;
107
+            border: 1px solid #333;
108
+            opacity: 0.7;
109
+        }
110
+
111
+        .leaflet-touch .leaflet-control-layers, .leaflet-touch .leaflet-bar {
112
+            border: none;
113
+            background: transparent;
114
+        }
115
+
86 116
 .leaflet-popup {left: -20px !important;}
87 117
 
88 118
 .leaflet-popup-tip-container {
@@ -109,6 +139,8 @@
109 139
 </head>
110 140
 <body>
111 141
 
142
+    <div id="logo">staty</div>
143
+
112 144
 <div id="map" style="width: 100%;height: 100%;"></div>
113 145
 <script src="script.js">
114 146
 </script>

+ 3 - 3
web/script.js

@@ -118,7 +118,7 @@ function renderStat(stat, ll) {
118 118
     }
119 119
 
120 120
     if (map.getZoom() < 18) {
121
-        map.setView(ll, 18);
121
+        map.setView(ll, 18, {animate: true});
122 122
     }
123 123
 
124 124
     L.popup({opacity: 0.8})
@@ -155,7 +155,7 @@ L.tileLayer('https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x
155 155
 var layer = L.featureGroup().addTo(map);
156 156
 var labelLayer = L.featureGroup().addTo(map);
157 157
 
158
-map.on("zoomend", function () {
158
+map.on("moveend", function () {
159 159
     render();
160 160
 });
161 161
 
@@ -216,7 +216,7 @@ function render() {
216 216
 
217 217
                 if (map.getZoom() > 15) {
218 218
                    labelLayer.addLayer(L.featureGroup(labels));
219
-                   layer.addLayer(L.featureGroup(groups).on('click', function(a) { console.log(a);}));
219
+                   layer.addLayer(L.featureGroup(groups).on('click', function(a) { console.log(a.layer.options);}));
220 220
                    layer.addLayer(L.featureGroup(suggs).on('click', function(a) { openStat(a.layer.options.id, a.layer.getBounds().getCenter());}));
221 221
                 }
222 222