Skip to content

Commit

Permalink
Merge pull request #830 from realwagyu/master
Browse files Browse the repository at this point in the history
[Feat]: Add robust pinch zoom support
  • Loading branch information
davidjerleke committed Apr 29, 2024
2 parents 5ae8348 + fd29bde commit 197399d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Expand Up @@ -635,7 +635,7 @@ export const examplesCarouselDefaultStyles = (
const horizontal = axis === 'x'
const flexDirection = horizontal ? '' : 'flex-direction: column;'
const spacingDirection = horizontal ? 'left' : 'top'
const panDirection = `pan-${horizontal ? 'y' : 'x'}`
const panDirection = `pan-${horizontal ? 'y' : 'x'} pinch-zoom`
const sizeDimention = horizontal ? 'width' : 'height'
const slideHeight = horizontal ? 'var(--slide-height)' : '100%'
const containerHeight = horizontal
Expand Down
2 changes: 2 additions & 0 deletions packages/embla-carousel/src/components/DragHandler.ts
Expand Up @@ -147,6 +147,8 @@ export function DragHandler(
}

function move(evt: PointerEventType): void {
const isTouchEvt = !isMouseEvent(evt, ownerWindow)
if (isTouchEvt && evt.touches.length >= 2) return up(evt)
const lastScroll = dragTracker.readPoint(evt)
const lastCross = dragTracker.readPoint(evt, crossAxis)
const diffScroll = deltaAbs(lastScroll, startScroll)
Expand Down

0 comments on commit 197399d

Please sign in to comment.