PhysicalPosition
Module @netwiv/api/dpi · Kind Class
import { PhysicalPosition } from '@netwiv/api/dpi';A position represented in physical pixels.
For an explanation of what physical pixels are, see description of {@linkcode PhysicalSize}.
Constructor
Section titled “Constructor”new PhysicalPosition(x: number, y: number)new PhysicalPosition(object: { Physical: { x: number; y: number; }; })new PhysicalPosition(object: { x: number; y: number; })Instance members
Section titled “Instance members”toJSON
Section titled “toJSON”toJSON(): { x: number; y: number; }toLogical
Section titled “toLogical”toLogical(scaleFactor: number): LogicalPositionConverts the physical position to a logical one.
Example
import { PhysicalPosition } from '@netwiv/api/dpi';import { getCurrentWindow } from '@netwiv/api/window';
const appWindow = getCurrentWindow();const factor = await appWindow.scaleFactor();const position = new PhysicalPosition(400, 500);const physical = position.toLogical(factor);readonly type: "Physical"x: numbery: 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.