mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 04:21:50 +00:00
small fixes
This commit is contained in:
parent
9a01b5ad2d
commit
4c9019e03c
8 changed files with 21 additions and 9 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue