MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / onscrolltop

Function onscrolltop

src/lib/editorManager.js:2693–2708  ·  view source on GitHub ↗

* Handles the scroll top event. * Updates the vertical scroll value and renders the vertical scrollbar.

()

Source from the content-addressed store, hash-verified

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;

Callers

nothing calls this directly

Calls 3

setVScrollValueFunction · 0.85
hideMethod · 0.45
renderMethod · 0.45

Tested by

no test coverage detected