Skip to content

Commit ad5b543

Browse files
authored
Merge pull request #254 from komsikov/fix_android_resolution
fix android tv resolution
2 parents ad24ff6 + 9258177 commit ad5b543

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ app/qml.min.js
77
.cache/*
88
node_modules
99
.idea/
10+
.vscode
1011
test/qml/Output
1112
test/build.*
1213
test/.cache

platform/html5/html.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,11 +523,19 @@ var WindowPrototype = exports.Window.prototype = Object.create(_globals.core.RAI
523523
WindowPrototype.constructor = exports.Window
524524

525525
WindowPrototype.width = function() {
526-
return this.dom.innerWidth
526+
if (navigator.userAgent.toLocaleLowerCase().match('android')) {
527+
return Math.floor(this.dom.innerWidth * this.dom.devicePixelRatio);
528+
} else {
529+
return this.dom.innerWidth;
530+
}
527531
}
528532

529533
WindowPrototype.height = function() {
530-
return this.dom.innerHeight
534+
if (navigator.userAgent.toLocaleLowerCase().match('android')) {
535+
return Math.floor(this.dom.innerHeight * this.dom.devicePixelRatio);
536+
} else {
537+
return this.dom.innerHeight;
538+
}
531539
}
532540

533541
WindowPrototype.scrollY = function() {

0 commit comments

Comments
 (0)