From 5996b6b46bd3bd69703a8ebf3c68f13c2faf9f30 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 23 Aug 2023 12:18:12 -0600 Subject: [PATCH] Use RefinementCascade to compose pressability and hoverability Co-Authored-By: Conrad Irwin --- crates/gpui/playground/src/div.rs | 23 +++--- crates/gpui/playground/src/element.rs | 32 ++++---- crates/gpui/playground/src/hoverable.rs | 33 ++++---- crates/gpui/playground/src/playground.rs | 5 +- crates/gpui/playground/src/pressable.rs | 81 +++++++++++++++++++ crates/gpui/playground/src/style.rs | 38 ++++----- .../playground_macros/src/derive_element.rs | 10 +-- .../src/styleable_helpers.rs | 1 + crates/gpui/src/app.rs | 1 - crates/refineable/src/refineable.rs | 46 ++++++++++- 10 files changed, 202 insertions(+), 68 deletions(-) create mode 100644 crates/gpui/playground/src/pressable.rs diff --git a/crates/gpui/playground/src/div.rs b/crates/gpui/playground/src/div.rs index 8efe359025..73f196b4f0 100644 --- a/crates/gpui/playground/src/div.rs +++ b/crates/gpui/playground/src/div.rs @@ -3,21 +3,22 @@ use crate::{ interactive::{InteractionHandlers, Interactive}, layout_context::LayoutContext, paint_context::PaintContext, - style::{Style, StyleHelpers, StyleRefinement, Styleable}, + style::{Style, StyleHelpers, Styleable}, }; use anyhow::Result; use gpui::LayoutId; +use refineable::{Refineable, RefinementCascade}; use smallvec::SmallVec; pub struct Div { - style: StyleRefinement, + styles: RefinementCascade