mirror of https://github.com/wayvr-org/wayvr.git
on_custom_attribs Box → Rc
This commit is contained in:
parent
e535c5fe94
commit
1257be6cc4
|
|
@ -8,9 +8,9 @@ use glam::Vec2;
|
|||
use wgui::{
|
||||
assets::AssetPath,
|
||||
components::{
|
||||
Component,
|
||||
button::{ButtonClickCallback, ComponentButton},
|
||||
checkbox::ComponentCheckbox,
|
||||
Component,
|
||||
},
|
||||
drawing::Color,
|
||||
event::StyleSetRequest,
|
||||
|
|
@ -90,7 +90,7 @@ impl TestbedGeneric {
|
|||
)?;
|
||||
|
||||
let extra = ParseDocumentExtra {
|
||||
on_custom_attribs: Some(Box::new(move |par| {
|
||||
on_custom_attribs: Some(Rc::new(move |par| {
|
||||
let Some(my_custom_value) = par.get_value("_my_custom") else {
|
||||
return;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1069,9 +1069,9 @@ impl CustomAttribsInfoOwned {
|
|||
}
|
||||
}
|
||||
|
||||
pub type OnCustomAttribsFunc = Box<dyn Fn(CustomAttribsInfo)>;
|
||||
pub type OnCustomAttribsFunc = Rc<dyn Fn(CustomAttribsInfo)>;
|
||||
|
||||
#[derive(Default)]
|
||||
#[derive(Default, Clone)]
|
||||
pub struct ParseDocumentExtra {
|
||||
pub on_custom_attribs: Option<OnCustomAttribsFunc>, // all attributes with '_' character prepended
|
||||
pub dev_mode: bool,
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ impl<S: 'static> GuiPanel<S> {
|
|||
AssetPath::FileOrBuiltIn(path)
|
||||
},
|
||||
extra: wgui::parser::ParseDocumentExtra {
|
||||
on_custom_attribs: Some(Box::new({
|
||||
on_custom_attribs: Some(Rc::new({
|
||||
let custom_elems = custom_elems.clone();
|
||||
move |attribs| {
|
||||
custom_elems.borrow_mut().push(attribs.to_owned());
|
||||
|
|
|
|||
Loading…
Reference in New Issue