mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-01-31 00:35:19 +01:00
docs: pixel units (#14702)
This commit is contained in:
@@ -262,7 +262,7 @@
|
||||
"type": "boolean"
|
||||
},
|
||||
"x": {
|
||||
"description": "The horizontal position of the window's top left corner",
|
||||
"description": "The horizontal position of the window's top left corner in logical pixels",
|
||||
"type": [
|
||||
"number",
|
||||
"null"
|
||||
@@ -270,7 +270,7 @@
|
||||
"format": "double"
|
||||
},
|
||||
"y": {
|
||||
"description": "The vertical position of the window's top left corner",
|
||||
"description": "The vertical position of the window's top left corner in logical pixels",
|
||||
"type": [
|
||||
"number",
|
||||
"null"
|
||||
@@ -278,19 +278,19 @@
|
||||
"format": "double"
|
||||
},
|
||||
"width": {
|
||||
"description": "The window width.",
|
||||
"description": "The window width in logical pixels.",
|
||||
"default": 800.0,
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"height": {
|
||||
"description": "The window height.",
|
||||
"description": "The window height in logical pixels.",
|
||||
"default": 600.0,
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"minWidth": {
|
||||
"description": "The min window width.",
|
||||
"description": "The min window width in logical pixels.",
|
||||
"type": [
|
||||
"number",
|
||||
"null"
|
||||
@@ -298,7 +298,7 @@
|
||||
"format": "double"
|
||||
},
|
||||
"minHeight": {
|
||||
"description": "The min window height.",
|
||||
"description": "The min window height in logical pixels.",
|
||||
"type": [
|
||||
"number",
|
||||
"null"
|
||||
@@ -306,7 +306,7 @@
|
||||
"format": "double"
|
||||
},
|
||||
"maxWidth": {
|
||||
"description": "The max window width.",
|
||||
"description": "The max window width in logical pixels.",
|
||||
"type": [
|
||||
"number",
|
||||
"null"
|
||||
@@ -314,7 +314,7 @@
|
||||
"format": "double"
|
||||
},
|
||||
"maxHeight": {
|
||||
"description": "The max window height.",
|
||||
"description": "The max window height in logical pixels.",
|
||||
"type": [
|
||||
"number",
|
||||
"null"
|
||||
@@ -652,13 +652,13 @@
|
||||
],
|
||||
"properties": {
|
||||
"width": {
|
||||
"description": "Horizontal margin in physical unit",
|
||||
"description": "Horizontal margin in physical pixels",
|
||||
"type": "integer",
|
||||
"format": "uint32",
|
||||
"minimum": 0.0
|
||||
},
|
||||
"height": {
|
||||
"description": "Vertical margin in physical unit",
|
||||
"description": "Vertical margin in physical pixels",
|
||||
"type": "integer",
|
||||
"format": "uint32",
|
||||
"minimum": 0.0
|
||||
|
||||
@@ -247,19 +247,19 @@ pub trait WindowBuilder: WindowBuilderBase {
|
||||
#[must_use]
|
||||
fn center(self) -> Self;
|
||||
|
||||
/// The initial position of the window's.
|
||||
/// The initial position of the window in logical pixels.
|
||||
#[must_use]
|
||||
fn position(self, x: f64, y: f64) -> Self;
|
||||
|
||||
/// Window size.
|
||||
/// Window size in logical pixels.
|
||||
#[must_use]
|
||||
fn inner_size(self, width: f64, height: f64) -> Self;
|
||||
|
||||
/// Window min inner size.
|
||||
/// Window min inner size in logical pixels.
|
||||
#[must_use]
|
||||
fn min_inner_size(self, min_width: f64, min_height: f64) -> Self;
|
||||
|
||||
/// Window max inner size.
|
||||
/// Window max inner size in logical pixels.
|
||||
#[must_use]
|
||||
fn max_inner_size(self, max_width: f64, max_height: f64) -> Self;
|
||||
|
||||
|
||||
@@ -262,7 +262,7 @@
|
||||
"type": "boolean"
|
||||
},
|
||||
"x": {
|
||||
"description": "The horizontal position of the window's top left corner",
|
||||
"description": "The horizontal position of the window's top left corner in logical pixels",
|
||||
"type": [
|
||||
"number",
|
||||
"null"
|
||||
@@ -270,7 +270,7 @@
|
||||
"format": "double"
|
||||
},
|
||||
"y": {
|
||||
"description": "The vertical position of the window's top left corner",
|
||||
"description": "The vertical position of the window's top left corner in logical pixels",
|
||||
"type": [
|
||||
"number",
|
||||
"null"
|
||||
@@ -278,19 +278,19 @@
|
||||
"format": "double"
|
||||
},
|
||||
"width": {
|
||||
"description": "The window width.",
|
||||
"description": "The window width in logical pixels.",
|
||||
"default": 800.0,
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"height": {
|
||||
"description": "The window height.",
|
||||
"description": "The window height in logical pixels.",
|
||||
"default": 600.0,
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"minWidth": {
|
||||
"description": "The min window width.",
|
||||
"description": "The min window width in logical pixels.",
|
||||
"type": [
|
||||
"number",
|
||||
"null"
|
||||
@@ -298,7 +298,7 @@
|
||||
"format": "double"
|
||||
},
|
||||
"minHeight": {
|
||||
"description": "The min window height.",
|
||||
"description": "The min window height in logical pixels.",
|
||||
"type": [
|
||||
"number",
|
||||
"null"
|
||||
@@ -306,7 +306,7 @@
|
||||
"format": "double"
|
||||
},
|
||||
"maxWidth": {
|
||||
"description": "The max window width.",
|
||||
"description": "The max window width in logical pixels.",
|
||||
"type": [
|
||||
"number",
|
||||
"null"
|
||||
@@ -314,7 +314,7 @@
|
||||
"format": "double"
|
||||
},
|
||||
"maxHeight": {
|
||||
"description": "The max window height.",
|
||||
"description": "The max window height in logical pixels.",
|
||||
"type": [
|
||||
"number",
|
||||
"null"
|
||||
@@ -652,13 +652,13 @@
|
||||
],
|
||||
"properties": {
|
||||
"width": {
|
||||
"description": "Horizontal margin in physical unit",
|
||||
"description": "Horizontal margin in physical pixels",
|
||||
"type": "integer",
|
||||
"format": "uint32",
|
||||
"minimum": 0.0
|
||||
},
|
||||
"height": {
|
||||
"description": "Vertical margin in physical unit",
|
||||
"description": "Vertical margin in physical pixels",
|
||||
"type": "integer",
|
||||
"format": "uint32",
|
||||
"minimum": 0.0
|
||||
|
||||
@@ -1593,9 +1593,9 @@ pub struct WindowEffectsConfig {
|
||||
#[cfg_attr(feature = "schema", derive(JsonSchema))]
|
||||
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
||||
pub struct PreventOverflowMargin {
|
||||
/// Horizontal margin in physical unit
|
||||
/// Horizontal margin in physical pixels
|
||||
pub width: u32,
|
||||
/// Vertical margin in physical unit
|
||||
/// Vertical margin in physical pixels
|
||||
pub height: u32,
|
||||
}
|
||||
|
||||
@@ -1673,26 +1673,26 @@ pub struct WindowConfig {
|
||||
/// Whether or not the window starts centered or not.
|
||||
#[serde(default)]
|
||||
pub center: bool,
|
||||
/// The horizontal position of the window's top left corner
|
||||
/// The horizontal position of the window's top left corner in logical pixels
|
||||
pub x: Option<f64>,
|
||||
/// The vertical position of the window's top left corner
|
||||
/// The vertical position of the window's top left corner in logical pixels
|
||||
pub y: Option<f64>,
|
||||
/// The window width.
|
||||
/// The window width in logical pixels.
|
||||
#[serde(default = "default_width")]
|
||||
pub width: f64,
|
||||
/// The window height.
|
||||
/// The window height in logical pixels.
|
||||
#[serde(default = "default_height")]
|
||||
pub height: f64,
|
||||
/// The min window width.
|
||||
/// The min window width in logical pixels.
|
||||
#[serde(alias = "min-width")]
|
||||
pub min_width: Option<f64>,
|
||||
/// The min window height.
|
||||
/// The min window height in logical pixels.
|
||||
#[serde(alias = "min-height")]
|
||||
pub min_height: Option<f64>,
|
||||
/// The max window width.
|
||||
/// The max window width in logical pixels.
|
||||
#[serde(alias = "max-width")]
|
||||
pub max_width: Option<f64>,
|
||||
/// The max window height.
|
||||
/// The max window height in logical pixels.
|
||||
#[serde(alias = "max-height")]
|
||||
pub max_height: Option<f64>,
|
||||
/// Whether or not to prevent the window from overflowing the workarea
|
||||
|
||||
@@ -465,28 +465,28 @@ impl<'a, R: Runtime, M: Manager<R>> WebviewWindowBuilder<'a, R, M> {
|
||||
self
|
||||
}
|
||||
|
||||
/// The initial position of the window's.
|
||||
/// The initial position of the window in logical pixels.
|
||||
#[must_use]
|
||||
pub fn position(mut self, x: f64, y: f64) -> Self {
|
||||
self.window_builder = self.window_builder.position(x, y);
|
||||
self
|
||||
}
|
||||
|
||||
/// Window size.
|
||||
/// Window size in logical pixels.
|
||||
#[must_use]
|
||||
pub fn inner_size(mut self, width: f64, height: f64) -> Self {
|
||||
self.window_builder = self.window_builder.inner_size(width, height);
|
||||
self
|
||||
}
|
||||
|
||||
/// Window min inner size.
|
||||
/// Window min inner size in logical pixels.
|
||||
#[must_use]
|
||||
pub fn min_inner_size(mut self, min_width: f64, min_height: f64) -> Self {
|
||||
self.window_builder = self.window_builder.min_inner_size(min_width, min_height);
|
||||
self
|
||||
}
|
||||
|
||||
/// Window max inner size.
|
||||
/// Window max inner size in logical pixels.
|
||||
#[must_use]
|
||||
pub fn max_inner_size(mut self, max_width: f64, max_height: f64) -> Self {
|
||||
self.window_builder = self.window_builder.max_inner_size(max_width, max_height);
|
||||
|
||||
@@ -443,28 +443,28 @@ impl<'a, R: Runtime, M: Manager<R>> WindowBuilder<'a, R, M> {
|
||||
self
|
||||
}
|
||||
|
||||
/// The initial position of the window's.
|
||||
/// The initial position of the window in logical pixels.
|
||||
#[must_use]
|
||||
pub fn position(mut self, x: f64, y: f64) -> Self {
|
||||
self.window_builder = self.window_builder.position(x, y);
|
||||
self
|
||||
}
|
||||
|
||||
/// Window size.
|
||||
/// Window size in logical pixels.
|
||||
#[must_use]
|
||||
pub fn inner_size(mut self, width: f64, height: f64) -> Self {
|
||||
self.window_builder = self.window_builder.inner_size(width, height);
|
||||
self
|
||||
}
|
||||
|
||||
/// Window min inner size.
|
||||
/// Window min inner size in logical pixels.
|
||||
#[must_use]
|
||||
pub fn min_inner_size(mut self, min_width: f64, min_height: f64) -> Self {
|
||||
self.window_builder = self.window_builder.min_inner_size(min_width, min_height);
|
||||
self
|
||||
}
|
||||
|
||||
/// Window max inner size.
|
||||
/// Window max inner size in logical pixels.
|
||||
#[must_use]
|
||||
pub fn max_inner_size(mut self, max_width: f64, max_height: f64) -> Self {
|
||||
self.window_builder = self.window_builder.max_inner_size(max_width, max_height);
|
||||
|
||||
@@ -714,13 +714,13 @@ interface WebviewOptions {
|
||||
* - local file path or route such as `/path/to/page.html` or `/users` is appended to the application URL (the devServer URL on development, or `tauri://localhost/` and `https://tauri.localhost/` on production).
|
||||
*/
|
||||
url?: string
|
||||
/** The initial vertical position. */
|
||||
/** The initial vertical position in logical pixels. */
|
||||
x: number
|
||||
/** The initial horizontal position. */
|
||||
/** The initial horizontal position in logical pixels. */
|
||||
y: number
|
||||
/** The initial width. */
|
||||
/** The initial width in logical pixels. */
|
||||
width: number
|
||||
/** The initial height. */
|
||||
/** The initial height in logical pixels. */
|
||||
height: number
|
||||
/**
|
||||
* Whether the webview is transparent or not.
|
||||
|
||||
@@ -2305,21 +2305,21 @@ interface PreventOverflowMargin {
|
||||
interface WindowOptions {
|
||||
/** Show window in the center of the screen.. */
|
||||
center?: boolean
|
||||
/** The initial vertical position. Only applies if `y` is also set. */
|
||||
/** The initial vertical position in logical pixels. Only applies if `y` is also set. */
|
||||
x?: number
|
||||
/** The initial horizontal position. Only applies if `x` is also set. */
|
||||
/** The initial horizontal position in logical pixels. Only applies if `x` is also set. */
|
||||
y?: number
|
||||
/** The initial width. */
|
||||
/** The initial width in logical pixels. */
|
||||
width?: number
|
||||
/** The initial height. */
|
||||
/** The initial height in logical pixels. */
|
||||
height?: number
|
||||
/** The minimum width. Only applies if `minHeight` is also set. */
|
||||
/** The minimum width in logical pixels. Only applies if `minHeight` is also set. */
|
||||
minWidth?: number
|
||||
/** The minimum height. Only applies if `minWidth` is also set. */
|
||||
/** The minimum height in logical pixels. Only applies if `minWidth` is also set. */
|
||||
minHeight?: number
|
||||
/** The maximum width. Only applies if `maxHeight` is also set. */
|
||||
/** The maximum width in logical pixels. Only applies if `maxHeight` is also set. */
|
||||
maxWidth?: number
|
||||
/** The maximum height. Only applies if `maxWidth` is also set. */
|
||||
/** The maximum height in logical pixels. Only applies if `maxWidth` is also set. */
|
||||
maxHeight?: number
|
||||
/**
|
||||
* Prevent the window from overflowing the working area (e.g. monitor size - taskbar size)
|
||||
|
||||
Reference in New Issue
Block a user