egui_cable 0.9.0

A generic and extensible data-oriented widget for connecting ports by cables
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::sync::Arc;

use egui::Id;

#[derive(Clone)]
pub struct PortParams {
    pub hovered: bool,
}

impl PortParams {
    pub fn get(ui: &mut egui::Ui) -> Arc<Self> {
        ui.data_mut(|data| data.get_persisted::<Arc<PortParams>>(Id::NULL).unwrap())
    }

    pub(crate) fn set(self, ui: &mut egui::Ui) {
        ui.data_mut(|data| data.insert_persisted(Id::NULL, Arc::new(self)));
    }
}