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/packages/api/src/dpi.ts#L79
Properties
| Property | Type | Default value | Defined in | 
|---|---|---|---|
 type | string | 'Logical' | Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/dpi.ts#L75 | 
 x | number | undefined | Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/dpi.ts#L76 | 
 y | number | undefined | Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/dpi.ts#L77 | 
Methods
toPhysical()
toPhysical(scaleFactor): PhysicalPositionConverts the logical position to a physical one.
Parameters
| Parameter | Type | 
|---|---|
scaleFactor | number | 
Returns
Example
import { getCurrentWindow } from '@tauri-apps/api/window';const appWindow = getCurrentWindow();const factor = await appWindow.scaleFactor();const position = new LogicalPosition(400, 500);const physical = position.toPhysical(factor);Since
2.0.0
Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/dpi.ts#L97
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/packages/api/src/dpi.ts#L15
Properties
| Property | Type | Default value | Defined in | 
|---|---|---|---|
 height | number | undefined | Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/dpi.ts#L13 | 
 type | string | 'Logical' | Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/dpi.ts#L11 | 
 width | number | undefined | Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/dpi.ts#L12 | 
Methods
toPhysical()
toPhysical(scaleFactor): PhysicalSizeConverts the logical size to a physical one.
Parameters
| Parameter | Type | 
|---|---|
scaleFactor | number | 
Returns
Example
import { getCurrentWindow } from '@tauri-apps/api/window';const appWindow = getCurrentWindow();const factor = await appWindow.scaleFactor();const size = new LogicalSize(400, 500);const physical = size.toPhysical(factor);Since
2.0.0
Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/dpi.ts#L33
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/packages/api/src/dpi.ts#L112
Properties
| Property | Type | Default value | Defined in | 
|---|---|---|---|
 type | string | 'Physical' | Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/dpi.ts#L108 | 
 x | number | undefined | Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/dpi.ts#L109 | 
 y | number | undefined | Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/dpi.ts#L110 | 
Methods
toLogical()
toLogical(scaleFactor): LogicalPositionConverts the physical position to a logical one.
Parameters
| Parameter | Type | 
|---|---|
scaleFactor | number | 
Returns
Example
import { getCurrentWindow } from '@tauri-apps/api/window';const appWindow = getCurrentWindow();const factor = await appWindow.scaleFactor();const position = await appWindow.innerPosition();const logical = position.toLogical(factor);Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/dpi.ts#L128
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/packages/api/src/dpi.ts#L48
Properties
| Property | Type | Default value | Defined in | 
|---|---|---|---|
 height | number | undefined | Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/dpi.ts#L46 | 
 type | string | 'Physical' | Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/dpi.ts#L44 | 
 width | number | undefined | Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/dpi.ts#L45 | 
Methods
toLogical()
toLogical(scaleFactor): LogicalSizeConverts the physical size to a logical one.
Parameters
| Parameter | Type | 
|---|---|
scaleFactor | number | 
Returns
Example
import { getCurrentWindow } from '@tauri-apps/api/window';const appWindow = getCurrentWindow();const factor = await appWindow.scaleFactor();const size = await appWindow.innerSize();const logical = size.toLogical(factor);Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/dpi.ts#L64
© 2024 Tauri Contributors. CC-BY / MIT