Skip to content

Commit

Permalink
add: sense clicking the world view window
Browse files Browse the repository at this point in the history
  • Loading branch information
NotAPenguin0 committed May 18, 2023
1 parent 4d19714 commit 4f07db5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions crates/gui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
12 changes: 11 additions & 1 deletion crates/gui/src/editor/world_view.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
use egui::Response;
use inject::DI;
use log::trace;
use scheduler::EventBus;
use util::SafeUnwrap;

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<DI>) {
enable_camera_over(&response, bus).safe_unwrap();

if response.clicked() {
trace!("Clicked the window");
}
}

/// Show the world view
/// # DI Access
/// - Write [`ImageProvider`]
Expand All @@ -19,7 +29,7 @@ pub fn show(context: &egui::Context, bus: &EventBus<DI>) {
provider.size = size.into();
provider.handle
},
|response| enable_camera_over(&response, bus).safe_unwrap(),
|response| behaviour(response, bus),
(800.0, 600.0).into(),
);
}

0 comments on commit 4f07db5

Please sign in to comment.