panel: per-element interactibility
This commit is contained in:
@@ -8,7 +8,7 @@ mod widget_rectangle;
|
||||
mod widget_sprite;
|
||||
|
||||
use crate::{
|
||||
assets::{AssetPath, AssetPathOwned, normalize_path},
|
||||
assets::{normalize_path, AssetPath, AssetPathOwned},
|
||||
components::{Component, ComponentWeak},
|
||||
drawing::{self},
|
||||
globals::WguiGlobals,
|
||||
@@ -782,6 +782,14 @@ fn parse_widget_universal(ctx: &mut ParserContext, widget_id: WidgetID, attribs:
|
||||
// Attach a specific widget to name-ID map (just like getElementById)
|
||||
ctx.insert_id(&pair.value, widget_id);
|
||||
}
|
||||
"interactable" => {
|
||||
if let Ok(0) = &pair.value.parse::<i32>() {
|
||||
log::info!("setting {widget_id:?} to noninteractable.");
|
||||
ctx.layout.state.widgets.get(widget_id).unwrap().state().interactable = false;
|
||||
} else {
|
||||
print_invalid_attrib(&pair.attrib, &pair.value);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
@@ -1073,4 +1081,4 @@ fn parse_document_root(
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
layout::WidgetID,
|
||||
parser::{AttribPair, ParserContext, ParserFile, parse_children, parse_widget_universal, style::parse_style},
|
||||
parser::{parse_children, parse_widget_universal, style::parse_style, AttribPair, ParserContext, ParserFile},
|
||||
widget::div::WidgetDiv,
|
||||
};
|
||||
|
||||
@@ -19,4 +19,4 @@ pub fn parse_widget_div<'a>(
|
||||
parse_children(file, ctx, node, widget.id)?;
|
||||
|
||||
Ok(widget.id)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user