* Handles the scroll top event. * Updates the vertical scroll value and renders the vertical scrollbar.
()
| 2691 | * Updates the vertical scroll value and renders the vertical scrollbar. |
| 2692 | */ |
| 2693 | function onscrolltop() { |
| 2694 | const scroller = editor?.scrollDOM; |
| 2695 | if (!scroller) return; |
| 2696 | const maxScroll = Math.max( |
| 2697 | scroller.scrollHeight - scroller.clientHeight, |
| 2698 | 0, |
| 2699 | ); |
| 2700 | if (maxScroll <= 0) { |
| 2701 | $vScrollbar.hide(); |
| 2702 | lastScrollTop = 0; |
| 2703 | $vScrollbar.value = 0; |
| 2704 | return; |
| 2705 | } |
| 2706 | setVScrollValue(); |
| 2707 | $vScrollbar.render(); |
| 2708 | } |
| 2709 | |
| 2710 | function clamp01(value) { |
| 2711 | if (value <= 0) return 0; |
nothing calls this directly
no test coverage detected