panel: per-element interactibility

This commit is contained in:
galister
2025-10-31 17:32:10 +09:00
parent 01d11e8485
commit fa562f7b12
19 changed files with 423 additions and 361 deletions

View File

@@ -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(())
}
}