Begins some improvements to single-valued input in geo coordinates. #692.

This commit is contained in:
mateuswetah 2022-12-19 11:58:29 -03:00
parent 9a0f1139a2
commit 1b6a02b8b3
1 changed files with 21 additions and 5 deletions

View File

@ -23,14 +23,16 @@
v-if="editingMarkerIndex >= 0" v-if="editingMarkerIndex >= 0"
expanded expanded
type="number" type="number"
:step="0.000000001" :step="0.000000000001"
v-model="latitude" /> @input="onUpdateFromLatitudeInput"
:value="latitude" />
<b-input <b-input
v-if="editingMarkerIndex >= 0" v-if="editingMarkerIndex >= 0"
expanded expanded
type="number" type="number"
:step="0.000000001" :step="0.000000000001"
v-model="longitude" /> @input="onUpdateFromLongitudeInput"
:value="longitude" />
<b-button <b-button
v-if="editingMarkerIndex >= 0" v-if="editingMarkerIndex >= 0"
outlined outlined
@ -60,7 +62,7 @@
@dragend="($event) => onDragMarker($event, index)" @dragend="($event) => onDragMarker($event, index)"
@click="($event) => onMarkerEditingClick($event)" /> @click="($event) => onMarkerEditingClick($event)" />
<l-marker <l-marker
v-if="editingMarkerIndex < 0" v-if="editingMarkerIndex < 0 && shouldAddMore"
:draggable="true" :draggable="true"
:lat-lng="editingLatLng" :lat-lng="editingLatLng"
@dragend="($event) => onDragEditingMarker($event)" @dragend="($event) => onDragEditingMarker($event)"
@ -180,6 +182,20 @@
eventBusItemMetadata.$off('itemEditionFormResize', () => this.handleWindowResize(mapComponentRef)); eventBusItemMetadata.$off('itemEditionFormResize', () => this.handleWindowResize(mapComponentRef));
}, },
methods: { methods: {
onUpdateFromLatitudeInput: _.debounce( function(newLatitude) {
this.latitude = newLatitude;
if (this.editingMarkerIndex >= 0) {
this.selected.splice(this.editingMarkerIndex, 1, this.latitude + ',' + this.longitude);
this.$emit('input', this.selected);
}
}, 350),
onUpdateFromLongitudeInput: _.debounce( function(newLongitude) {
this.longitude = newLongitude;
if (this.editingMarkerIndex >= 0) {
this.selected.splice(this.editingMarkerIndex, 1, this.latitude + ',' + this.longitude);
this.$emit('input', this.selected);
}
}, 250),
onDragMarker($event, index) { onDragMarker($event, index) {
if ( $event.target && $event.target['_latlng'] ) { if ( $event.target && $event.target['_latlng'] ) {
if (this.editingMarkerIndex == index) { if (this.editingMarkerIndex == index) {