Fix rendering of MultiPolygon text styles
When overflow is false and some of a MultiPolygon's polygons are outside the rendered extent the coordinates and geometryWidths arrays are not kept in sync. Therefore the width check will filter on wrong data and some texts may not be rendered.
This commit is contained in:
@@ -232,7 +232,7 @@ class CanvasTextBuilder extends CanvasBuilder {
|
||||
}
|
||||
this.endGeometry(feature);
|
||||
} else {
|
||||
const geometryWidths = textState.overflow ? null : [];
|
||||
let geometryWidths = textState.overflow ? null : [];
|
||||
switch (geometryType) {
|
||||
case GeometryType.POINT:
|
||||
case GeometryType.MULTI_POINT:
|
||||
@@ -275,6 +275,21 @@ class CanvasTextBuilder extends CanvasBuilder {
|
||||
if (end === begin) {
|
||||
return;
|
||||
}
|
||||
if (
|
||||
geometryWidths &&
|
||||
(end - begin) / 2 !== flatCoordinates.length / stride
|
||||
) {
|
||||
let beg = begin / 2;
|
||||
geometryWidths = geometryWidths.filter((w, i) => {
|
||||
const keep =
|
||||
coordinates[(beg + i) * 2] === flatCoordinates[i * stride] &&
|
||||
coordinates[(beg + i) * 2 + 1] === flatCoordinates[i * stride + 1];
|
||||
if (!keep) {
|
||||
--beg;
|
||||
}
|
||||
return keep;
|
||||
});
|
||||
}
|
||||
|
||||
this.saveTextStates_();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user