Skip to content

Commit 6eb297b

Browse files
authored
Add support for setting zoom factor on windows (#678)
1 parent 7976260 commit 6eb297b

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/Facades/Window.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* @method static void reload($id = null)
1818
* @method static void maximize($id = null)
1919
* @method static void minimize($id = null)
20+
* @method static void zoomFactor(float $zoomFactor = 1.0)
2021
*/
2122
class Window extends Facade
2223
{

src/Windows/Window.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ class Window
6868

6969
protected array $webPreferences = [];
7070

71+
protected float $zoomFactor = 1.0;
72+
7173
public function __construct(string $id)
7274
{
7375
$this->id = $id;
@@ -326,6 +328,20 @@ public function webPreferences(array $preferences): static
326328
return $this;
327329
}
328330

331+
public function zoomFactor(float $zoomFactor = 1.0): self
332+
{
333+
$this->zoomFactor = $zoomFactor;
334+
335+
if (! $this instanceof PendingOpenWindow) {
336+
$this->client->post('window/set-zoom-factor', [
337+
'id' => $this->id,
338+
'zoomFactor' => $zoomFactor,
339+
]);
340+
}
341+
342+
return $this;
343+
}
344+
329345
public function toArray()
330346
{
331347
return [
@@ -364,6 +380,7 @@ public function toArray()
364380
'autoHideMenuBar' => $this->autoHideMenuBar,
365381
'transparent' => $this->transparent,
366382
'webPreferences' => $this->webPreferences,
383+
'zoomFactor' => $this->zoomFactor,
367384
];
368385
}
369386

0 commit comments

Comments
 (0)