feat: allow partial setting of window bounds (#15677)
Extend the existing win.setBounds functionality by allowing developers to partially update bounds without being forced to pass in all four bounds values. No existing functionality is altere
This commit is contained in:
parent
0c46a7a4d9
commit
c06f023313
3 changed files with 44 additions and 1 deletions
|
@ -896,7 +896,21 @@ Closes the currently open [Quick Look][quick-look] panel.
|
|||
* `bounds` [Rectangle](structures/rectangle.md)
|
||||
* `animate` Boolean (optional) _macOS_
|
||||
|
||||
Resizes and moves the window to the supplied bounds
|
||||
Resizes and moves the window to the supplied bounds. Any properties that are not supplied will default to their current values.
|
||||
|
||||
```javascript
|
||||
const { BrowserWindow } = require('electron')
|
||||
const win = new BrowserWindow()
|
||||
|
||||
// set all bounds properties
|
||||
win.setBounds({ x: 440, y: 225, width: 800, height: 600 })
|
||||
|
||||
// set a single bounds property
|
||||
win.setBounds({ width: 100 })
|
||||
|
||||
// { x: 440, y: 225, width: 100, height: 600 }
|
||||
console.log(win.getBounds())
|
||||
```
|
||||
|
||||
#### `win.getBounds()`
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue