feat(text): change text

This commit is contained in:
伊钱耀 2021-04-22 15:11:40 +08:00
parent 0fdb6d1b0d
commit 6452fd9093
1 changed files with 7 additions and 2 deletions

View File

@ -354,7 +354,10 @@ export default class TextModel extends BaseModel {
// // 此时地图不是高德2.0 originCentroid == centroid
// feature.originCentroid = feature.centroid;
// }
feature.originCentroid = feature.version === 'GAODE2.x'?calculteCentroid(feature.originCoordinates):feature.originCentroid = feature.centroid;
feature.originCentroid =
feature.version === 'GAODE2.x'
? calculteCentroid(feature.originCoordinates)
: (feature.originCentroid = feature.centroid);
this.glyphInfoMap[id as number] = {
shaping,
@ -386,7 +389,9 @@ export default class TextModel extends BaseModel {
const { shaping, id = 0 } = feature;
// const centroid = feature.centroid as [number, number];
// const centroid = feature.originCentroid as [number, number];
const centroid = (feature.version === 'GAODE2.x'?feature.originCentroid:feature.centroid) as [number, number];
const centroid = (feature.version === 'GAODE2.x'
? feature.originCentroid
: feature.centroid) as [number, number];
const size = feature.size as number;
const fontScale: number = size / 24;
const pixels = this.mapService.lngLatToContainer(centroid);