• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Freegle / iznik-nuxt3 / c048d5d9-f95f-4246-9591-5caf910754e3

02 Sep 2025 03:31PM UTC coverage: 45.697% (+4.6%) from 41.088%
c048d5d9-f95f-4246-9591-5caf910754e3

push

circleci

edwh
WIP FreegleDocker CircleCI

1766 of 4622 branches covered (38.21%)

Branch coverage included in aggregate %.

4032 of 8066 relevant lines covered (49.99%)

112.78 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

3.77
/components/MessageMap.vue
1
<template>
2
  <l-map
3
    ref="map"
4
    :zoom="12"
5
    :max-zoom="maxZoom"
6
    :style="'width: 100%; height: ' + height + 'px'"
7
    :options="mapOptions"
8
    @ready="idle"
9
  >
10
    <l-tile-layer :url="osmtile()" :attribution="attribution()" />
11
    <l-marker v-if="home" :lat-lng="home">
12
      <l-icon>
13
        <HomeIcon />
14
      </l-icon>
15
    </l-marker>
16
    <l-marker
17
      :lat-lng="[position.lat, position.lng]"
18
      :interactive="false"
19
      :icon="blurmarker"
20
    />
21
    <l-geo-json v-if="boundary" :geojson="boundaryJSON" :options="cgaOptions" />
22
  </l-map>
23
</template>
24
<script setup>
25
import { computed, ref } from 'vue'
26
import Wkt from 'wicket' // MT..
27
import { LGeoJson } from '@vue-leaflet/vue-leaflet'
28
import HomeIcon from './HomeIcon'
29
import { MAX_MAP_ZOOM } from '~/constants'
30
import { useMiscStore } from '~/stores/misc'
31
const miscStore = useMiscStore()
×
32

33
const props = defineProps({
×
34
  home: {
35
    type: Object,
36
    required: false,
37
    default: null,
38
  },
39
  position: {
40
    type: Object,
41
    required: true,
42
  },
43
  locked: {
44
    type: Boolean,
45
    required: false,
46
    default: false,
47
  },
48
  boundary: {
49
    type: String,
50
    required: false,
51
    default: null,
52
  },
53
  maxZoom: {
54
    type: Number,
55
    required: false,
56
    default: MAX_MAP_ZOOM,
57
  },
58
  height: {
59
    type: Number,
60
    required: false,
61
    default: 200,
62
  },
63
})
64

65
const map = ref(null)
×
66
let L = null
×
67

68
if (process.client) {
69
  L = await import('leaflet/dist/leaflet-src.esm')
×
70
}
71

72
const mapOptions = computed(() => {
×
73
  return {
×
74
    // On mobile require two-finger interaction.
75
    dragging: !props.locked && (!L || !L.Browser.mobile),
×
76
    touchZoom: !props.locked,
77
    scrollWheelZoom: false,
78
    bounceAtZoomLimits: true,
79
  }
80
})
81

82
const AREA_FILL_COLOUR = 'darkblue' // MT..
17✔
83
const CGA_BOUNDARY_COLOUR = 'darkblue'
17✔
84

85
const cgaOptions = computed(() => ({
×
86
  fillColor: AREA_FILL_COLOUR,
87
  fillOpacity: 0,
88
  color: CGA_BOUNDARY_COLOUR,
89
}))
90

91
const blurmarker = computed(() => {
×
92
  // MT..
93
  const modtools = miscStore.modtools
×
94
  return L
×
95
    ? new L.Icon({
96
        iconUrl: modtools ? '/bluering.png' : '/blurmarker.png',
×
97
        iconSize: [100, 100],
98
      })
99
    : null
100
})
101

102
const boundaryJSON = computed(() => {
×
103
  // MT..
104
  const wkt = new Wkt.Wkt()
×
105
  try {
×
106
    wkt.read(props.boundary)
×
107
    return wkt.toJson()
×
108
  } catch (e) {
109
    console.log('WKT error', props.boundary, e)
×
110
  }
111

112
  return null
×
113
})
114

115
function idle(themap) {
×
116
  if (props.home?.lat || props.home?.lng) {
×
117
    // We want to show both the centre and the marker.
118
    // eslint-disable-next-line new-cap
119
    const fg = new L.featureGroup([
×
120
      // eslint-disable-next-line new-cap
121
      new L.marker([props.position.lat, props.position.lng]),
122
      // eslint-disable-next-line new-cap
123
      new L.marker([props.home.lat, props.home.lng]),
124
    ])
125

126
    const fitTo = fg.getBounds().pad(0.1)
×
127
    if (fitTo.isValid()) {
×
128
      themap.fitBounds(fitTo)
×
129
    }
130
  } else {
131
    // eslint-disable-next-line new-cap
132
    const fg = new L.featureGroup([
×
133
      // eslint-disable-next-line new-cap
134
      new L.marker([props.position.lat, props.position.lng]),
135
    ])
136

137
    themap.fitBounds(fg.getBounds().pad(0.1))
×
138
    themap.setZoom(MAX_MAP_ZOOM)
×
139
  }
140

141
  try {
×
142
    const zoomControl = map.value.$el.querySelector('.leaflet-top.leaflet-left')
×
143
    if (zoomControl) {
×
144
      zoomControl.className = 'leaflet-top leaflet-right'
×
145
    }
146
  } catch (e) {
147
    console.log('Failed to add MessageMap zoom control', e)
×
148
  }
149
}
150
</script>
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc