You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
In xeokit sdk 2.6.10, rendering 200 annotations runs smoothly, in [email protected], there is significant lagging, I put two screen casts of the 200 annotations in different versions
constannotations=newAnnotationsPlugin(viewer,{// Default HTML template for marker positionmarkerHTML:
"<div class='annotation-marker' style='background-color: {{markerBGColor}};'>{{glyph}}</div>",// Default HTML template for labellabelHTML:
"<div class='annotation-label' style='background-color: {{labelBGColor}};'>"+"<div class='annotation-title'>{{title}}</div><div class='annotation-desc'>{{description}}</div></div>",// Default values to insert into the marker and label templatesvalues: {markerBGColor: "red",labelBGColor: "red",glyph: "X",title: "Untitled",description: "No description",},});for(letindex=0;index<200;index++){annotations.createAnnotation({id: "myAnnotation"+index,worldPos: [Math.random()*2,Math.random()*2,Math.random()*2],// 3D World-space positionoccludable: false,// Optional, default, makes Annotation invisible when occluded by EntitiesmarkerShown: true,// Optional, default is true, makes position visible (when not occluded)labelShown: false,// Optional, default is false, makes label visible (when not occluded)values: {// Optional, overrides AnnotationPlugin's defaultsglyph: "O",title: "Origin",description: "This is my annotation.",markerBGColor: "blue",},});}
It lags
Expected behavior
It doesn't lag, same behavior as [email protected]
The text was updated successfully, but these errors were encountered:
The slowdown that you observe results from the getBoundingClientRect calls (which trigger browser's layout reflows) that were used to implement Annotation::setMarkerAlign and Annotation::setLabelPosition methods, introduced by the PR at #1554
The cost of calling the getBoundingClientRect method accumulates throughout a frame, and if there's a lot of Annotations that require its computation, it really adds up.
We need to consider whether there are other ways to achieve the same result without this costly call.
One possible solution, without sacrificing the alignment feature's utility, would be an optimized code path that didn't require getBoundingClientRect, which would work for annotations with the default "left" marker alignment, and with no label.
Would this limitation cover your use case?
Describe the bug
In xeokit sdk 2.6.10, rendering 200 annotations runs smoothly, in [email protected], there is significant lagging, I put two screen casts of the 200 annotations in different versions
To Reproduce
Steps to reproduce the behavior:
Render 200 annotations in [email protected]
It lags
Expected behavior
It doesn't lag, same behavior as [email protected]
The text was updated successfully, but these errors were encountered: