Skip to content

Commit

Permalink
custom-scrollbar: ресайз в тикере
Browse files Browse the repository at this point in the history
  • Loading branch information
denisavitski committed Jan 5, 2025
1 parent a1812a9 commit ae96a40
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aptechka",
"version": "0.50.13",
"version": "0.50.14",
"repository": {
"type": "git",
"url": "git+https://github.com/denisavitski/aptechka.git"
Expand Down
9 changes: 9 additions & 0 deletions src/components/packages/custom-scrollbar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import { elementResizer } from '@packages/element-resizer'
import { windowResizer } from '@packages/window-resizer'
import { findScrollParentElement, isBrowser, setupDrag } from '@packages/utils'
import { ticker } from '@packages/ticker'

export class CustomScrollbarElement extends HTMLElement {
#scrollElement: HTMLElement = null!
Expand All @@ -27,6 +28,8 @@ export class CustomScrollbarElement extends HTMLElement {

this.#scrollElement.addEventListener('scroll', this.#scrollListener)
this.#thumbElement.addEventListener('pointerdown', this.#grabListener)

ticker.subscribe(this.#tickListener, { maxFPS: 5 })
}
}

Expand All @@ -38,6 +41,8 @@ export class CustomScrollbarElement extends HTMLElement {
this.#thumbElement.removeEventListener('pointerdown', this.#grabListener)

clearTimeout(this.#activeTimeoutId)

ticker.unsubscribe(this.#tickListener)
}

#scrollListener = () => {
Expand Down Expand Up @@ -98,6 +103,10 @@ export class CustomScrollbarElement extends HTMLElement {
const startValue = this.#scrollElement.scrollTop
const grabCursor = grabEvent.y
}

#tickListener = () => {
this.#resizeListener()
}
}

if (isBrowser && !customElements.get('e-custom-scrollbar')) {
Expand Down

0 comments on commit ae96a40

Please sign in to comment.