Skip to content

Commit

Permalink
chore: fix line calc
Browse files Browse the repository at this point in the history
  • Loading branch information
hirsch88 committed Jan 12, 2025
1 parent 65de5b7 commit f943b91
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion e2e/cypress/e2e/visual/bal-carousel.visual.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('bal-carousel', () => {
})
})

describe.only('product-slider', () => {
describe('product-slider', () => {
it('combi with tabs', () => {
cy.visit('/components/bal-carousel/test/bal-carousel-tabs.visual.html').platform('desktop').waitForDesignSystem()
cy.get('.bal-tabs__nav__item').last().click()
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/components/bal-tabs/bal-tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ export class Tabs
@ListenToResize()
resizeListener(info: BalResizeInfo) {
this.swiper.notifyChange()
if ((!this.isVertical && info.width) || (this.isVertical && info.height)) {
if ((!this.isVertical() && info.width) || (this.isVertical() && info.height)) {
this.animateLine()
}
}
Expand Down Expand Up @@ -449,7 +449,6 @@ export class Tabs
}

private getCarouselElement(): HTMLElement | null {
// return this.el.querySelector(`#${this.tabsId}-carousel`)
return this.el.querySelector(`#${this.swiper.containerId}`)
}

Expand Down
14 changes: 6 additions & 8 deletions packages/core/src/utils/resize/resize.listener.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { balBrowser } from '../browser'
import { debounce, rIC } from '../helpers'
import { debounce } from '../helpers'
import { ListenerAbstract } from '../types/listener'
import { BalResizeInfo } from './resize.interfaces'

export class BalResizeListener<TObserver> extends ListenerAbstract<TObserver, BalResizeInfo> {
private resizeObserver: ResizeObserver | undefined
private debouncedNotify = debounce((info: BalResizeInfo) => this.notify(info), 10)
private debouncedNotify = debounce((info: BalResizeInfo) => this.notify(info), 42)
private lastWidth: number | undefined
private lastHeight: number | undefined

Expand Down Expand Up @@ -36,12 +36,10 @@ export class BalResizeListener<TObserver> extends ListenerAbstract<TObserver, Ba
const heightChanged = this.lastHeight !== entry.contentRect.height

if (widthChanged || heightChanged) {
rIC(() =>
this.debouncedNotify({
width: widthChanged,
height: heightChanged,
}),
)
this.debouncedNotify({
width: widthChanged,
height: heightChanged,
})
this.lastWidth = entry.contentRect.width
this.lastHeight = entry.contentRect.height
}
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/utils/resize/resize.subject.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { rIC } from '../helpers'
import { SingleSubject } from '../types/signal'
import { BalResizeInfo, BalResizeListenerFn, BalResizeObserver } from './resize.interfaces'
import { BalResizeListener } from './resize.listener'
Expand All @@ -7,7 +8,7 @@ export class BalResizeSubject extends SingleSubject<BalResizeObserver, BalResize

constructor() {
super((observer, data) => {
observer.resizeListener(data)
rIC(() => observer.resizeListener(data))
})
}

Expand Down

0 comments on commit f943b91

Please sign in to comment.