Skip to content

Commit d18c917

Browse files
committed
Clear pixel tolerance during SSR
1 parent 4ae9e0c commit d18c917

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Diff for: packages/embla-carousel/src/components/Engine.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export function Engine(
109109
} = options
110110

111111
// Measurements
112-
const pixelTolerance = 2
112+
const pixelTolerance = isSsr ? 0 : 2
113113
const containerRect = nodeHandler.getRect(container)
114114
const slideRects = slides.map(nodeHandler.getRect)
115115
const axis = Axis(scrollAxis, direction)

Diff for: packages/embla-carousel/src/components/ScrollContain.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function ScrollContain(
2121
const snapsContained = measureContained()
2222

2323
function usePixelTolerance(bound: number, snap: number): boolean {
24-
return deltaAbs(bound, snap) <= 1
24+
return pixelTolerance ? deltaAbs(bound, snap) <= 1 : false
2525
}
2626

2727
function findScrollContainLimit(): LimitType {

0 commit comments

Comments
 (0)