#multi-touch #graphics #rust #touchevents #inputmanagement

aloe-touch

Aloe-Touch is a Rust crate for managing multi-touch inputs with a focus on graphical interfaces. It employs generics to effectively track touch interactions. This crate is a translation of the c++ juce module serving the same function.

1 unstable release

Uses new Rust 2024

new 0.1.1 Apr 4, 2025

#1067 in #gui


Used in aloe-exports

GPL-3.0 license

625KB
4.5K SLoC

Aloe-Touch

Aloe-Touch is a Rust crate designed to provide a robust framework for managing multi-touch inputs in a software environment. Leveraging lifetimes and generics, Aloe-Touch offers precise and efficient handling of touch events, facilitating their integration within a graphical interface.

Features

  • Multi-Touch Mapping: Utilize MultiTouchMapper to efficiently track and manage concurrent touch inputs.
  • Touch Information Handling: Use MultiTouchMapperTouchInfo to encapsulate details about each touch, such as its unique identifier and associated component.
  • Touch State Management: Functions to check active touches, clear specific touches, or reset touch states.

Usage

To leverage Aloe-Touch in your project, incorporate the MultiTouchMapper to manage your touch events:

use aloe_touch::MultiTouchMapper;

let mut touch_mapper = MultiTouchMapper::default();

// Example: Add, clear, and check touch events as needed
touch_mapper.get_index_of_touch(peer, touch_id);
assert!(touch_mapper.are_any_touches_active());
touch_mapper.clear_touch(index);
touch_mapper.delete_all_touches_for_peer(peer);

Implementation Details

MultiTouchMapper

This struct provides the core functionality, encapsulating a vector of MultiTouchMapperTouchInfo objects. Through several methods, it enables:

  • Locating touches using get_index_of_touch.
  • Clearing all touches or specific ones using clear and clear_touch.
  • Checking for active touches via are_any_touches_active.

MultiTouchMapperTouchInfo

  • Fields:

    • touch_id: A generic identifier for the touch event.
    • owner: A mutable reference to the associated ComponentPeer.
  • Traits: Implements Default, PartialEq, and Eq for seamless comparison and default state management.

Contributions

This crate is open-source under the GPL-3.0 license. Contributions are welcome via GitHub.


This README was generated by an AI model and may not be 100% accurate; however, it should be a solid foundation.

This crate is a translation of the JUCE module.

JUCE is a c++ software framework for developing high performance audio applications.

Usage falls under the GPLv3 as well as the JUCE commercial license.

See github.com/juce-framework/JUCE and the JUCE license page for details.

This crate is in the process of being translated from c++ to rust. For progress updates, please see the workspacer rust project. designed specifically for rust projects.

Dependencies

~26–36MB
~602K SLoC