@tauri-apps/api
Advanced tools
Comparing version 2.0.0-beta.7 to 2.0.0-beta.8
@@ -133,5 +133,6 @@ import { MenuItem } from './menuItem.js'; | ||
if (at) { | ||
atValue = { | ||
type: at instanceof PhysicalPosition ? 'Physical' : 'Logical', | ||
data: at | ||
atValue = {}; | ||
atValue[`${at instanceof PhysicalPosition ? 'Physical' : 'Logical'}`] = { | ||
x: at.x, | ||
y: at.y | ||
}; | ||
@@ -138,0 +139,0 @@ } |
@@ -151,5 +151,6 @@ import { MenuItem } from './menuItem.js'; | ||
if (at) { | ||
atValue = { | ||
type: at instanceof PhysicalPosition ? 'Physical' : 'Logical', | ||
data: at | ||
atValue = {}; | ||
atValue[`${at instanceof PhysicalPosition ? 'Physical' : 'Logical'}`] = { | ||
x: at.x, | ||
y: at.y | ||
}; | ||
@@ -156,0 +157,0 @@ } |
{ | ||
"name": "@tauri-apps/api", | ||
"version": "2.0.0-beta.7", | ||
"version": "2.0.0-beta.8", | ||
"description": "Tauri API definitions", | ||
@@ -5,0 +5,0 @@ "funding": { |
@@ -278,2 +278,13 @@ /** | ||
/** | ||
* Set webview zoom level. | ||
* @example | ||
* ```typescript | ||
* import { getCurrent } from '@tauri-apps/api/webview'; | ||
* await getCurrent().setZoom(1.5); | ||
* ``` | ||
* | ||
* @returns A promise indicating the success or failure of the operation. | ||
*/ | ||
setZoom(scaleFactor: number): Promise<void>; | ||
/** | ||
* Moves this webview to the given label. | ||
@@ -376,4 +387,16 @@ * @example | ||
proxyUrl?: string; | ||
/** | ||
* Whether page zooming by hotkeys is enabled | ||
* | ||
* ## Platform-specific: | ||
* | ||
* - **Windows**: Controls WebView2's [`IsZoomControlEnabled`](https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/winrt/microsoft_web_webview2_core/corewebview2settings?view=webview2-winrt-1.0.2420.47#iszoomcontrolenabled) setting. | ||
* - **MacOS / Linux**: Injects a polyfill that zooms in and out with `ctrl/command` + `-/=`, | ||
* 20% in each step, ranging from 20% to 1000%. Requires `webview:allow-set-webview-zoom` permission | ||
* | ||
* - **Android / iOS**: Unsupported. | ||
*/ | ||
zoomHotkeysEnabled?: boolean; | ||
} | ||
export { Webview, getCurrent, getAll }; | ||
export type { DragDropEvent, DragDropPayload, WebviewOptions }; |
@@ -345,11 +345,10 @@ import { PhysicalPosition, PhysicalSize } from './dpi.js'; | ||
} | ||
const value = {}; | ||
value[`${size.type}`] = { | ||
width: size.width, | ||
height: size.height | ||
}; | ||
return invoke('plugin:webview|set_webview_size', { | ||
label: this.label, | ||
value: { | ||
type: size.type, | ||
data: { | ||
width: size.width, | ||
height: size.height | ||
} | ||
} | ||
value | ||
}); | ||
@@ -373,11 +372,10 @@ } | ||
} | ||
const value = {}; | ||
value[`${position.type}`] = { | ||
x: position.x, | ||
y: position.y | ||
}; | ||
return invoke('plugin:webview|set_webview_position', { | ||
label: this.label, | ||
value: { | ||
type: position.type, | ||
data: { | ||
x: position.x, | ||
y: position.y | ||
} | ||
} | ||
value | ||
}); | ||
@@ -401,2 +399,18 @@ } | ||
/** | ||
* Set webview zoom level. | ||
* @example | ||
* ```typescript | ||
* import { getCurrent } from '@tauri-apps/api/webview'; | ||
* await getCurrent().setZoom(1.5); | ||
* ``` | ||
* | ||
* @returns A promise indicating the success or failure of the operation. | ||
*/ | ||
async setZoom(scaleFactor) { | ||
return invoke('plugin:webview|set_webview_zoom', { | ||
label: this.label, | ||
value: scaleFactor | ||
}); | ||
} | ||
/** | ||
* Moves this webview to the given label. | ||
@@ -403,0 +417,0 @@ * @example |
@@ -1027,11 +1027,10 @@ import { PhysicalPosition, PhysicalSize } from './dpi.js'; | ||
} | ||
const value = {}; | ||
value[`${size.type}`] = { | ||
width: size.width, | ||
height: size.height | ||
}; | ||
return invoke('plugin:window|set_size', { | ||
label: this.label, | ||
value: { | ||
type: size.type, | ||
data: { | ||
width: size.width, | ||
height: size.height | ||
} | ||
} | ||
value | ||
}); | ||
@@ -1054,13 +1053,13 @@ } | ||
} | ||
let value = null; | ||
if (size) { | ||
value = {}; | ||
value[`${size.type}`] = { | ||
width: size.width, | ||
height: size.height | ||
}; | ||
} | ||
return invoke('plugin:window|set_min_size', { | ||
label: this.label, | ||
value: size | ||
? { | ||
type: size.type, | ||
data: { | ||
width: size.width, | ||
height: size.height | ||
} | ||
} | ||
: null | ||
value | ||
}); | ||
@@ -1083,13 +1082,13 @@ } | ||
} | ||
let value = null; | ||
if (size) { | ||
value = {}; | ||
value[`${size.type}`] = { | ||
width: size.width, | ||
height: size.height | ||
}; | ||
} | ||
return invoke('plugin:window|set_max_size', { | ||
label: this.label, | ||
value: size | ||
? { | ||
type: size.type, | ||
data: { | ||
width: size.width, | ||
height: size.height | ||
} | ||
} | ||
: null | ||
value | ||
}); | ||
@@ -1113,11 +1112,10 @@ } | ||
} | ||
const value = {}; | ||
value[`${position.type}`] = { | ||
x: position.x, | ||
y: position.y | ||
}; | ||
return invoke('plugin:window|set_position', { | ||
label: this.label, | ||
value: { | ||
type: position.type, | ||
data: { | ||
x: position.x, | ||
y: position.y | ||
} | ||
} | ||
value | ||
}); | ||
@@ -1283,11 +1281,10 @@ } | ||
} | ||
const value = {}; | ||
value[`${position.type}`] = { | ||
x: position.x, | ||
y: position.y | ||
}; | ||
return invoke('plugin:window|set_cursor_position', { | ||
label: this.label, | ||
value: { | ||
type: position.type, | ||
data: { | ||
x: position.x, | ||
y: position.y | ||
} | ||
} | ||
value | ||
}); | ||
@@ -1294,0 +1291,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
546878
13665