From c67fd915b5a7e74f1efe8499251b13d2aef3e778 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Gl=C3=BCck?= Date: Wed, 13 Aug 2025 19:59:34 +0200 Subject: [PATCH] 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. --- src/Windows/Window.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Windows/Window.php b/src/Windows/Window.php index 92af58b..245ae0b 100644 --- a/src/Windows/Window.php +++ b/src/Windows/Window.php @@ -68,6 +68,8 @@ class Window protected array $webPreferences = []; + protected float $zoomFactor = 1.0; + public function __construct(string $id) { $this->id = $id; @@ -326,6 +328,20 @@ public function webPreferences(array $preferences): static return $this; } + public function zoomFactor(float $zoomFactor = 1.0): self + { + $this->zoomFactor = $zoomFactor; + + if (! $this instanceof PendingOpenWindow) { + $this->client->post('window/set-zoom-factor', [ + 'id' => $this->id, + 'zoomFactor' => $zoomFactor, + ]); + } + + return $this; + } + public function toArray() { return [ @@ -364,6 +380,7 @@ public function toArray() 'autoHideMenuBar' => $this->autoHideMenuBar, 'transparent' => $this->transparent, 'webPreferences' => $this->webPreferences, + 'zoomFactor' => $this->zoomFactor, ]; }