summaryrefslogtreecommitdiff
path: root/engine/src/ui
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2026-11-02 05:13:42 +0100
committerHampusM <hampus@hampusmat.com>2026-11-02 05:13:42 +0100
commitb15824514239e37c4c7304d018d9f493e26718ee (patch)
tree1559d3820c39c333d372522620a07515f102b65c /engine/src/ui
parent62a6cafe329e965cf03c055994a581010bae8071 (diff)
fix(engine): prevent adding component to entity of sole in world UI view
Diffstat (limited to 'engine/src/ui')
-rw-r--r--engine/src/ui/view/world.rs22
1 files changed, 18 insertions, 4 deletions
diff --git a/engine/src/ui/view/world.rs b/engine/src/ui/view/world.rs
index 4685747..bf92859 100644
--- a/engine/src/ui/view/world.rs
+++ b/engine/src/ui/view/world.rs
@@ -488,10 +488,24 @@ fn create_add_component_button_widget(
[90.0, 162.0, 51.0, 255.0].map(|num| num / 255.0),
);
- let is_button_clicked = frame.button(format!(
- "+##add_component_to_entity_button_{}",
- ent_handle.uid()
- ));
+ let ent_is_sole = ent_handle.has_component::<IsSole>();
+
+ let is_button_clicked = {
+ let _disabled_token = frame.begin_disabled_with_cond(ent_is_sole);
+
+ frame.button(format!(
+ "+##add_component_to_entity_button_{}",
+ ent_handle.uid()
+ ))
+ };
+
+ if ent_is_sole {
+ if frame.is_item_hovered_with_flags(
+ dear_imgui_bindings::ItemHoveredFlags::ALLOW_WHEN_DISABLED,
+ ) {
+ frame.tooltip_text("Cannot add a component to the entity of a sole");
+ }
+ }
if is_button_clicked {
enter_add_component_popup_state(popup_state, ent_handle, ent_title, world);