()
| 298 | } |
| 299 | |
| 300 | updateScrollParent() { |
| 301 | const prev = this.scrollParent; |
| 302 | this.scrollParent = this.props.scrollParentGetter(this); |
| 303 | if (prev === this.scrollParent) return; |
| 304 | if (prev) { |
| 305 | prev.removeEventListener('scroll', this.updateFrameAndClearCache); |
| 306 | prev.removeEventListener('mousewheel', NOOP); |
| 307 | } |
| 308 | // If we have a new parent, cached parent dimensions are no longer useful. |
| 309 | this.clearSizeCache(); |
| 310 | this.scrollParent.addEventListener( |
| 311 | 'scroll', |
| 312 | this.updateFrameAndClearCache, |
| 313 | PASSIVE |
| 314 | ); |
| 315 | // You have to attach mousewheel listener to the scrollable element. |
| 316 | // Just an empty listener. After that onscroll events will be fired synchronously. |
| 317 | this.scrollParent.addEventListener('mousewheel', NOOP, PASSIVE); |
| 318 | } |
| 319 | |
| 320 | updateSimpleFrame(cb) { |
| 321 | const { end } = this.getStartAndEnd(); |
no test coverage detected