Skip to content

Commit

Permalink
doc: added polylines to story
Browse files Browse the repository at this point in the history
  • Loading branch information
ngyewch committed Jan 30, 2024
1 parent 0cf72f3 commit eb3d2fa
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/stories/AISTrackSymbol.story.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import type {Hst} from '@histoire/plugin-svelte';
import {onMount} from 'svelte';
import L, {Map as LeafletMap} from 'leaflet';
import {Map as LeafletMap, Polyline, TileLayer} from 'leaflet';
import {AISTrackSymbol} from '@arl/leaflet-tracksymbol2';
import type {PositionReport} from '@arl/leaflet-tracksymbol2';
Expand Down Expand Up @@ -64,15 +64,22 @@
if (!mapElement) {
return;
}
map = L.map(mapElement, {
map = new LeafletMap(mapElement, {
center: center,
zoom: 13,
});
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
new TileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
})
.addTo(map);
new Polyline([
[1.239041, 103.806741],
[1.229, 103.813],
[1.216015, 103.842335],
])
.addTo(map);
ts1 = new AISTrackSymbol(positionReport1, {
shipStaticData: {
userId: 123,
Expand Down Expand Up @@ -106,6 +113,13 @@
ts2.bindTooltip("AISTrackSymbol2");
ts2
.addTo(map);
new Polyline([
[1.235418, 103.831302],
[1.239, 103.854],
[1.254821, 103.867138],
])
.addTo(map);
});
</script>

Expand Down

0 comments on commit eb3d2fa

Please sign in to comment.