diff --git a/include/Engine/Editor/EditorSystem.h b/include/Engine/Editor/EditorSystem.h index befa46b6..b354ddf3 100644 --- a/include/Engine/Editor/EditorSystem.h +++ b/include/Engine/Editor/EditorSystem.h @@ -9,7 +9,7 @@ #include "../Core/EntityFilePreprocessor.h" #include "../Core/EntityFileParser.h" #include "../Core/EntityFileWriter.h" -#include "../Core/EMouseRelease.h" +#include "../Core/EMousePress.h" #include "EditorGUI.h" #include "EditorStats.h" @@ -52,8 +52,8 @@ private: void OnComponentDelete(EntityWrapper entity, const std::string& componentType); // Events - EventRelay m_EMouseRelease; - bool OnMouseRelease(const Events::MouseRelease& e); + EventRelay m_EMousePress; + bool OnMousePress(const Events::MousePress& e); EventRelay m_EWidgetDelta; bool OnWidgetDelta(const Events::WidgetDelta& e); }; \ No newline at end of file diff --git a/src/Engine/Editor/EditorSystem.cpp b/src/Engine/Editor/EditorSystem.cpp index 1ef8b02b..35b8a361 100644 --- a/src/Engine/Editor/EditorSystem.cpp +++ b/src/Engine/Editor/EditorSystem.cpp @@ -31,7 +31,7 @@ EditorSystem::EditorSystem(World* world, EventBroker* eventBroker, IRenderer* re m_EditorGUI->SetComponentDeleteCallback(std::bind(&EditorSystem::OnComponentDelete, this, std::placeholders::_1, std::placeholders::_2)); m_EditorGUI->SetWidgetModeCallback(std::bind(&EditorSystem::setWidgetMode, this, std::placeholders::_1)); - EVENT_SUBSCRIBE_MEMBER(m_EMouseRelease, &EditorSystem::OnMouseRelease); + EVENT_SUBSCRIBE_MEMBER(m_EMousePress, &EditorSystem::OnMousePress); EVENT_SUBSCRIBE_MEMBER(m_EWidgetDelta, &EditorSystem::OnWidgetDelta); m_EditorStats = new EditorStats(); @@ -121,9 +121,10 @@ void EditorSystem::OnComponentDelete(EntityWrapper entity, const std::string& co } } -bool EditorSystem::OnMouseRelease(const Events::MouseRelease& e) +bool EditorSystem::OnMousePress(const Events::MousePress& e) { - if (e.Button == GLFW_MOUSE_BUTTON_1) { + ImGuiIO& io = ImGui::GetIO(); + if (!io.WantCaptureMouse && !io.WantCaptureKeyboard && e.Button == GLFW_MOUSE_BUTTON_1) { PickData pick = m_Renderer->Pick(glm::vec2(e.X, e.Y)); if (pick.World == m_World) { m_CurrentSelection = EntityWrapper(m_World, pick.Entity); diff --git a/src/Engine/Editor/EditorWidgetSystem.cpp b/src/Engine/Editor/EditorWidgetSystem.cpp index f0c72ab0..479671e2 100644 --- a/src/Engine/Editor/EditorWidgetSystem.cpp +++ b/src/Engine/Editor/EditorWidgetSystem.cpp @@ -58,7 +58,8 @@ bool EditorWidgetSystem::OnMouseMove(const Events::MouseMove& e) bool EditorWidgetSystem::OnMousePress(const Events::MousePress & e) { - if (e.Button == GLFW_MOUSE_BUTTON_1) { + ImGuiIO& io = ImGui::GetIO(); + if (!io.WantCaptureMouse && !io.WantCaptureKeyboard && e.Button == GLFW_MOUSE_BUTTON_1) { m_PickData = m_Renderer->Pick(glm::vec2(e.X, e.Y)); if (m_PickData.Entity != EntityID_Invalid && m_PickData.World == m_World) { m_PickEntity = EntityWrapper(m_World, m_PickData.Entity);