Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DISPLAY_SHORT および DISPLAY_LONG の pixel の意味定義が不明瞭 #3

Open
naqtn opened this issue Jun 28, 2015 · 0 comments
Open

Comments

@naqtn
Copy link

naqtn commented Jun 28, 2015

DISPLAY_SHORT の API 記述
https://github.com/uupaa/Spec.js/wiki/Spec#user-content-DISPLAY_SHORT
では 「ディスプレイの短辺(pixel)」と書かれていますが、
この pixel の定義が(CSSピクセルなのか、物理ピクセルなのか)何のピクセルを指しているのか不明瞭だと思います。

例えば iPod touch 5 と Nexus 5 とで portrait で実行してみると次のようになります。

iPod touch 5, Safari
DISPLAY {SHORT, LONG} => 320, 568
screen.{width, height} => 320, 568
window.devicePixelRatio => 2

Nexus 5, Chrome
DISPLAY {SHORT, LONG} => 1080, 1920
screen.{width, height} => 360, 640
window.devicePixelRatio => 3

iPod touch 5 では CSSピクセル 単位であるようなのに対し
(DISPLAY_SHORT と screen.width が等しい。devicePixelRatio を掛けると物理ピクセルになる)
Nexus 5 では 物理ピクセル 単位であるように見えます。
(物理ピクセルと等しい。screen.width に devicePixelRatio を掛けると DISPLAY_SHORT になる)

通常の方法での取得が保証されない物理ピクセル数にするのが良いと思いますが、いかかでしょうか?


実装とメンテナンスに手間がかかる機種判定に便利に使わせていただいています。ありがとうございます。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant