mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-21 04:35:09 +01:00
c2370a1be6
* chore: Add the SPDX information to each file Add copyright and licensing information as defined in version 3.0 of the REUSE Specification. * tweak format --------- Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
18 lines
765 B
TypeScript
18 lines
765 B
TypeScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
import { deviceKind } from '@/scripts/device-kind';
|
|
|
|
const isTouchSupported = 'maxTouchPoints' in navigator && navigator.maxTouchPoints > 0;
|
|
|
|
export let isTouchUsing = deviceKind === 'tablet' || deviceKind === 'smartphone';
|
|
|
|
if (isTouchSupported && !isTouchUsing) {
|
|
window.addEventListener('touchstart', () => {
|
|
// maxTouchPointsなどでの判定だけだと、「タッチ機能付きディスプレイを使っているがマウスでしか操作しない」場合にも
|
|
// タッチで使っていると判定されてしまうため、実際に一度でもタッチされたらtrueにする
|
|
isTouchUsing = true;
|
|
}, { passive: true });
|
|
}
|