Skip to content
Snippets Groups Projects
Commit f989e829 authored by Florent Lavelle's avatar Florent Lavelle
Browse files

fix drawing on mobile

parent 89b7484e
No related branches found
No related tags found
No related merge requests found
...@@ -36,6 +36,7 @@ body { ...@@ -36,6 +36,7 @@ body {
width: 100%; width: 100%;
height: 100%; height: 100%;
min-height: 250px; min-height: 250px;
touch-action: none; /* workaround for modifying feature on mobile */
} }
#app-footer { #app-footer {
......
...@@ -34,13 +34,6 @@ ...@@ -34,13 +34,6 @@
background-color: #ebebeb; background-color: #ebebeb;
} }
.editionToolbar {
border: 2px solid rgba(0,0,0,.2);
background-clip: padding-box;
padding: 0;
right: 5px;
}
/* .leaflet-bar { /* .leaflet-bar {
box-shadow: none !important; box-shadow: none !important;
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<div v-if="showDrawTool"> <div v-if="showDrawTool">
<div class="leaflet-bar"> <div class="leaflet-bar">
<a <a
class="leaflet-draw-draw-polygon" class="leaflet-draw-draw-polygon active"
title="Dessiner un polygone" title="Dessiner un polygone"
> >
<img <img
...@@ -26,12 +26,20 @@ ...@@ -26,12 +26,20 @@
</div> </div>
<div v-if="!showDrawTool"> <div v-if="!showDrawTool">
<div class="leaflet-bar"> <div class="leaflet-bar">
<a @click="update"> <a
:class="{ active: isEditing }"
@click="update"
>
<i class="edit outline icon" /> <i class="edit outline icon" />
<span class="sr-only">Modifier l'objet</span></a> <span class="sr-only">Modifier l'objet</span>
<a @click="deleteObj"> </a>
<a
:class="{ active: isDeleting }"
@click="deleteObj"
>
<i class="trash alternate outline icon" /> <i class="trash alternate outline icon" />
<span class="sr-only">Supprimer l'objet</span></a> <span class="sr-only">Supprimer l'objet</span>
</a>
</div> </div>
</div> </div>
</div> </div>
...@@ -47,21 +55,35 @@ export default { ...@@ -47,21 +55,35 @@ export default {
data() { data() {
return { return {
editionService: editionService, editionService: editionService,
isEditing: false,
isDeleting: false
}; };
}, },
computed: { computed: {
showDrawTool() { showDrawTool() {
return this.editionService && this.editionService.editing_feature === undefined; return this.editionService && this.editionService.editing_feature === undefined;
},
},
watch: {
showDrawTool(newValue) {
if (!newValue && !this.isEditing && !this.isDeleting) {
this.isEditing = true;
}
} }
}, },
methods: { methods: {
update(){ update() {
editionService.activeUpdateFeature(); editionService.activeUpdateFeature();
this.isDeleting = false;
this.isEditing = true;
}, },
deleteObj(){ deleteObj() {
editionService.activeDeleteFeature(); editionService.activeDeleteFeature();
this.isEditing = false;
this.isDeleting = true;
}, },
} }
...@@ -73,13 +95,13 @@ export default { ...@@ -73,13 +95,13 @@ export default {
.editionToolbar{ .editionToolbar{
position: absolute; position: absolute;
top: 80px; top: 80px;
right: 5px; right: 6px;
}
.leaflet-bar {
border: 2px solid rgba(0,0,0,.2); border: 2px solid rgba(0,0,0,.2);
border-radius: 4px;
background-clip: padding-box; background-clip: padding-box;
padding: 0; padding: 0;
border-radius: 2px; }
.leaflet-bar {
a:first-child { a:first-child {
border-top-left-radius: 2px; border-top-left-radius: 2px;
...@@ -112,6 +134,19 @@ export default { ...@@ -112,6 +134,19 @@ export default {
} }
} }
.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 { .list-image-type {
height: 20px; height: 20px;
vertical-align: middle; vertical-align: middle;
......
...@@ -124,7 +124,7 @@ const editionService = { ...@@ -124,7 +124,7 @@ const editionService = {
// On mobile stop drawing when selecting a drawn point // On mobile stop drawing when selecting a drawn point
if (isMobile) { if (isMobile) {
this.selectForUpdate.once('select', () => { this.selectForUpdate.on('select', () => {
if (this.draw.getActive() && this.draw.sketchCoords_.length > 2) { if (this.draw.getActive() && this.draw.sketchCoords_.length > 2) {
this.draw.finishDrawing(); this.draw.finishDrawing();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment