Do not draw empty text styles

This fixes a rendering/flicker issue when an empty text style is decluttered
together with an image style.
This commit is contained in:
Maximilian Krög
2020-10-04 19:01:45 +02:00
committed by Andreas Hocevar
parent 3198642cec
commit 187a216379

View File

@@ -82,7 +82,7 @@ function renderCircleGeometry(
circleReplay.drawCircle(geometry, feature);
}
const textStyle = style.getText();
if (textStyle) {
if (textStyle && textStyle.getText()) {
const textReplay = (opt_declutterBuilderGroup || builderGroup).getBuilder(
style.getZIndex(),
BuilderType.TEXT
@@ -251,7 +251,7 @@ function renderLineStringGeometry(
lineStringReplay.drawLineString(geometry, feature);
}
const textStyle = style.getText();
if (textStyle) {
if (textStyle && textStyle.getText()) {
const textReplay = (opt_declutterBuilderGroup || builderGroup).getBuilder(
style.getZIndex(),
BuilderType.TEXT
@@ -285,7 +285,7 @@ function renderMultiLineStringGeometry(
lineStringReplay.drawMultiLineString(geometry, feature);
}
const textStyle = style.getText();
if (textStyle) {
if (textStyle && textStyle.getText()) {
const textReplay = (opt_declutterBuilderGroup || builderGroup).getBuilder(
style.getZIndex(),
BuilderType.TEXT
@@ -320,7 +320,7 @@ function renderMultiPolygonGeometry(
polygonReplay.drawMultiPolygon(geometry, feature);
}
const textStyle = style.getText();
if (textStyle) {
if (textStyle && textStyle.getText()) {
const textReplay = (opt_declutterBuilderGroup || builderGroup).getBuilder(
style.getZIndex(),
BuilderType.TEXT
@@ -349,7 +349,8 @@ function renderPointGeometry(
let sharedData;
if (opt_declutterBuilderGroup) {
builderGroup = opt_declutterBuilderGroup;
sharedData = imageStyle && textStyle ? {} : undefined;
sharedData =
imageStyle && textStyle && textStyle.getText() ? {} : undefined;
}
if (imageStyle) {
if (imageStyle.getImageState() != ImageState.LOADED) {
@@ -362,7 +363,7 @@ function renderPointGeometry(
imageReplay.setImageStyle(imageStyle, sharedData);
imageReplay.drawPoint(geometry, feature);
}
if (textStyle) {
if (textStyle && textStyle.getText()) {
const textReplay = builderGroup.getBuilder(
style.getZIndex(),
BuilderType.TEXT
@@ -391,7 +392,8 @@ function renderMultiPointGeometry(
let sharedData;
if (opt_declutterBuilderGroup) {
builderGroup = opt_declutterBuilderGroup;
sharedData = imageStyle && textStyle ? {} : undefined;
sharedData =
imageStyle && textStyle && textStyle.getText() ? {} : undefined;
}
if (imageStyle) {
if (imageStyle.getImageState() != ImageState.LOADED) {
@@ -404,7 +406,7 @@ function renderMultiPointGeometry(
imageReplay.setImageStyle(imageStyle, sharedData);
imageReplay.drawMultiPoint(geometry, feature);
}
if (textStyle) {
if (textStyle && textStyle.getText()) {
const textReplay = (opt_declutterBuilderGroup || builderGroup).getBuilder(
style.getZIndex(),
BuilderType.TEXT
@@ -439,7 +441,7 @@ function renderPolygonGeometry(
polygonReplay.drawPolygon(geometry, feature);
}
const textStyle = style.getText();
if (textStyle) {
if (textStyle && textStyle.getText()) {
const textReplay = (opt_declutterBuilderGroup || builderGroup).getBuilder(
style.getZIndex(),
BuilderType.TEXT