Bugfixes for Slider and Window widget.

This commit is contained in:
2025-01-28 18:11:35 -05:00
parent e7e469864f
commit 0cd3fbfc17
5 changed files with 26 additions and 3 deletions

View File

@@ -358,8 +358,12 @@ namespace JUI
Vector2 viewport_size{0,0};
/// Returns the amount of pixels this widget will be padded by from the top-left.
/// Generally, the widget will be shrunk and moved over by this amount, relative to the parent.
Vector2 GetAbsolutePaddingTopLeft() const;
/// Returns the amount of pixels this widget will be padded by from bottom-right.
/// Generally, the widget will be shrunk by twice this amount, relative to the parent.
Vector2 GetAbsolutePaddingBottomRight() const;
Vector2 GetAbsoluteMarginTopLeft();

View File

@@ -45,6 +45,13 @@ namespace JUI
void SetSelectionColor(const Color4& color);
bool HasSelection() const;
std::string GetSelectedText() const;
bool HasFocus() const;
void SetFocused(bool focused);
void GrabFocus();
void DropFocus();
std::vector<char> GetBlacklist() const { return blacklist;}
protected:
bool clear_text_on_return;
bool focused = false;
@@ -59,6 +66,7 @@ namespace JUI
std::string autocomplete_text = "Hello World";
bool hide_autocomplete_on_select = true;
bool autocomplete_text_enabled = true;
std::vector<char> blacklist;
private:
};
}

View File

@@ -68,8 +68,11 @@ namespace JUI
float value = translated + minimum;
if (current != value)
ValueChanged(value);
current = value;
std::cout << "slider value: " << value << std::endl;
//std::cout << "slider value: " << value << std::endl;
}
Rect::Update(delta);
}

View File

@@ -205,4 +205,12 @@ namespace JUI {
}
bool TextInputForm::HasFocus() const { return focused; }
void TextInputForm::SetFocused(bool focused) { this->focused = focused;}
void TextInputForm::GrabFocus() { SetFocused(true); }
void TextInputForm::DropFocus() { SetFocused(false); }
}

View File

@@ -115,10 +115,10 @@ namespace JUI
Clickable::OnClick(mouse_pos, btn);
clicked = true;
if (draggable && btn == MouseButton::Left)
if (draggable && btn == MouseButton::Left && GetTitleInstance()->IsMouseInside())
this->SetDrag(true);
if (resizable && btn == MouseButton::Right) {
if (resizable && btn == MouseButton::Right && GetTitleInstance()->IsMouseInside()) {
this->StartResizing(last_known_mouse_pos);
this->SetResize(true);
size_when_restart_began = Size();