Overlay briefly has incorrect position in OpenLayers

المشرف العام

Administrator
طاقم الإدارة
I have an OpenLayers map with a number of points on the map. Some of those points are labeled via an ol.Overlay. Every 10 seconds, I call to the server and ask if the location of that point has changed, and the labels are re-created.

In the first image below, the application is paused right after the locations have been refreshed and the new label is created, but is not shown yet (the old label will be shut off just prior to showing the new label). The inspector is highlighting the hidden but placed label.

Point #170 hasn't changed position, but initially, the label created for it is situated 13px to the right of where it should be.



I hide the old label, and show the new label (still appearing in the incorrect place) :


But, after a fraction of a second of being shown, the new label moves to its correct place:



This creates an annoying flickering appearance in some browsers (Chrome is fine, but in the others it is more apparent).

Is this a result of OpenLayers, or is it more likely to be an issue in my code?

The problem seems to resolve itself after this line (83093) in ol-debug.js:

this.dispatchEvent( new ol.MapEvent(ol.MapEventType.POSTRENDER, this, frameState));

أكثر...
 
أعلى