A
A
Alexander2017-09-20 20:12:12
JavaScript
Alexander, 2017-09-20 20:12:12

Why does changing pointer events cause a very heavy recalculation of styles?

I'm working on optimizing a smooth kinetic scrolling component written in vue.js. Oddly enough, the bottleneck was an optimization based on adding pointer-events: none during scrolling. It quite successfully copes with unwanted redrawing due to hover effects, but at the same time causes indecently heavy 'Recalculate Style' and 'Update Layer Tree', which take an average of 3ms on my 4770k and in general do not cause animation brakes, but how only it comes to testing on an old laptop, then there it is already far from 3 ms and the animation looks rather deplorable. I'm already thinking about using a simple overlay div instead of pointer-events. Is there a more elegant way to solve this problem?
e95da18c7be9493c8969b5decbb774b6.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nicholas, 2017-09-20
@healqq

What if we add a mousein event with capture=true and preventDefault? The div option will trigger the same operations with updating layers and recalculating styles.

A
Alexey Nikolaev, 2017-09-20
@Heian

Try using contain in conjunction with pointer-events. Perhaps this is what you need.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question