-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathviewscreen-geojson.html
More file actions
61 lines (54 loc) · 1.66 KB
/
viewscreen-geojson.html
File metadata and controls
61 lines (54 loc) · 1.66 KB
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
<!doctype html>
<html lang=en>
<meta content=initial-scale=1,width=device-width name=viewport>
<meta charset=utf8>
<title>viewscreen: geojson</title>
<link href=https://esm.sh/leaflet@1.9/dist/leaflet.css rel=stylesheet>
<link href=https://esm.sh/leaflet.markercluster@1.5/dist/MarkerCluster.css rel=stylesheet>
<link href=https://esm.sh/leaflet.markercluster@1.5/dist/MarkerCluster.Default.css rel=stylesheet>
<style>
:root {
color-scheme: light;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans',
Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
}
@media (prefers-color-scheme: dark) {
:root {
color-scheme: dark;
}
.leaflet-tile-pane {
filter: brightness(0.6) invert(1) contrast(3) hue-rotate(200deg)
saturate(0.3) brightness(0.7);
}
}
* {
box-sizing: border-box;
}
body {
aspect-ratio: 8 / 5;
margin: 0;
}
</style>
<script type=module>
import {viewscreenGeojson} from './viewscreen-geojson.min.js'
const id = window.location.hash.slice(1)
if (!id) throw new Error('Expected `id` in hash')
const parent = window.parent
if (!parent) throw new Error('Expected parent window')
const viewer = viewscreenGeojson(document.body, {
onReject(value) {
parent.postMessage({id, type: 'reject', value})
},
onSizeSuggestion(width, height) {
parent.postMessage({id, type: 'resize', value: {height, width}})
},
onResolve() {
parent.postMessage({id, type: 'resolve'})
}
})
window.addEventListener('message', function (event) {
if (event.data.type === 'content') {
viewer.change(event.data.value)
}
})
</script>