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,14 +159,16 @@ function handleTap([positionX, positionY]: Vector2) {
|
||||||
goToFocusedSlide()
|
goToFocusedSlide()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const focusedSlideBounding = slide.value[modelValue.value].getBoundingClientRect()
|
const focusedSlideBounding = slide.value[modelValue.value]?.getBoundingClientRect()
|
||||||
const slideCenterX = focusedSlideBounding.left + focusedSlideBounding.width / 2
|
if (focusedSlideBounding) {
|
||||||
const slideCenterY = focusedSlideBounding.top + focusedSlideBounding.height / 2
|
const slideCenterX = focusedSlideBounding.left + focusedSlideBounding.width / 2
|
||||||
|
const slideCenterY = focusedSlideBounding.top + focusedSlideBounding.height / 2
|
||||||
|
|
||||||
scale.value = 3
|
scale.value = 3
|
||||||
x.value += positionX - slideCenterX
|
x.value += positionX - slideCenterX
|
||||||
y.value += positionY - slideCenterY
|
y.value += positionY - slideCenterY
|
||||||
restrictShiftToInsideSlide()
|
restrictShiftToInsideSlide()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue