Skip to content
Tauri
Releases

dpi

Classes

LogicalPosition

A position represented in logical pixels.

Since

2.0.0

Constructors

constructor()
new LogicalPosition(x, y): LogicalPosition
Parameters
ParameterType
xnumber
ynumber
Returns

LogicalPosition

Source: dpi.ts:62

Properties

PropertyType
typestring
xnumber
ynumber

LogicalSize

A size represented in logical pixels.

Since

2.0.0

Constructors

constructor()
new LogicalSize(width, height): LogicalSize
Parameters
ParameterType
widthnumber
heightnumber
Returns

LogicalSize

Source: dpi.ts:15

Properties

PropertyType
heightnumber
typestring
widthnumber

PhysicalPosition

A position represented in physical pixels.

Since

2.0.0

Constructors

constructor()
new PhysicalPosition(x, y): PhysicalPosition
Parameters
ParameterType
xnumber
ynumber
Returns

PhysicalPosition

Source: dpi.ts:78

Properties

PropertyType
typestring
xnumber
ynumber

Methods

toLogical()
toLogical(scaleFactor): LogicalPosition

Converts the physical position to a logical one.

Example
import { getCurrent } from '@tauri-apps/api/window';
const appWindow = getCurrent();
const factor = await appWindow.scaleFactor();
const position = await appWindow.innerPosition();
const logical = position.toLogical(factor);
Parameters
ParameterType
scaleFactornumber
Returns

LogicalPosition

Source: dpi.ts:94


PhysicalSize

A size represented in physical pixels.

Since

2.0.0

Constructors

constructor()
new PhysicalSize(width, height): PhysicalSize
Parameters
ParameterType
widthnumber
heightnumber
Returns

PhysicalSize

Source: dpi.ts:31

Properties

PropertyType
heightnumber
typestring
widthnumber

Methods

toLogical()
toLogical(scaleFactor): LogicalSize

Converts the physical size to a logical one.

Example
import { getCurrent } from '@tauri-apps/api/window';
const appWindow = getCurrent();
const factor = await appWindow.scaleFactor();
const size = await appWindow.innerSize();
const logical = size.toLogical(factor);
Parameters
ParameterType
scaleFactornumber
Returns

LogicalSize

Source: dpi.ts:47


© 2024 Tauri Contributors. CC-BY / MIT