packs with missing dependencies test
This commit is contained in:
@@ -79,7 +79,7 @@ void Button::drawBackground(const DrawContext* pctx, Assets* assets) {
|
||||
glm::vec2 pos = calcPos();
|
||||
auto batch = pctx->getBatch2D();
|
||||
batch->texture(nullptr);
|
||||
if (enabled) {
|
||||
if (isEnabled()) {
|
||||
batch->setColor(isPressed() ? pressedColor : (hover ? hoverColor : color));
|
||||
} else {
|
||||
batch->setColor({color.r, color.g, color.b, color.a * 0.5f});
|
||||
|
||||
@@ -11,7 +11,7 @@ Container::Container(glm::vec2 size) : UINode(size) {
|
||||
}
|
||||
|
||||
std::shared_ptr<UINode> Container::getAt(glm::vec2 pos, std::shared_ptr<UINode> self) {
|
||||
if (!interactive || !enabled) {
|
||||
if (!interactive || !isEnabled()) {
|
||||
return nullptr;
|
||||
}
|
||||
if (!isInside(pos)) return nullptr;
|
||||
@@ -92,7 +92,12 @@ void Container::draw(const DrawContext* pctx, Assets* assets) {
|
||||
}
|
||||
|
||||
void Container::drawBackground(const DrawContext* pctx, Assets* assets) {
|
||||
glm::vec4 color = isPressed() ? pressedColor : (hover ? hoverColor : this->color);
|
||||
glm::vec4 color = this->color;
|
||||
if (isEnabled()) {
|
||||
color = (isPressed() ? pressedColor : (hover ? hoverColor : color));
|
||||
} else {
|
||||
color = glm::vec4(color.r, color.g, color.b, color.a * 0.5f);
|
||||
}
|
||||
if (color.a <= 0.001f)
|
||||
return;
|
||||
glm::vec2 pos = calcPos();
|
||||
|
||||
@@ -22,7 +22,7 @@ void Image::draw(const DrawContext* pctx, Assets* assets) {
|
||||
setSize(glm::vec2(texture->getWidth(), texture->getHeight()));
|
||||
}
|
||||
batch->texture(texture);
|
||||
if (enabled) {
|
||||
if (isEnabled()) {
|
||||
batch->setColor(isPressed() ? pressedColor : (hover ? hoverColor : color));
|
||||
} else {
|
||||
batch->setColor({color.r, color.g, color.b, color.a * 0.5f});
|
||||
|
||||
@@ -149,7 +149,11 @@ void Label::draw(const DrawContext* pctx, Assets* assets) {
|
||||
cache.update(text, multiline, textWrap);
|
||||
}
|
||||
|
||||
batch->setColor(getColor());
|
||||
if (isEnabled()) {
|
||||
batch->setColor(isPressed() ? pressedColor : (hover ? hoverColor : color));
|
||||
} else {
|
||||
batch->setColor({color.r, color.g, color.b, color.a * 0.5f});
|
||||
}
|
||||
|
||||
uint lineHeight = font->getLineHeight();
|
||||
if (cache.lines.size() > 1) {
|
||||
|
||||
@@ -29,6 +29,9 @@ void UINode::setEnabled(bool flag) {
|
||||
}
|
||||
|
||||
bool UINode::isEnabled() const {
|
||||
if (enabled && parent) {
|
||||
return parent->isEnabled();
|
||||
}
|
||||
return enabled;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,8 @@ namespace gui {
|
||||
class UINode {
|
||||
/// @brief element identifier used for direct access in UiDocument
|
||||
std::string id = "";
|
||||
/// @brief element enabled state
|
||||
bool enabled = true;
|
||||
protected:
|
||||
/// @brief element position within the parent element
|
||||
glm::vec2 pos {0.0f};
|
||||
@@ -62,8 +64,6 @@ namespace gui {
|
||||
glm::vec4 pressedColor {1.0f};
|
||||
/// @brief element margin (only supported for Panel sub-nodes)
|
||||
glm::vec4 margin {1.0f};
|
||||
/// @brief element enabled state
|
||||
bool enabled = true;
|
||||
/// @brief is element visible
|
||||
bool visible = true;
|
||||
/// @brief is mouse over the element
|
||||
|
||||
Reference in New Issue
Block a user