Skip to content

Commit 632ade5

Browse files
committed
Merge branch 'develop/sprint3' into release/0.2.x
2 parents 0fbcfae + c3e4038 commit 632ade5

File tree

3 files changed

+90
-23
lines changed

3 files changed

+90
-23
lines changed

vue/src/components/LegendIcon.vue

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<template>
2+
<svg
3+
:class="isPrimary ? 'is-primary' : 'no-primary'"
4+
viewBox="0 0 20 20"
5+
width="20" height="20"
6+
xmlns="http://www.w3.org/2000/svg">
7+
<circle v-if="shape === 'circle'"
8+
cx="10" cy="10"
9+
:r="attr.size * 10 - attr.strokeWidth / 2"
10+
:stroke="attr.strokeColor"
11+
:stroke-width="attr.strokeWidth"
12+
:stroke-opacity="attr.strokeOpacity"
13+
:fill="attr.fillColor"
14+
:fill-opacity="attr.fillOpacity"
15+
/>
16+
<rect v-else-if="shape === 'square'"
17+
:x="'0'"
18+
:y="'0'"
19+
:width="attr.size * 20 - attr.strokeWidth"
20+
:height="attr.size * 20 - attr.strokeWidth"
21+
:stroke-width="attr.strokeWidth"
22+
:stroke="attr.strokeColor"
23+
:stroke-opacity="attr.strokeOpacity"
24+
:fill="attr.fillColor"
25+
:fill-opacity="attr.fillOpacity"
26+
:transform="'translate('+
27+
( (20-(attr.size * 20 - attr.strokeWidth)) / 2) +
28+
' '+
29+
( (20-(attr.size * 20 - attr.strokeWidth)) / 2) +
30+
')'"
31+
/>
32+
<line v-else-if="shape === 'line'"
33+
x1="0" x2="20"
34+
y1="10"
35+
y2="10"
36+
:stroke="attr.strokeColor"
37+
:stroke-width="attr.strokeWidth"
38+
:opacity="attr.strokeOpacity"
39+
/>
40+
</svg>
41+
</template>
42+
43+
<style>
44+
</style>
45+
46+
47+
<script>
48+
export default {
49+
name: 'LegendIcon',
50+
data() {
51+
return {};
52+
},
53+
54+
props: {
55+
shape: String,
56+
isPrimary: Boolean,
57+
attr: Object
58+
}
59+
};
60+
</script>

vue/src/components/SnapshotMeta.vue

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,7 @@
1818
class="pa-0 mb-1"
1919
>
2020
<v-list-item-icon class="my-0 mr-2">
21-
<v-icon v-if="item.shape === 'circle'"
22-
:color="item.color"
23-
:style="{ fontSize: 1.6 * item.size + 'em', opacity: item.opacity}">
24-
mdi-circle-outline</v-icon>
25-
<v-icon v-else-if="item.shape === 'square'"
26-
:color="item.color"
27-
:style="{ fontSize: 1.6 * item.size + 'em', opacity: item.opacity}">mdi-square</v-icon>
28-
<span v-else-if="item.shape === 'line'" class="legend--line"
29-
:style="{
30-
backgroundColor: item.color,
31-
height: 0.5 * item.size + 'em',
32-
opacity: item.opacity}">&nbsp;
33-
</span>
21+
<legend-icon :shape="item.shape" :isPrimary="item.primary" :attr="item" />
3422
</v-list-item-icon>
3523
<v-list-item-content class="py-0">
3624
<v-list-item-title>
@@ -45,16 +33,24 @@
4533

4634
<style>
4735
.legend .v-list-item--dense,
48-
.legend.v-list--dense .v-list-item {
36+
.legend.v-list--dense .v-list-item,
37+
.legend .v-list-item__content {
4938
min-height: 24px;
5039
}
40+
5141
.v-list-item__icon {
5242
min-width: auto;
5343
}
44+
45+
.legend .v-list-item__content {
46+
padding-bottom: 4px !important;
47+
}
48+
5449
.legend--line {
5550
margin: auto 0;
5651
width: 2em;
5752
}
53+
5854
a.legend--hash,
5955
.legend--hash:visited,
6056
.legend--hash:hover,
@@ -65,6 +61,11 @@ a.legend--hash,
6561
</style>
6662

6763
<script>
64+
import Vue from 'vue';
65+
import LegendIcon from './LegendIcon.vue';
66+
67+
Vue.component('legend-icon', LegendIcon);
68+
6869
export default {
6970
name: 'SnapshotMeta',
7071
data() {

vue/src/views/Snapshot.vue

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@
3333
clipped="clipped"
3434
app
3535
width="320"
36-
v-model="snapshotnav"
37-
>
36+
v-model="snapshotnav">
3837
<router-link id="logo" :to="'/' + $i18n.locale + '/'" class="px-4 py-1 d-block">
3938
<img alt="gemeindescan logo" height="50" src="@/assets/images/gemeindescan-logo.svg">
4039
</router-link>
@@ -68,9 +67,9 @@
6867
</div>
6968

7069
<v-toolbar
71-
width="320"
72-
absolute
73-
bottom>
70+
width="320"
71+
absolute
72+
bottom>
7473
<div class="useractions">
7574
<user-actions noRequest="1" />
7675
</div>
@@ -109,7 +108,7 @@
109108
class="px-4 py-2"
110109
:style="'width:' + legendWidth"
111110
v-bind:class="{open: mapinfoopen}"
112-
>
111+
>
113112
<v-icon
114113
style="position: absolute; top:0; right:0;"
115114
class="pa-2"
@@ -133,13 +132,16 @@ body,
133132
height: calc(100vh - var(--vh-offset, 0px)) !important;
134133
z-index: 9999; /* must be above mapbox interface */
135134
}
135+
136136
#snapshotnavContent {
137137
padding-bottom: 6em;
138138
}
139+
139140
#map {
140141
position: relative;
141142
width: 100%;
142143
}
144+
143145
#mapinfo {
144146
position: absolute;
145147
bottom: 2em;
@@ -157,6 +159,7 @@ body,
157159
#snapshotview .v-text-field--outlined fieldset {
158160
border-color: rgba(0, 0, 0, 0.12);
159161
}
162+
160163
#snapshotview .gemeindesuche input::placeholder {
161164
color: #000;
162165
opacity: 1;
@@ -226,7 +229,7 @@ export default {
226229
methods: {
227230
getInitialSnapshotnav() {
228231
if (this.$route.params.hash) {
229-
if (this.$vuetify.breakpoint.name === 'lg') {
232+
if (['lg', 'xl'].includes(this.$vuetify.breakpoint.name)) {
230233
return true;
231234
}
232235
return false;
@@ -310,8 +313,9 @@ export default {
310313
this.$store.commit('setBfsname', result.data.municipality.fullname);
311314
},
312315
313-
createFeatureLayer(geojson) {
316+
createFeatureLayer(geojson, attribution) {
314317
const geoJsonExtended = L.geoJson(geojson, {
318+
attribution,
315319
pointToLayer: (feature, latlng) => {
316320
if (feature.properties.radius) {
317321
// properties need to match https://leafletjs.com/reference-1.6.0.html#circle
@@ -361,7 +365,9 @@ export default {
361365
attribution: this.geojson.views[0].spec.attribution
362366
}));
363367
} else if (layer.mediatype === 'application/vnd.simplestyle-extended') {
364-
this.map.addLayer(this.createFeatureLayer(layer.data.features));
368+
this.map.addLayer(this.createFeatureLayer(
369+
layer.data.features, this.geojson.views[0].spec.attribution
370+
));
365371
}
366372
});
367373
} else if (this.bfsNumber) { // empty municipality

0 commit comments

Comments
 (0)