Commit e44cff46 authored by ncastejon's avatar ncastejon
Browse files

Fix: replace the flyTo with panTo (mapbox gl js issue with flyTo and minZoom)

parent 396df0dd
Pipeline #1763 passed with stages
in 7 minutes
......@@ -23,12 +23,4 @@ export class Data implements IData {
this.id = data.properties.gid;
}
}
orderProperties(orderedProperties: string[]) {
const newDataPropertiesOrder = {};
orderedProperties.forEach((field) => {
newDataPropertiesOrder[field] = this.properties[field] ? this.properties[field] : '';
});
this.properties = newDataPropertiesOrder;
}
}
......@@ -209,7 +209,7 @@ export class DatasetDetailService {
);
// Set the properties order based on the natural order from the data provider (set in 'dataset.fields.list')
this._dataset.data.forEach((data) => {
data.orderProperties(this._dataset.fields.list);
this.orderProperties(data, this._dataset.fields.list);
});
}
});
......@@ -218,6 +218,14 @@ export class DatasetDetailService {
}
}
orderProperties(data: any, orderedProperties: string[]) {
const newDataPropertiesOrder = {};
orderedProperties.forEach((field) => {
newDataPropertiesOrder[field] = data.properties[field] ? data.properties[field] : '';
});
data.properties = newDataPropertiesOrder;
}
get datasetData(): Data[] {
return this._dataset.data;
}
......
......@@ -496,15 +496,15 @@ export class MapService {
const pointCenter = selectedFeature.geometry.type === 'Point' ?
selectedFeature.geometry.coordinates : centroid(selectedFeature).geometry.coordinates;
this._map.flyTo({
center: pointCenter,
curve: 1, duration: 500,
this._map.panTo(pointCenter, {
duration: 500,
// 70 is the width of the dataset data details panel divided by 4 (by 2 because the map and the table
// share the remaining space and again by 2 because we want to center the point so there is half on the
// left, half on the right)
offset: new mapboxgl.Point(-70, 0),
});
},
);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment