콘텐츠로 이동

LogicalPosition

이 콘텐츠는 아직 번역되지 않았습니다.

Module @netwiv/api/dpi · Kind Class

import { LogicalPosition } from '@netwiv/api/dpi';

A position represented in logical pixels. For an explanation of what logical pixels are, see description of {@linkcode LogicalSize}.

new LogicalPosition(x: number, y: number)
new LogicalPosition(object: { Logical: { x: number; y: number; }; })
new LogicalPosition(object: { x: number; y: number; })
toJSON(): { x: number; y: number; }
toPhysical(scaleFactor: number): PhysicalPosition

Converts the logical position to a physical one.

Example

import { LogicalPosition } from '@netwiv/api/dpi';
import { getCurrentWindow } from '@netwiv/api/window';
const appWindow = getCurrentWindow();
const factor = await appWindow.scaleFactor();
const position = new LogicalPosition(400, 500);
const physical = position.toPhysical(factor);
readonly type: "Logical"
x: number
y: number

Upstream 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.