From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 480161FF187 for ; Mon, 30 Jun 2025 10:25:10 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id C720916463; Mon, 30 Jun 2025 10:25:48 +0200 (CEST) From: Dominik Csapak To: yew-devel@lists.proxmox.com Date: Mon, 30 Jun 2025 10:25:02 +0200 Message-Id: <20250630082509.1202308-13-d.csapak@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250630082509.1202308-1-d.csapak@proxmox.com> References: <20250630082509.1202308-1-d.csapak@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.022 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [yew-devel] [PATCH yew-widget-toolkit v2 05/12] touch: page stack: don't use animation by default X-BeenThere: yew-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Yew framework devel list at Proxmox List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Yew framework devel list at Proxmox Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: yew-devel-bounces@lists.proxmox.com Sender: "yew-devel" only when set from outside. This changes the type to an `Oprtion` and omits the state change to grow/shrink when the animation_style is `None` to not show an animation in that case. Signed-off-by: Dominik Csapak --- new in v2 src/touch/page_stack.rs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/touch/page_stack.rs b/src/touch/page_stack.rs index bb05058..42299ae 100644 --- a/src/touch/page_stack.rs +++ b/src/touch/page_stack.rs @@ -1,5 +1,6 @@ use std::rc::Rc; +use yew::html::IntoPropValue; use yew::prelude::*; use yew::virtual_dom::{VComp, VNode}; //use yew::html::IntoEventCallback; @@ -41,8 +42,8 @@ pub struct PageStack { #[prop_or_default] stack: Vec, - #[prop_or(PageAnimationStyle::Push)] - animation_style: PageAnimationStyle, + #[prop_or_default] + animation_style: Option, } impl PageStack { @@ -50,8 +51,11 @@ impl PageStack { yew::props!(Self { stack: pages }) } - pub fn animation_style(mut self, style: PageAnimationStyle) -> Self { - self.animation_style = style; + pub fn animation_style( + mut self, + style: impl IntoPropValue>, + ) -> Self { + self.animation_style = style.into_prop_value(); self } } @@ -112,10 +116,12 @@ impl Component for PwtPageStack { let props = ctx.props(); if let Some(last) = self.stack.last() { - match props.stack.len().cmp(&self.stack.len()) { - std::cmp::Ordering::Less => self.state = ViewState::Shrink(last.clone()), - std::cmp::Ordering::Greater => self.state = ViewState::Grow(last.clone()), - _ => {} + if props.animation_style.is_some() { + match props.stack.len().cmp(&self.stack.len()) { + std::cmp::Ordering::Less => self.state = ViewState::Shrink(last.clone()), + std::cmp::Ordering::Greater => self.state = ViewState::Grow(last.clone()), + _ => {} + } } } -- 2.39.5 _______________________________________________ yew-devel mailing list yew-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/yew-devel