[yew-devel] [PATCH yew-widget-toolkit] touch: side dialog: rename 'direction' to 'location'

Dominik Csapak d.csapak at proxmox.com
Tue Jul 1 08:57:14 CEST 2025


The type is a SideDialogLocation, so it's not a direction. Renaming the
property (and the methods automatically) to 'location' fixes that
inconsistency.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/touch/material_app.rs |  6 +++---
 src/touch/side_dialog.rs  | 10 +++++-----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/touch/material_app.rs b/src/touch/material_app.rs
index 271fb25..c8185c5 100644
--- a/src/touch/material_app.rs
+++ b/src/touch/material_app.rs
@@ -76,7 +76,7 @@ impl PageController {
     pub fn show_drawer(&self, drawer: impl Into<VNode>) {
         self.show_side_dialog(
             SideDialog::new()
-                .direction(SideDialogLocation::Left)
+                .location(SideDialogLocation::Left)
                 .with_child(drawer.into()),
         );
     }
@@ -87,7 +87,7 @@ impl PageController {
     pub fn show_end_drawer(&self, drawer: impl Into<VNode>) {
         self.show_side_dialog(
             SideDialog::new()
-                .direction(SideDialogLocation::Right)
+                .location(SideDialogLocation::Right)
                 .with_child(drawer.into()),
         );
     }
@@ -98,7 +98,7 @@ impl PageController {
     pub fn show_modal_bottom_sheet(&self, bottom_sheet: impl Into<VNode>) {
         self.show_side_dialog(
             SideDialog::new()
-                .direction(SideDialogLocation::Bottom)
+                .location(SideDialogLocation::Bottom)
                 .with_child(bottom_sheet.into()),
         );
     }
diff --git a/src/touch/side_dialog.rs b/src/touch/side_dialog.rs
index 01abcd9..6c15796 100644
--- a/src/touch/side_dialog.rs
+++ b/src/touch/side_dialog.rs
@@ -86,7 +86,7 @@ pub struct SideDialog {
 
     #[prop_or(SideDialogLocation::Left)]
     #[builder]
-    pub direction: SideDialogLocation,
+    pub location: SideDialogLocation,
 }
 
 impl ContainerBuilder for SideDialog {
@@ -274,7 +274,7 @@ impl Component for PwtSideDialog {
                 let mut dismiss = false;
                 let threshold = 100.0;
                 if let Some((delta_x, delta_y)) = self.drag_delta {
-                    dismiss = match props.direction {
+                    dismiss = match props.location {
                         SideDialogLocation::Left => delta_x < -threshold,
                         SideDialogLocation::Right => delta_x > threshold,
                         SideDialogLocation::Top => delta_y < -threshold,
@@ -300,7 +300,7 @@ impl Component for PwtSideDialog {
             }
             Msg::Swipe(event) => {
                 let angle = event.direction; // -180 to + 180
-                let dismiss = match props.direction {
+                let dismiss = match props.location {
                     SideDialogLocation::Left => !(-135.0..=135.0).contains(&angle),
                     SideDialogLocation::Right => angle > -45.0 && angle < 45.0,
                     SideDialogLocation::Top => angle > 45.0 && angle < 135.0,
@@ -338,7 +338,7 @@ impl Component for PwtSideDialog {
             SliderState::Visible | SliderState::SlideIn => "visible",
         };
 
-        let slider_direction_class = match props.direction {
+        let slider_direction_class = match props.location {
             SideDialogLocation::Left => "pwt-side-dialog-left",
             SideDialogLocation::Right => "pwt-side-dialog-right",
             SideDialogLocation::Top => "pwt-side-dialog-top",
@@ -349,7 +349,7 @@ impl Component for PwtSideDialog {
         let mut transition = None;
         if let Some((delta_x, delta_y)) = self.drag_delta {
             transition = Some("none");
-            match props.direction {
+            match props.location {
                 SideDialogLocation::Left => {
                     let delta_x = delta_x.min(0.0);
                     transform = Some(format!("translateX({delta_x}px)"));
-- 
2.39.5





More information about the yew-devel mailing list