add ObserveMouseInput override

This commit is contained in:
2025-04-08 15:27:25 -04:00
parent 906bde163a
commit 74ae05321b
3 changed files with 11 additions and 8 deletions

View File

@@ -288,9 +288,6 @@ namespace JUI {
int LayoutOrder() const { return layout_order; }
void LayoutOrder(int value) { layout_order = value;}
#pragma endregion
/// Returns the complete bounding box around this instance that will be rendered onto.

View File

@@ -138,14 +138,23 @@ namespace JUI {
}
/// @see class Hoverable.
void OnExit(const J3ML::LinearAlgebra::Vector2 &MousePos) override
{
void OnExit(const J3ML::LinearAlgebra::Vector2 &MousePos) override {
Hoverable::OnExit(MousePos);
zindex--;
focused = false;
this->BorderColor(Style::Window::UnfocusedOutlineColor);
this->BGColor(Style::Window::UnfocusedOutlineColor);
}
bool ObserveMouseInput(JUI::MouseButton btn, bool pressed) override
{
// TODO: Consider how this plays with Clickable::OnClick and Clickable::OnRelease
if (this->visible && this->focused)
return Widget::ObserveMouseInput(btn, pressed);
return false;
}
protected:
void UpdateInternalWidgetsTitlebarHeight();
protected:

View File

@@ -91,7 +91,6 @@ namespace JUI {
exit_btn->OnReleaseEvent += [&] (auto... _) {
this->Visible(false);
};
}
Window::Window(Widget* parent) : Window() {
@@ -161,8 +160,6 @@ namespace JUI {
}
void Window::Update(float delta) {
if (dragging) {
// Move the window with the mouse, accounting for initial offset of window-mouse when we first clicked.
Vector2 goal = last_known_mouse_pos - initial_drag_offset;