MCPcopy
hub / github.com/dolphin-wood/smooth-scrollbar / update

Method update

src/track/thumb.ts:43–57  ·  view source on GitHub ↗
(
    scrollOffset: number,
    containerSize: number,
    pageSize: number,
  )

Source from the content-addressed store, hash-verified

41 }
42
43 update(
44 scrollOffset: number,
45 containerSize: number,
46 pageSize: number,
47 ) {
48 // calculate thumb size
49 // pageSize > containerSize -> scrollable
50 this.realSize = Math.min(containerSize / pageSize, 1) * containerSize;
51 this.displaySize = Math.max(this.realSize, this._minSize);
52
53 // calculate thumb offset
54 this.offset = scrollOffset / pageSize * (containerSize + (this.realSize - this.displaySize));
55
56 setStyle(this.element, this._getStyle());
57 }
58
59 private _getStyle() {
60 switch (this._direction) {

Callers

nothing calls this directly

Calls 2

_getStyleMethod · 0.95
setStyleFunction · 0.90

Tested by

no test coverage detected