When labels appear or disappear in a Lightspeed view, they fade in or out. While this effect is visually pleasing, it may not always be what you want.
To disable this effect, you need to do 2 things:
Create a label painter without the fading behavior. You can do so by setting the fading duration to 0 for the new label painter.
TLspLabelPainter labelPainter = new TLspLabelPainter(); labelPainter.setDefaultOpacityFadeDuration(0);
You can also use the
setDefaultOpacityFadeDurationmethod to make the label fading duration longer or shorter.
Make sure your new label painter is used by the layer.
If you use the
TLspShapeLayerBuilderclass to build your layer, you can use the following code:
ILspLayer layer = TLspShapeLayerBuilder.newBuilder() .model(aModel) .labelPainter(labelPainter) // Use the label painter without fading effect ... // Configure the rest of the layer (styling etc...) .build();
TLspLayer layer = new TLspLayer(model, ...); layer.setPainter(TLspPaintRepresentation.LABEL, labelPainter); // Use the label painter without fading effect // ... // Configure the rest of the layer (styling etc...)