Skip to main content

Crate cranpose_foundation

Crate cranpose_foundation 

Source
Expand description

§Cranpose Foundation

cranpose-foundation defines shared modifier-node, input, focus, text and semantics contracts for Cranpose UI. Framework extension authors use the crate to add modifier nodes and input handlers. App developers usually start with the widgets and Modifier type from cranpose.

§Handle a pointer event

PointerEvent carries event kind and logical pointer positions. The platform adapter converts device coordinates before the UI layer receives an event.

use cranpose_foundation::{PointerEvent, PointerEventKind};
use cranpose_ui_graphics::Point;

let position = Point::new(24.0, 32.0);
let event = PointerEvent::new(PointerEventKind::Down, position, position);

Custom modifier nodes use ModifierNode, ModifierNodeElement and the impl_modifier_node! helper. cranpose-ui supplies Modifier::from_element as the app-facing entry point. See the ModifierNode API, the modifier guide and the crate source.

The feature set is empty. The dependency set stays platform-neutral.

Re-exports§

pub use gesture_constants::DRAG_THRESHOLD;
pub use gesture_constants::MAX_FLING_VELOCITY;
pub use gesture_constants::MINIMUM_TOUCH_TARGET_SIZE;
pub use nodes::input::DEFAULT_ROTARY_SCROLL_FACTOR_DP;
pub use nodes::input::Modifiers;
pub use nodes::input::PointerButton;
pub use nodes::input::PointerButtons;
pub use nodes::input::PointerEvent;
pub use nodes::input::PointerEventKind;
pub use nodes::input::PointerId;
pub use nodes::input::PointerPhase;
pub use nodes::input::PointerSource;
pub use nodes::input::RotaryScrollEvent;
pub use nodes::input::RotaryStepAccumulator;
pub use nodes::input::rotary_scroll_pixels_from_detents;
pub use velocity_tracker::VelocityTracker1D;
pub use modifier::*;
pub use modifier_helpers::*;

Modules§

gesture_constants
Shared gesture constants for consistent touch/pointer handling.
lazy
Lazy layout system for Cranpose.
modifier
Modifier node scaffolding for Cranpose.
modifier_helpers
Helper macros to reduce boilerplate when implementing modifier nodes.
nodes
prelude
text
Text input module for editable text fields.
velocity_tracker
Velocity tracking for fling gesture support.

Macros§

impl_draw_node
Implements the as_draw_node methods for a type that implements DrawModifierNode.
impl_focus_node
Implements the as_focus_node methods for a type that implements FocusNode.
impl_modifier_node
Comprehensive macro that implements all capability-based methods for a modifier node.
impl_pointer_input_node
Implements the as_pointer_input_node methods for a type that implements PointerInputNode.
impl_semantics_node
Implements the as_semantics_node methods for a type that implements SemanticsNode.