LogicalSize
이 콘텐츠는 아직 번역되지 않았습니다.
Module @netwiv/api/dpi · Kind Class
import { LogicalSize } from '@netwiv/api/dpi';A size represented in logical pixels.
Logical pixels are scaled according to the window’s DPI scale.
Most browser APIs (i.e. MouseEvent’s clientX) will return logical pixels.
For logical-pixel-based position, see {@linkcode LogicalPosition}.
Constructor
Section titled “Constructor”new LogicalSize(width: number, height: number)new LogicalSize(object: { Logical: { width: number; height: number; }; })new LogicalSize(object: { width: number; height: number; })Instance members
Section titled “Instance members”height
Section titled “height”height: numbertoJSON
Section titled “toJSON”toJSON(): { width: number; height: number; }toPhysical
Section titled “toPhysical”toPhysical(scaleFactor: number): PhysicalSizeConverts the logical size to a physical one.
Example
import { LogicalSize } from '@netwiv/api/dpi';import { getCurrentWindow } from '@netwiv/api/window';
const appWindow = getCurrentWindow();const factor = await appWindow.scaleFactor();const size = new LogicalSize(400, 500);const physical = size.toPhysical(factor);readonly type: "Logical"width: numberUpstream since 2.0.0
Descriptions come from the pinned @tauri-apps/api@2.11.1 declarations (MIT OR Apache-2.0); imports are shown with @netwiv/api paths.