Skip to content

Commit 3c22bb3

Browse files
authored
fix(Screen): change screen dimmensions formula for mobiles quasarframework#12311 (quasarframework#12313)
1 parent 16fed82 commit 3c22bb3

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<template>
2+
<div class="q-layout-padding bg-yellow">
3+
<div v-for="i in 200" :key="i" class="text-subtitle2">Row {{ i }}</div>
4+
<div class="fixed-center">{{ $q.screen.height }}</div>
5+
<div class="fixed" style="left: 0; right: 0; height: 3px; background: red" :style="{ top: `${$q.screen.height - 5}px` }"/>
6+
</div>
7+
</template>

ui/src/plugins/Screen.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Vue from 'vue'
22

3-
import { isSSR, fromSSR } from './Platform.js'
3+
import { isSSR, fromSSR, client } from './Platform.js'
44
import { listenOpts, noop } from '../utils/event.js'
55
import debounce from '../utils/debounce.js'
66

@@ -48,8 +48,11 @@ export default {
4848
}
4949

5050
const { visualViewport } = window
51-
const getSize = visualViewport === void 0
52-
? () => [ window.innerWidth, window.innerHeight ]
51+
const getSize = visualViewport === void 0 || client.is.mobile === true
52+
? () => [
53+
Math.max(window.innerWidth, document.scrollingElement.clientWidth),
54+
Math.max(window.innerHeight, document.scrollingElement.clientHeight)
55+
]
5356
: () => [
5457
visualViewport.width * visualViewport.scale + window.innerWidth - document.scrollingElement.clientWidth,
5558
visualViewport.height * visualViewport.scale + window.innerHeight - document.scrollingElement.clientHeight

0 commit comments

Comments
 (0)