Skip to content

Commit

Permalink
scroll: arc/arc-abs
Browse files Browse the repository at this point in the history
  • Loading branch information
denisavitski committed Jan 10, 2025
1 parent fd570fb commit 0b6ca94
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
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.24",
"version": "0.50.25",
"repository": {
"type": "git",
"url": "git+https://github.com/denisavitski/aptechka.git"
Expand Down
5 changes: 2 additions & 3 deletions src/components/packages/scroll/ScrollElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1341,12 +1341,11 @@ export class ScrollElement extends HTMLElement {
})

this.#currentSections.forEach((section, i) => {
const arcIndex = Math.abs(i - middle)
const arcIndex = i - middle

section.setCurrentIndex(i)
section.setCurrentIndexArc(arcIndex)

console.log(i === middle)
section.setCurrentIndexArcAbs(Math.abs(arcIndex))

section.setMiddle(i === middle)
})
Expand Down
5 changes: 5 additions & 0 deletions src/components/packages/scroll/ScrollSection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export class ScrollSection {
this.setIndex(null)
this.setCurrentIndex(null)
this.setCurrentIndexArc(null)
this.setCurrentIndexArcAbs(null)
this.setMiddle(false)
this.setSize()
}
Expand Down Expand Up @@ -193,6 +194,10 @@ export class ScrollSection {
this.#setVar('--current-index-arc', value)
}

public setCurrentIndexArcAbs(value: number | null) {
this.#setVar('--current-index-arc-abs', value)
}

#setVar(name: string, value: string | number | null) {
if (value !== null) {
this.#element.style.setProperty(name, value.toString())
Expand Down

0 comments on commit 0b6ca94

Please sign in to comment.