More improvements to map rendering issues on sequence edit.

This commit is contained in:
mateuswetah 2023-02-16 12:11:55 -03:00
parent b7bce14671
commit d129e5cb1e
2 changed files with 29 additions and 24 deletions

View File

@ -1591,6 +1591,9 @@ export default {
},
onChangeCollapse(event, index) {
if (event && !this.metadataCollapses[index] && this.itemMetadata[index].metadatum && this.itemMetadata[index].metadatum['metadata_type'] === "Tainacan\\Metadata_Types\\GeoCoordinate")
eventBusItemMetadata.$emit('itemEditionFormResize');
this.metadataCollapses.splice(index, 1, event);
},
toggleMetadataSectionCollapse(sectionIndex) {

View File

@ -175,22 +175,16 @@
}
},
watch: {
selectedLatLng: {
handler(newValue) {
const mapComponentRef = 'map--' + this.itemMetadatumIdentifier;
this.$nextTick(() => {
if ( this.$refs[mapComponentRef] && this.$refs[mapComponentRef].mapObject && newValue.length != undefined) {
setTimeout(() => {
if (newValue.length == 1)
this.$refs[mapComponentRef].mapObject.panInsideBounds(newValue, { animate: true, maxZoom: this.maxZoom });
else
this.$refs[mapComponentRef].mapObject.flyToBounds(newValue, { animate: true, maxZoom: this.maxZoom });
}, 750);
}
});
},
immediate: false
selectedLatLng() {
const mapComponentRef = 'map--' + this.itemMetadatumIdentifier;
this.$nextTick(() => {
if ( this.$refs[mapComponentRef] && this.$refs[mapComponentRef].mapObject && this.selectedLatLng.length != undefined) {
if (this.selectedLatLng.length == 1)
this.$refs[mapComponentRef].mapObject.panInsideBounds(this.selectedLatLng, { animate: true, maxZoom: this.maxZoom });
else
this.$refs[mapComponentRef].mapObject.flyToBounds(this.selectedLatLng, { animate: true, maxZoom: this.maxZoom });
}
});
}
},
created() {
@ -204,12 +198,10 @@
eventBusItemMetadata.$on('itemEditionFormResize', () => this.handleWindowResize(mapComponentRef));
},
mounted() {
setTimeout(() => {
this.$nextTick(() => {
const mapComponentRef = 'map--' + this.itemMetadatumIdentifier;
this.handleWindowResize(mapComponentRef);
});
}, 500);
this.$nextTick(() => {
const mapComponentRef = 'map--' + this.itemMetadatumIdentifier;
this.handleWindowResize(mapComponentRef);
});
},
beforeDestroy() {
const mapComponentRef = 'map--' + this.itemMetadatumIdentifier;
@ -321,8 +313,18 @@
this.$emit('input', this.selected);
},
handleWindowResize(mapComponentRef) {
if ( this.$refs[mapComponentRef] && this.$refs[mapComponentRef].mapObject )
this.$refs[mapComponentRef].mapObject.invalidateSize(true);
setTimeout(() => {
if ( this.$refs[mapComponentRef] && this.$refs[mapComponentRef].mapObject ) {
this.$refs[mapComponentRef].mapObject.invalidateSize(true);
if ( this.selectedLatLng.length != undefined) {
if (this.selectedLatLng.length == 1)
this.$refs[mapComponentRef].mapObject.panInsideBounds(this.selectedLatLng, { animate: true, maxZoom: this.maxZoom });
else
this.$refs[mapComponentRef].mapObject.flyToBounds(this.selectedLatLng, { animate: true, maxZoom: this.maxZoom });
}
}
}, 500);
}
}
}