diff --git a/package.json b/package.json index 8aa8dcc..3c3c142 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/src/components/packages/scroll/ScrollElement.ts b/src/components/packages/scroll/ScrollElement.ts index 54a43cd..0a1c781 100644 --- a/src/components/packages/scroll/ScrollElement.ts +++ b/src/components/packages/scroll/ScrollElement.ts @@ -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) }) diff --git a/src/components/packages/scroll/ScrollSection.ts b/src/components/packages/scroll/ScrollSection.ts index cbbcc39..aa4dd56 100644 --- a/src/components/packages/scroll/ScrollSection.ts +++ b/src/components/packages/scroll/ScrollSection.ts @@ -81,6 +81,7 @@ export class ScrollSection { this.setIndex(null) this.setCurrentIndex(null) this.setCurrentIndexArc(null) + this.setCurrentIndexArcAbs(null) this.setMiddle(false) this.setSize() } @@ -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())