forked from antfu-collective/vitesse-lite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.vue
51 lines (44 loc) · 1.15 KB
/
index.vue
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
<script setup lang="ts">
import { Map as Mapl, NavigationControl } from "maplibre-gl"
import { onMapLoad } from "~/composables/maplibre-helper/onMapLoad"
import { addRasterLayer } from "~/composables/maplibre-helper/addRasterLayer"
const mapId = "map-index"
const map = shallowRef<Mapl>()
onMounted(async () => {
map.value = new Mapl({
container: mapId,
style: {
version: 8,
center: [117.2, -3.2],
zoom: 4,
layers: [],
sources: {},
glyphs: "https://fontstack-pbf.supermap.id/{fontstack}/{range}.pbf"
},
antialias: true,
preserveDrawingBuffer: true
})
map.value.addControl(
new NavigationControl({
visualizePitch: true
}),
"bottom-right"
)
await onMapLoad(map.value)
addRasterLayer({
map: map.value,
urls: ["https://tiles.supermap.id/styles/positron/{z}/{x}/{y}.png"],
spec: {
type: "raster"
}
})
})
</script>
<template>
<div id="container" class="absolute w-full h-full">
<div id="map-index" class="map w-full h-full" style="left: 0; top: 0; background-color: #d4dadc"></div>
</div>
</template>
<style>
@import "maplibre-gl/dist/maplibre-gl.css";
</style>