From 4f07db5e3fffebede20790dffb1d16fff0a38110 Mon Sep 17 00:00:00 2001 From: NotAPenguin Date: Mon, 15 May 2023 11:22:26 +0200 Subject: [PATCH] add: sense clicking the world view window --- crates/gui/Cargo.toml | 1 + crates/gui/src/editor/world_view.rs | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/gui/Cargo.toml b/crates/gui/Cargo.toml index 6c4ef33..44ef330 100644 --- a/crates/gui/Cargo.toml +++ b/crates/gui/Cargo.toml @@ -7,6 +7,7 @@ edition = "2021" glam = "0.23.0" anyhow = "1.0.70" egui = "0.21.0" +log = "0.4.17" inject = { path = "../inject" } math = { path = "../math" } scheduler = { path = "../scheduler" } diff --git a/crates/gui/src/editor/world_view.rs b/crates/gui/src/editor/world_view.rs index 75ba9ea..bc2c7ed 100644 --- a/crates/gui/src/editor/world_view.rs +++ b/crates/gui/src/editor/world_view.rs @@ -1,4 +1,6 @@ +use egui::Response; use inject::DI; +use log::trace; use scheduler::EventBus; use util::SafeUnwrap; @@ -6,6 +8,14 @@ use crate::editor::camera_controller::enable_camera_over; use crate::util::image_provider::ImageProvider; use crate::widgets::resizable_image::resizable_image_window; +fn behaviour(response: Response, bus: &EventBus) { + enable_camera_over(&response, bus).safe_unwrap(); + + if response.clicked() { + trace!("Clicked the window"); + } +} + /// Show the world view /// # DI Access /// - Write [`ImageProvider`] @@ -19,7 +29,7 @@ pub fn show(context: &egui::Context, bus: &EventBus) { provider.size = size.into(); provider.handle }, - |response| enable_camera_over(&response, bus).safe_unwrap(), + |response| behaviour(response, bus), (800.0, 600.0).into(), ); }