Fix non-native geometries not visible in map layout (#10308)

* Fix non-native geometries not showing up in map layout
* Don't add bbox to edited and parsed geometries
This commit is contained in:
Oreille
2021-12-05 00:47:20 +01:00
committed by GitHub
parent 6d2ab0701c
commit cf09f6cd21
4 changed files with 8 additions and 22 deletions

View File

@@ -257,7 +257,7 @@ export default defineComponent({
...(mapboxKey ? { accessToken: mapboxKey } : {}),
});
if (controls.geocoder) {
map.addControl(controls.geocoder, 'top-right');
map.addControl(controls.geocoder as any, 'top-right');
controls.geocoder.on('result', (event: any) => {
location.value = event.result.center;
});
@@ -336,7 +336,8 @@ export default defineComponent({
function fitDataBounds(options: CameraOptions & AnimationOptions) {
if (map && currentGeometry) {
map.fitBounds(currentGeometry.bbox! as LngLatBoundsLike, {
const bbox = getBBox(currentGeometry);
map.fitBounds(bbox as LngLatBoundsLike, {
padding: 80,
maxZoom: 8,
...options,
@@ -432,7 +433,6 @@ export default defineComponent({
} else {
result = geometries[geometries.length - 1];
}
result!.bbox = getBBox(result!);
return result;
}