fix: prevent undefined error on getBoundingClientRect
This commit is contained in:
parent
dc9d72189f
commit
e656ed7124
1 changed files with 9 additions and 7 deletions
|
|
@ -159,7 +159,8 @@ function handleTap([positionX, positionY]: Vector2) {
|
||||||
goToFocusedSlide()
|
goToFocusedSlide()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const focusedSlideBounding = slide.value[modelValue.value].getBoundingClientRect()
|
const focusedSlideBounding = slide.value[modelValue.value]?.getBoundingClientRect()
|
||||||
|
if (focusedSlideBounding) {
|
||||||
const slideCenterX = focusedSlideBounding.left + focusedSlideBounding.width / 2
|
const slideCenterX = focusedSlideBounding.left + focusedSlideBounding.width / 2
|
||||||
const slideCenterY = focusedSlideBounding.top + focusedSlideBounding.height / 2
|
const slideCenterY = focusedSlideBounding.top + focusedSlideBounding.height / 2
|
||||||
|
|
||||||
|
|
@ -169,6 +170,7 @@ function handleTap([positionX, positionY]: Vector2) {
|
||||||
restrictShiftToInsideSlide()
|
restrictShiftToInsideSlide()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function handleSwipe([horiz, vert]: Vector2, [movementX, movementY]: Vector2) {
|
function handleSwipe([horiz, vert]: Vector2, [movementX, movementY]: Vector2) {
|
||||||
if (isZoomedIn.value || isPinching.value)
|
if (isZoomedIn.value || isPinching.value)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue