Skip to main content

HoverLift

Trait HoverLift 

Source
pub trait HoverLift:
    InteractiveElement
    + Styled
    + Sized {
    // Provided methods
    fn hover_lift(self, cx: &App) -> Self { ... }
    fn hover_lift_with(
        self,
        cx: &App,
        wash: impl FnOnce(StyleRefinement) -> StyleRefinement,
    ) -> Self { ... }
}
Expand description

The response a surface gives while the pointer is over it.

Provided Methods§

Source

fn hover_lift(self, cx: &App) -> Self

Raises the surface by motion.hoverLiftPx onto the raised elevation shadow while it is hovered.

The shadow does the work and the pixel of travel only sells it, so a theme that casts no shadow at all still gets a legible response.

Source

fn hover_lift_with( self, cx: &App, wash: impl FnOnce(StyleRefinement) -> StyleRefinement, ) -> Self

The same lift, folded into a hover style the caller already wanted.

GPUI allows exactly one hover style per element, so a surface that already washes its background on hover cannot ask for the lift separately; it asks for both at once. wash is applied whether or not motion is reduced, because a colour change is not motion.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§