feat: added double tap to the whole title bar

ivanpasq created

Change summary

crates/title_bar/src/platform_title_bar.rs | 26 ++++++++++++++++-------
1 file changed, 18 insertions(+), 8 deletions(-)

Detailed changes

crates/title_bar/src/platform_title_bar.rs 🔗

@@ -100,6 +100,24 @@ impl Render for PlatformTitleBar {
                     }
                 }))
             })
+            .map(|this| {
+                // Note: On Windows the title bar behavior is handled by the platform implementation.
+                this.id(self.id.clone())
+                    .when(self.platform_style == PlatformStyle::Mac, |this| {
+                        this.on_click(|event, window, _| {
+                            if event.click_count() == 2 {
+                                window.titlebar_double_click();
+                            }
+                        })
+                    })
+                    .when(self.platform_style == PlatformStyle::Linux, |this| {
+                        this.on_click(|event, window, _| {
+                            if event.click_count() == 2 {
+                                window.zoom_window();
+                            }
+                        })
+                    })
+            })
             .map(|this| {
                 if window.is_fullscreen() {
                     this.pl_2()
@@ -135,14 +153,6 @@ impl Render for PlatformTitleBar {
                     .justify_between()
                     .overflow_x_hidden()
                     .w_full()
-                    // Note: On Windows the title bar behavior is handled by the platform implementation.
-                    .when(self.platform_style == PlatformStyle::Linux, |this| {
-                        this.on_click(|event, window, _| {
-                            if event.click_count() == 2 {
-                                window.zoom_window();
-                            }
-                        })
-                    })
                     .children(children),
             )
             .when(!window.is_fullscreen(), |title_bar| {