V
V
Viktor2020-05-19 22:53:45
JavaScript
Viktor, 2020-05-19 22:53:45

How to redraw ObjectManager in Yandex maps?

<ObjectManager
                            options={{
                                clusterize: false,
                                gridSize: 32,
                            }}
                            objects={{
                                preset: 'islands#greenDotIcon',
                            }}
                            clusters={{
                                preset: 'islands#greenClusterIcons',
                            }}
                            features={ //отрисовывает синие залитые контуры регионов
                                {
                                    type: 'FeatureCollection',
                                    features: polygonOmsu.featuresFilters //массив с объектами с зарисованными районами (лежит в стейте)
                                }
                            }
                        />


is in react Yandex maps ObjectManager. The features properties contain an array with objects of this type
{
geometry: {type: "Polygon", coordinates: Array(1), fillRule: "nonZero"}
id: 1
id_15899170699943886: "4350"
options: {fillColor: "#5999F1", fillOpacity: 0.9, strokeColor: "#fff", strokeWidth: 1, hintLayout: ƒ}
properties: {}
regionId: 59
type: "Feature"
}


When filtering, I change the polygonOmsu.featuresFilters state, namely the fill color, and put a new object with a new fill in the state, but the map is not redrawn. It is redrawn only when the array length changes or the id changes, which is not quite my option, I need what was redrawn when fillColor in options. How to do it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question