small fixes
This commit is contained in:
@@ -262,7 +262,7 @@ void GUI::draw(const DrawContext& pctx, const Assets& assets) {
|
||||
auto pos = node->calcPos();
|
||||
auto size = node->getSize();
|
||||
|
||||
batch2D->setColor(0, 0, 255);
|
||||
batch2D->setColor(0, 255, 255);
|
||||
batch2D->lineRect(pos.x, pos.y, size.x-1, size.y-1);
|
||||
|
||||
node = node->getParent();
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "typedefs.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
class Assets;
|
||||
class DrawContext;
|
||||
|
||||
@@ -404,6 +404,12 @@ void TextBox::onFocus(GUI* gui) {
|
||||
}
|
||||
}
|
||||
|
||||
void TextBox::reposition() {
|
||||
auto size = getSize();
|
||||
UINode::reposition();
|
||||
refreshLabel();
|
||||
}
|
||||
|
||||
void TextBox::refresh() {
|
||||
Container::refresh();
|
||||
label->setSize(size-glm::vec2(padding.z+padding.x, padding.w+padding.y));
|
||||
|
||||
@@ -210,6 +210,7 @@ namespace gui {
|
||||
virtual void setShowLineNumbers(bool flag);
|
||||
virtual bool isShowLineNumbers() const;
|
||||
|
||||
virtual void reposition() override;
|
||||
virtual void onFocus(GUI*) override;
|
||||
virtual void refresh() override;
|
||||
virtual void doubleClick(GUI*, int x, int y) override;
|
||||
|
||||
@@ -301,9 +301,13 @@ const std::string& UINode::getId() const {
|
||||
void UINode::reposition() {
|
||||
if (sizefunc) {
|
||||
auto newSize = sizefunc();
|
||||
auto defsize = newSize;
|
||||
if (parent) {
|
||||
defsize = parent->getSize();
|
||||
}
|
||||
setSize(
|
||||
{newSize.x < 0 ? size.x : newSize.x,
|
||||
newSize.y < 0 ? size.y : newSize.y}
|
||||
{newSize.x < 0 ? defsize.x : newSize.x,
|
||||
newSize.y < 0 ? defsize.y : newSize.y}
|
||||
);
|
||||
}
|
||||
if (positionfunc) {
|
||||
|
||||
@@ -250,7 +250,7 @@ namespace gui {
|
||||
const std::string& getId() const;
|
||||
|
||||
/// @brief Fetch pos from positionfunc if assigned
|
||||
void reposition();
|
||||
virtual void reposition();
|
||||
|
||||
virtual void setGravity(Gravity gravity);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user