Newer
Older

Timothee P
committed
<div class="leaflet-bar">
<a
v-if="showDrawTool || isEditing"
:class="{ active: isSnapEnabled }"
:data-tooltip="`${ isSnapEnabled ? 'Désactiver' : 'Activer' } l'accrochage aux points`"
data-position="top right"
@click="toggleSnap"
>

Timothee P
committed
<span class="sr-only">{{ isSnapEnabled ? 'Désactiver' : 'Activer' }} l'accrochage aux points</span>
</a>
<a
v-if="showDrawTool"
class="leaflet-draw-draw-polygon active"
:title="
editionService.geom_type === 'polygon' ? 'Dessiner un polygone' :
editionService.geom_type === 'linestring' ? 'Dessiner une ligne' :
'Dessiner un point'
"
>
<img
v-if="editionService.geom_type === 'linestring'"
class="list-image-type"
src="@/assets/img/line.png"

Timothee P
committed
<img
v-if="editionService.geom_type === 'point'"
class="list-image-type"
src="@/assets/img/marker.png"
>
<img
v-if="editionService.geom_type === 'polygon'"
class="list-image-type"
src="@/assets/img/polygon.png"
>
</a>
<div v-else>
<a
:class="{ active: isEditing }"
@click="update"
>
<span class="sr-only">Modifier l'objet</span>
</a>
<a
:class="{ active: isDeleting }"
@click="deleteObj"
>
<span class="sr-only">Supprimer l'objet</span>
</a>
</div>
</div>
</div>
</template>
<script>
import editionService from '@/services/edition-service';
export default {

Timothee P
committed
props: {
map: {
type: Object,
default: null,
},
},
data() {
return {
editionService: editionService,

Timothee P
committed
isDeleting: false,
isSnapEnabled: false,
return this.editionService && this.editionService.editing_feature === undefined;
this.isDeleting = false;
this.isEditing = true;
this.isEditing = false;
this.isDeleting = true;

Timothee P
committed
toggleSnap() {
if (this.isSnapEnabled) {
editionService.removeSnapInteraction(this.map);
} else {
editionService.addSnapInteraction(this.map);
}
this.isSnapEnabled = !this.isSnapEnabled;
}
.editionToolbar{
position: absolute;
top: 80px;
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
a:first-child {
border-top-left-radius: 2px;
border-top-right-radius: 2px;
}
a:last-child {
border-bottom-left-radius: 2px;
border-bottom-right-radius: 2px;
border-bottom: none;
}
a, .leaflet-control-layers-toggle {
background-position: 50% 50%;
background-repeat: no-repeat;
display: block;
}
a {
background-color: #fff;
width: 30px;
height: 30px;
display: block;
text-align: center;
text-decoration: none;
color: black;
i {
margin: 0;
vertical-align: middle;

Timothee P
committed
&.magnet {
transform: rotate(90deg);
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
opacity: .85;
}
.active {
background-color: rgba(255, 145, 0, 0.904);
color: #fff;
i {
font-weight: bold;
}
img {
filter: invert(100%) sepia(0%) saturate(7500%) hue-rotate(282deg) brightness(105%) contrast(100%);
}
}
.list-image-type {
height: 20px;
vertical-align: middle;
margin: 5px 0 5px 0;
}
a:hover {
cursor: pointer !important;
background-color: #ebebeb !important;
}
a:focus {
background-color: #ebebeb !important;
}