watch controls for edit mode

This commit is contained in:
galister
2025-11-25 23:13:14 +09:00
parent 8bd1097886
commit 3f907180f8
17 changed files with 424 additions and 130 deletions

View File

@@ -7,7 +7,7 @@ use wgui::{
assets::AssetPath,
drawing,
event::{
Event as WguiEvent, EventCallback, EventListenerID, EventListenerKind,
Event as WguiEvent, EventAlterables, EventCallback, EventListenerID, EventListenerKind,
InternalStateChangeEvent, MouseButtonIndex, MouseDownEvent, MouseLeaveEvent,
MouseMotionEvent, MouseUpEvent, MouseWheelEvent,
},
@@ -15,6 +15,7 @@ use wgui::{
layout::{Layout, LayoutParams, WidgetID},
parser::{CustomAttribsInfoOwned, ParserState},
renderer_vk::context::Context as WguiContext,
taffy,
widget::{label::WidgetLabel, rectangle::WidgetRectangle, EventResult},
};
@@ -220,6 +221,22 @@ impl<S: 'static> GuiPanel<S> {
) -> Option<EventListenerID> {
self.layout.add_event_listener(widget_id, kind, callback)
}
pub fn widget_set_display(
&self,
widget_id: WidgetID,
display: taffy::Display,
alterables: &mut EventAlterables,
) {
let mut style = self
.layout
.state
.get_widget_style(widget_id)
.unwrap_or(&taffy::Style::DEFAULT)
.clone();
style.display = display;
alterables.set_style(widget_id, style);
}
}
impl<S: 'static> OverlayBackend for GuiPanel<S> {