_wip parent-child positioning fixes

This commit is contained in:
2024-08-08 23:44:29 +03:00
parent b0aed96d18
commit b79c9402fd
6 changed files with 255 additions and 52 deletions

View File

@@ -364,7 +364,10 @@ public:
public:
Float2 GetMousePosition() const
/// <summary>
/// Returns the previous known position of the mouse before entering relative mode.
/// </summary>
Float2 GetOldMousePosition() const
{
return oldPosition;
}
@@ -480,6 +483,7 @@ bool SDLInput::HandleEvent(SDLWindow* window, SDL_Event& event)
else
{
const Float2 mousePos = window->ClientToScreen({ event.motion.x, event.motion.y });
LOG(Info, "motion {},{}, mouse: {}", event.motion.x, event.motion.y, mousePos);
Input::Mouse->OnMouseMove(mousePos, window);
}
return true;
@@ -509,7 +513,7 @@ bool SDLInput::HandleEvent(SDLWindow* window, SDL_Event& event)
{
// Use the previous visible mouse position here, the event or global
// mouse position would cause input to trigger in other editor windows.
mousePos = SDLInputImpl::Mouse->GetMousePosition();
mousePos = SDLInputImpl::Mouse->GetOldMousePosition();
}
if (event.button.state == SDL_RELEASED)
@@ -531,7 +535,7 @@ bool SDLInput::HandleEvent(SDLWindow* window, SDL_Event& event)
{
// Use the previous visible mouse position here, the event or global
// mouse position would cause input to trigger in other editor windows.
mousePos = SDLInputImpl::Mouse->GetMousePosition();
mousePos = SDLInputImpl::Mouse->GetOldMousePosition();
}
Input::Mouse->OnMouseWheel(mousePos, delta, window);