Skip to content

Commit

Permalink
Merge pull request #4368 from domstubbs/keyboard-inview-fix
Browse files Browse the repository at this point in the history
Avoid using cached dimensions for keyboard inView calculations
  • Loading branch information
nolimits4web committed Mar 25, 2021
2 parents 07d40a4 + 0626be8 commit 3999ddb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/keyboard/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,19 @@ const Keyboard = {
) {
return undefined;
}

const $el = swiper.$el;
const swiperWidth = $el[0].clientWidth;
const swiperHeight = $el[0].clientHeight;
const windowWidth = window.innerWidth;
const windowHeight = window.innerHeight;
const swiperOffset = swiper.$el.offset();
if (rtl) swiperOffset.left -= swiper.$el[0].scrollLeft;
const swiperCoord = [
[swiperOffset.left, swiperOffset.top],
[swiperOffset.left + swiper.width, swiperOffset.top],
[swiperOffset.left, swiperOffset.top + swiper.height],
[swiperOffset.left + swiper.width, swiperOffset.top + swiper.height],
[swiperOffset.left + swiperWidth, swiperOffset.top],
[swiperOffset.left, swiperOffset.top + swiperHeight],
[swiperOffset.left + swiperWidth, swiperOffset.top + swiperHeight],
];
for (let i = 0; i < swiperCoord.length; i += 1) {
const point = swiperCoord[i];
Expand Down

0 comments on commit 3999ddb

Please sign in to comment.