mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 05:25:40 +09:00
13 lines
335 B
TypeScript
13 lines
335 B
TypeScript
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
export function resolveDevicePixelRatio(ownerWindow: Window | null): number {
|
|
if (ownerWindow == null) {
|
|
return 1;
|
|
}
|
|
const devicePixelRatio = ownerWindow.devicePixelRatio;
|
|
if (!Number.isFinite(devicePixelRatio) || devicePixelRatio <= 0) {
|
|
return 1;
|
|
}
|
|
return devicePixelRatio;
|
|
}
|