dpi
此内容尚不支持你的语言。
Classes
LogicalPosition
A position represented in logical pixels.
Since
2.0.0
Constructors
new LogicalPosition()
new LogicalPosition(x, y): LogicalPosition
Parameters
Parameter | Type |
---|---|
x | number |
y | number |
Returns
Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/dpi.ts#L62
Properties
Property | Type | Default value | Defined in |
---|---|---|---|
type | string | 'Logical' | Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/dpi.ts#L58 |
x | number | undefined | Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/dpi.ts#L59 |
y | number | undefined | Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/dpi.ts#L60 |
LogicalSize
A size represented in logical pixels.
Since
2.0.0
Constructors
new LogicalSize()
new LogicalSize(width, height): LogicalSize
Parameters
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 |
PhysicalPosition
A position represented in physical pixels.
Since
2.0.0
Constructors
new PhysicalPosition()
new PhysicalPosition(x, y): PhysicalPosition
Parameters
Parameter | Type |
---|---|
x | number |
y | number |
Returns
Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/dpi.ts#L78
Properties
Property | Type | Default value | Defined in |
---|---|---|---|
type | string | 'Physical' | Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/dpi.ts#L74 |
x | number | undefined | Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/dpi.ts#L75 |
y | number | undefined | Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/dpi.ts#L76 |
Methods
toLogical()
toLogical(scaleFactor): LogicalPosition
Converts 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#L94
PhysicalSize
A size represented in physical pixels.
Since
2.0.0
Constructors
new PhysicalSize()
new PhysicalSize(width, height): PhysicalSize
Parameters
Parameter | Type |
---|---|
width | number |
height | number |
Returns
Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/dpi.ts#L31
Properties
Property | Type | Default value | Defined in |
---|---|---|---|
height | number | undefined | Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/dpi.ts#L29 |
type | string | 'Physical' | Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/dpi.ts#L27 |
width | number | undefined | Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/dpi.ts#L28 |
Methods
toLogical()
toLogical(scaleFactor): LogicalSize
Converts 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#L47
© 2024 Tauri Contributors. CC-BY / MIT