core: Add mask/masker/clip info to debug UI

This commit is contained in:
Nathan Adams 2023-06-01 23:07:21 +02:00
parent 59eceb8b7a
commit a6b8883acd
1 changed files with 31 additions and 6 deletions

View File

@ -83,13 +83,21 @@ impl DisplayObjectWindow {
Grid::new(ui.id().with("display")) Grid::new(ui.id().with("display"))
.num_columns(2) .num_columns(2)
.show(ui, |ui| { .show(ui, |ui| {
if let Some(parent) = object.parent() { if let Some(other) = object.parent() {
ui.label("Parent"); ui.label("Parent");
if ui.button(summary_name(parent)).clicked() { display_object_button(ui, context, messages, other);
messages.push(Message::TrackDisplayObject(DisplayObjectHandle::new( ui.end_row();
context, parent,
)));
} }
if let Some(other) = object.masker() {
ui.label("Masker");
display_object_button(ui, context, messages, other);
ui.end_row();
}
if let Some(other) = object.maskee() {
ui.label("Maskee");
display_object_button(ui, context, messages, other);
ui.end_row(); ui.end_row();
} }
@ -142,6 +150,10 @@ impl DisplayObjectWindow {
ui.label(object.depth().to_string()); ui.label(object.depth().to_string());
ui.end_row(); ui.end_row();
ui.label("Clip Depth");
ui.label(object.clip_depth().to_string());
ui.end_row();
ui.label("World Bounds"); ui.label("World Bounds");
ui.label(object.world_bounds().to_string()); ui.label(object.world_bounds().to_string());
ui.end_row(); ui.end_row();
@ -290,3 +302,16 @@ fn blend_mode_name(mode: BlendMode) -> &'static str {
BlendMode::HardLight => "HardLight", BlendMode::HardLight => "HardLight",
} }
} }
fn display_object_button<'gc>(
ui: &mut Ui,
context: &mut UpdateContext<'_, 'gc>,
messages: &mut Vec<Message>,
object: DisplayObject<'gc>,
) {
if ui.button(summary_name(object)).clicked() {
messages.push(Message::TrackDisplayObject(DisplayObjectHandle::new(
context, object,
)));
}
}