javascript - Style function called twice for each feature -


i wonder why style function called twice each feature added layer. code have:

var features = new ol.collection(), layer = new ol.layer.vector({     source: new ol.source.vector({features: features}),     style: function(feature, resolution){         console.log("called it"); // <-- called twice each feature         return getstyle(feature);       } }); map.addlayer(layer); var draw = new ol.interaction.draw({     features: features,     type: (geomtype) });          map.addinteraction(draw); 

i cannot figure out why style function called twice, every time when add feature map. becomes problem , looks terrible overhead when number of features increases.

edit

well, got it. in fact provided irreproducible code. in reality, set 1 feature attribute inside style function. , seems when use feature.set(...), style function called again. so, problem has been solved.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -