Smithsonian / dpo-voyager

DPO Voyager - 3D Explorer and Tool Suite
Apache License 2.0
169 stars 30 forks source link

Eliminate forced reflows when rendering HTMLSprites #319

Closed sdumetz closed 3 days ago

sdumetz commented 1 month ago

HTMLSprite.renderHTMLElement and HTMLSpriteGroup.render were causing unnecessary forced reflows within their render loops.

skipping getBoundingClientRect() where possible solves it.

Basically free performance gain, about .5 ms per annotation.

gjcope commented 3 weeks ago

I really like this optimization, but it seems to have broken the annotation truncation functionality. I'll take a deeper look when I have a chance but see the screen shots below for an example of the result with this PR (top) and master (bottom) when panning an annotation to the top edge of the component element.

annotation_issue

gjcope commented 2 weeks ago

Merged to rc-46. Thanks!