Skip to content

Commit c67fd91

Browse files
committed
Add a zoomFactor window option
This commit allows to define a zoom factor for new and existing windows. The zoom factor is the zoom percent divided by 100, so 150% = 1.5.
1 parent 7976260 commit c67fd91

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

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)