I created a simple map with multiple layers using the below code.
this.cartoSource = new carto.source.SQL(sql);
this.layerStyle = new carto.style.CartoCSS(layerStyle);
this.layer = new carto.layer.Layer(this.cartoSource, this.layerStyle , layerOption);
Whenever there is a change in the source or firing feature_cover
event, all map layers are repainted (a kind of flickering). why does a layer affect another independent layer?
My requirements are I have a layer with polygon shape. Whenever a user hovers over a particular polygon, that feature should be highlighted without repainting or flickering.
I tried two different ways:
- I was updating layer style using
setContent
with the following code:
#layer[cartodb_id=123]
{
line-opacity: 1;
line-color: #FFF;
line-width: 1;
polygon-fill: #f4c650;
}
- I was using another layer with one sql source with where
condition where
cartodb_id = FEATURE_OVER.data.cartodb_id
.
Both are getting a flickering effect. How can I solve this issue?