dpi
Classes
LogicalPosition
A position represented in logical pixels.
Since
2.0.0
Constructors
new LogicalPosition()
new LogicalPosition(x, y): LogicalPositionParameters
| Parameter | Type |
|---|---|
x | number |
y | number |
Returns
Source: https://github.com/tauri-apps/tauri/blob/dev/tooling/api/src/dpi.ts#L62
Properties
| Property | Type | Default value |
|---|---|---|
type | string | 'Logical' |
x | number | undefined |
y | number | undefined |
LogicalSize
A size represented in logical pixels.
Since
2.0.0
Constructors
new LogicalSize()
new LogicalSize(width, height): LogicalSizeParameters
| Parameter | Type |
|---|---|
width | number |
height | number |
Returns
Source: https://github.com/tauri-apps/tauri/blob/dev/tooling/api/src/dpi.ts#L15
Properties
| Property | Type | Default value |
|---|---|---|
height | number | undefined |
type | string | 'Logical' |
width | number | undefined |
PhysicalPosition
A position represented in physical pixels.
Since
2.0.0
Constructors
new PhysicalPosition()
new PhysicalPosition(x, y): PhysicalPositionParameters
| Parameter | Type |
|---|---|
x | number |
y | number |
Returns
Source: https://github.com/tauri-apps/tauri/blob/dev/tooling/api/src/dpi.ts#L78
Properties
| Property | Type | Default value |
|---|---|---|
type | string | 'Physical' |
x | number | undefined |
y | number | undefined |
Methods
toLogical()
toLogical(scaleFactor): LogicalPositionConverts the physical position to a logical one.
Parameters
| Parameter | Type |
|---|---|
scaleFactor | number |
Returns
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);Source: https://github.com/tauri-apps/tauri/blob/dev/tooling/api/src/dpi.ts#L94
PhysicalSize
A size represented in physical pixels.
Since
2.0.0
Constructors
new PhysicalSize()
new PhysicalSize(width, height): PhysicalSizeParameters
| Parameter | Type |
|---|---|
width | number |
height | number |
Returns
Source: https://github.com/tauri-apps/tauri/blob/dev/tooling/api/src/dpi.ts#L31
Properties
| Property | Type | Default value |
|---|---|---|
height | number | undefined |
type | string | 'Physical' |
width | number | undefined |
Methods
toLogical()
toLogical(scaleFactor): LogicalSizeConverts the physical size to a logical one.
Parameters
| Parameter | Type |
|---|---|
scaleFactor | number |
Returns
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);Source: https://github.com/tauri-apps/tauri/blob/dev/tooling/api/src/dpi.ts#L47
© 2024 Tauri Contributors. CC-BY / MIT