PhysicalSize
이 콘텐츠는 아직 번역되지 않았습니다.
Module @netwiv/api/window · Kind Class
import { PhysicalSize } from '@netwiv/api/window';A size represented in physical pixels.
Physical pixels represent actual screen pixels, and are DPI-independent. For high-DPI windows, this means that any point in the window on the screen will have a different position in logical pixels {@linkcode LogicalSize}.
For physical-pixel-based position, see {@linkcode PhysicalPosition}.
Constructor
Section titled “Constructor”new PhysicalSize(width: number, height: number)new PhysicalSize(object: { Physical: { width: number; height: number; }; })new PhysicalSize(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; }toLogical
Section titled “toLogical”toLogical(scaleFactor: number): LogicalSizeConverts the physical size to a logical one.
Example
import { getCurrentWindow } from '@netwiv/api/window';const appWindow = getCurrentWindow();const factor = await appWindow.scaleFactor();const size = await appWindow.innerSize(); // PhysicalSizeconst logical = size.toLogical(factor);readonly type: "Physical"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.