Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

feat: Improve InspectorPanel styling and add ColorEditor

esengine5ae57f3b5eac
diff --git a/src/esengine/editor/CMakeLists.txt b/src/esengine/editor/CMakeLists.txt
index 9a65e5fec..8a686bdf8 100644
--- a/src/esengine/editor/CMakeLists.txt
+++ b/src/esengine/editor/CMakeLists.txt
@@ -20,6 +20,7 @@ set(EDITOR_SOURCES
property/editors/BoolEditor.cpp
property/editors/IntEditor.cpp
property/editors/StringEditor.cpp
+ property/editors/ColorEditor.cpp
# Camera
camera/EditorCamera.cpp
@@ -75,6 +76,7 @@ set(EDITOR_HEADERS
property/editors/BoolEditor.hpp
property/editors/IntEditor.hpp
property/editors/StringEditor.hpp
+ property/editors/ColorEditor.hpp
# Camera
camera/EditorCamera.hpp
diff --git a/src/esengine/editor/panels/InspectorPanel.cpp b/src/esengine/editor/panels/InspectorPanel.cpp
index aff0e0d06..13e72044b 100644
--- a/src/esengine/editor/panels/InspectorPanel.cpp
+++ b/src/esengine/editor/panels/InspectorPanel.cpp
@@ -20,6 +20,7 @@
#include "../../ui/UIContext.hpp"
#include "../../ui/layout/StackLayout.hpp"
#include "../../ui/icons/Icons.hpp"
+#include "../../ui/widgets/Button.hpp"
#include "../../ui/rendering/UIBatchRenderer.hpp"
#if ES_FEATURE_SDF_FONT
@@ -65,36 +66,108 @@ InspectorPanel::~InspectorPanel() {
// =============================================================================
void InspectorPanel::buildUI() {
- constexpr glm::vec4 panelBg{0.145f, 0.145f, 0.149f, 1.0f}; // #252526
+ constexpr glm::vec4 toolbarBg{0.2f, 0.2f, 0.2f, 1.0f}; // #333333
+ constexpr glm::vec4 mainBg{0.165f, 0.165f, 0.165f, 1.0f}; // #2a2a2a
constexpr glm::vec4 headerBg{0.176f, 0.176f, 0.188f, 1.0f}; // #2d2d30
- constexpr glm::vec4 mainBg{0.118f, 0.118f, 0.118f, 1.0f}; // #1e1e1e
- constexpr glm::vec4 borderColor{0.235f, 0.235f, 0.235f, 1.0f}; // #3c3c3c
+ constexpr glm::vec4 borderColor{0.102f, 0.102f, 0.102f, 1.0f}; // #1a1a1a
constexpr glm::vec4 textColor{0.878f, 0.878f, 0.878f, 1.0f}; // #e0e0e0
+ constexpr glm::vec4 dimTextColor{0.6f, 0.6f, 0.6f, 1.0f}; // #999999
auto rootPanel = makeUnique<ui::Panel>(ui::WidgetId(getId().path + "_root"));
rootPanel->setLayout(makeUnique<ui::StackLayout>(ui::StackDirection::Vertical, 0.0f));
rootPanel->setDrawBackground(true);
rootPanel->setBackgroundColor(mainBg);
+ // =========================================================================
+ // Toolbar
+ // =========================================================================
+ auto toolbar = makeUnique<ui::Panel>(ui::WidgetId(getId().path + "_toolbar"));
+ toolbar->setLayout(makeUnique<ui::StackLayout>(ui::StackDirection::Horizontal, 4.0f));
+ toolbar->setHeight(ui::SizeValue::px(34.0f));
+ toolbar->setWidth(ui::SizeValue::flex(1.0f));
+ toolbar->setPadding(ui::Insets(4.0f, 8.0f, 4.0f, 8.0f));
+ toolbar->setDrawBackground(true);
+ toolbar->setBackgroundColor(toolbarBg);
+ toolbar->setBorderColor(borderColor);
+ toolbar->setBorderWidth(ui::BorderWidth(0.0f, 0.0f, 1.0f, 0.0f));
+
+ auto lockButton = makeUnique<ui::Button>(ui::WidgetId(getId().path + "_lock_btn"), ui::icons::Lock);
+ lockButton->setButtonStyle(ui::ButtonStyle::Ghost);
+ lockButton->setWidth(ui::SizeValue::px(26.0f));
+ lockButton->setHeight(ui::SizeValue::px(26.0f));
+ lockButton->setCornerRadii(ui::CornerRadii::all(3.0f));
+ toolbar->addChild(std::move(lockButton));
+
+ auto debugButton = makeUnique<ui::Button>(ui::WidgetId(getId().path + "_debug_btn"), ui::icons::Bug);
+ debugButton->setButtonStyle(ui::ButtonStyle::Ghost);
+ debugButton->setWidth(ui::SizeValue::px(26.0f));
+ debugButton->setHeight(ui::SizeValue::px(26.0f));
+ debugButton->setCornerRadii(ui::CornerRadii::all(3.0f));
+ toolbar->addChild(std::move(debugButton));
+
+ auto spacer = makeUnique<ui::Panel>(ui::WidgetId(getId().path + "_spacer"));
+ spacer->setWidth(ui::SizeValue::flex(1.0f));
+ spacer->setHeight(ui::SizeValue::px(26.0f));
+ spacer->setDrawBackground(false);
+ toolbar->addChild(std::move(spacer));
+
+ auto addComponentButton = makeUnique<ui::Button>(ui::WidgetId(getId().path + "_add_btn"), ui::icons::Plus);
+ addComponentButton->setButtonStyle(ui::ButtonStyle::Ghost);
+ addComponentButton->setWidth(ui::SizeValue::px(26.0f));
+ addComponentButton->setHeight(ui::SizeValue::px(26.0f));
+ addComponentButton->setCornerRadii(ui::CornerRadii::all(3.0f));
+ toolbar->addChild(std::move(addComponentButton));
+
+ auto settingsButton = makeUnique<ui::Button>(ui::WidgetId(getId().path + "_settings_btn"), ui::icons::Settings);
+ settingsButton->setButtonStyle(ui::ButtonStyle::Ghost);
+ settingsButton->setWidth(ui::SizeValue::px(26.0f));
+ settingsButton->setHeight(ui::SizeValue::px(26.0f));
+ settingsButton->setCornerRadii(ui::CornerRadii::all(3.0f));
+ toolbar->addChild(std::move(settingsButton));
+
+ rootPanel->addChild(std::move(toolbar));
+
+ // =========================================================================
+ // Entity Header
+ // =========================================================================
auto headerPanel = makeUnique<ui::Panel>(ui::WidgetId(getId().path + "_header"));
- headerPanel->setHeight(ui::SizeValue::px(38.0f));
+ headerPanel->setLayout(makeUnique<ui::StackLayout>(ui::StackDirection::Horizontal, 8.0f));
+ headerPanel->setHeight(ui::SizeValue::px(32.0f));
headerPanel->setWidth(ui::SizeValue::flex(1.0f));
- headerPanel->setPadding(ui::Insets(8.0f, 12.0f, 8.0f, 12.0f));
+ headerPanel->setPadding(ui::Insets(6.0f, 12.0f, 6.0f, 12.0f));
headerPanel->setDrawBackground(true);
headerPanel->setBackgroundColor(headerBg);
headerPanel->setBorderColor(borderColor);
headerPanel->setBorderWidth(ui::BorderWidth(0.0f, 0.0f, 1.0f, 0.0f));
+ auto entityIconLabel = makeUnique<ui::Label>(ui::WidgetId(getId().path + "_entity_icon"), ui::icons::Box);
+ entityIconLabel->setFontSize(14.0f);
+ entityIconLabel->setColor(dimTextColor);
+ entityIconLabel->setIsIconFont(true);
+ entityIconLabel_ = entityIconLabel.get();
+ headerPanel->addChild(std::move(entityIconLabel));
+
auto entityNameLabel = makeUnique<ui::Label>(ui::WidgetId(getId().path + "_entity_name"));
entityNameLabel->setText("No Selection");
- entityNameLabel->setFontSize(14.0f);
+ entityNameLabel->setFontSize(13.0f);
entityNameLabel->setColor(textColor);
+ entityNameLabel->setWidth(ui::SizeValue::flex(1.0f));
entityNameLabel_ = entityNameLabel.get();
headerPanel->addChild(std::move(entityNameLabel));
+ auto entityIdLabel = makeUnique<ui::Label>(ui::WidgetId(getId().path + "_entity_id"));
+ entityIdLabel->setText("");
+ entityIdLabel->setFontSize(11.0f);
+ entityIdLabel->setColor(dimTextColor);
+ entityIdLabel_ = entityIdLabel.get();
+ headerPanel->addChild(std::move(entityIdLabel));
+
headerPanel_ = headerPanel.get();
rootPanel->addChild(std::move(headerPanel));
+ // =========================================================================
+ // Scroll Content
+ // =========================================================================
auto scrollView = makeUnique<ui::ScrollView>(ui::WidgetId(getId().path + "_scroll"));
scrollView->setScrollDirection(ui::ScrollDirection::Vertical);
scrollView->setWidth(ui::SizeValue::flex(1.0f));
@@ -105,21 +178,42 @@ void InspectorPanel::buildUI() {
contentPanel->setLayout(makeUnique<ui::StackLayout>(ui::StackDirection::Vertical, 0.0f));
contentPanel->setWidth(ui::SizeValue::flex(1.0f));
contentPanel->setHeight(ui::SizeValue::autoSize());
- contentPanel->setPadding(ui::Insets(8.0f, 0.0f, 8.0f, 0.0f));
+ contentPanel->setPadding(ui::Insets(4.0f, 0.0f, 4.0f, 0.0f));
contentPanel_ = contentPanel.get();
scrollView->setContent(std::move(contentPanel));
rootPanel->addChild(std::move(scrollView));
+ // =========================================================================
+ // Status Bar
+ // =========================================================================
+ auto statusBar = makeUnique<ui::Panel>(ui::WidgetId(getId().path + "_status"));
+ statusBar->setHeight(ui::SizeValue::px(24.0f));
+ statusBar->setWidth(ui::SizeValue::flex(1.0f));
+ statusBar->setPadding(ui::Insets(4.0f, 12.0f, 4.0f, 12.0f));
+ statusBar->setDrawBackground(true);
+ statusBar->setBackgroundColor(toolbarBg);
+ statusBar->setBorderColor(borderColor);
+ statusBar->setBorderWidth(ui::BorderWidth(1.0f, 0.0f, 0.0f, 0.0f));
+
+ auto componentCountLabel = makeUnique<ui::Label>(ui::WidgetId(getId().path + "_count"), "0 components");
+ componentCountLabel->setFontSize(11.0f);
+ componentCountLabel->setColor(dimTextColor);
+ componentCountLabel_ = componentCountLabel.get();
+ statusBar->addChild(std::move(componentCountLabel));
+
+ rootPanel->addChild(std::move(statusBar));
+
rootPanel_ = rootPanel.get();
setContent(std::move(rootPanel));
}
ui::Panel* InspectorPanel::createComponentSection(const std::string& name, const std::string& icon) {
- constexpr glm::vec4 sectionHeaderBg{0.176f, 0.176f, 0.188f, 1.0f}; // #2d2d30
- constexpr glm::vec4 sectionBg{0.145f, 0.145f, 0.149f, 1.0f}; // #252526
- constexpr glm::vec4 borderColor{0.235f, 0.235f, 0.235f, 1.0f}; // #3c3c3c
- constexpr glm::vec4 textColor{0.878f, 0.878f, 0.878f, 1.0f}; // #e0e0e0
+ constexpr glm::vec4 sectionHeaderBg{0.2f, 0.2f, 0.2f, 1.0f}; // #333333
+ constexpr glm::vec4 sectionBg{0.165f, 0.165f, 0.165f, 1.0f}; // #2a2a2a
+ constexpr glm::vec4 borderColor{0.102f, 0.102f, 0.102f, 1.0f}; // #1a1a1a
+ constexpr glm::vec4 textColor{0.878f, 0.878f, 0.878f, 1.0f}; // #e0e0e0
+ constexpr glm::vec4 iconColor{0.6f, 0.6f, 0.6f, 1.0f}; // #999999
auto section = makeUnique<ui::Panel>(ui::WidgetId(contentPanel_->getId().path + "_" + name));
section->setLayout(makeUnique<ui::StackLayout>(ui::StackDirection::Vertical, 0.0f));
@@ -131,18 +225,39 @@ ui::Panel* InspectorPanel::createComponentSection(const std::string& name, const
section->setBorderWidth(ui::BorderWidth(0.0f, 0.0f, 1.0f, 0.0f));
auto header = makeUnique<ui::Panel>(ui::WidgetId(section->getId().path + "_header"));
- header->setHeight(ui::SizeValue::px(28.0f));
+ header->setLayout(makeUnique<ui::StackLayout>(ui::StackDirection::Horizontal, 6.0f));
+ header->setHeight(ui::SizeValue::px(26.0f));
header->setWidth(ui::SizeValue::flex(1.0f));
header->setPadding(ui::Insets(4.0f, 8.0f, 4.0f, 8.0f));
header->setDrawBackground(true);
header->setBackgroundColor(sectionHeaderBg);
+ auto chevronLabel = makeUnique<ui::Label>(ui::WidgetId(header->getId().path + "_chevron"), ui::icons::ChevronDown);
+ chevronLabel->setFontSize(10.0f);
+ chevronLabel->setColor(iconColor);
+ chevronLabel->setIsIconFont(true);
+ header->addChild(std::move(chevronLabel));
+
+ auto iconLabel = makeUnique<ui::Label>(ui::WidgetId(header->getId().path + "_icon"), icon);
+ iconLabel->setFontSize(12.0f);
+ iconLabel->setColor(iconColor);
+ iconLabel->setIsIconFont(true);
+ header->addChild(std::move(iconLabel));
+
auto headerLabel = makeUnique<ui::Label>(ui::WidgetId(header->getId().path + "_label"));
headerLabel->setText(name);
headerLabel->setFontSize(12.0f);
headerLabel->setColor(textColor);
+ headerLabel->setWidth(ui::SizeValue::flex(1.0f));
header->addChild(std::move(headerLabel));
+ auto removeButton = makeUnique<ui::Button>(ui::WidgetId(header->getId().path + "_remove"), ui::icons::X);
+ removeButton->setButtonStyle(ui::ButtonStyle::Ghost);
+ removeButton->setWidth(ui::SizeValue::px(18.0f));
+ removeButton->setHeight(ui::SizeValue::px(18.0f));
+ removeButton->setCornerRadii(ui::CornerRadii::all(2.0f));
+ header->addChild(std::move(removeButton));
+
section->addChild(std::move(header));
ui::Panel* sectionPtr = section.get();
@@ -194,12 +309,23 @@ void InspectorPanel::rebuildInspector() {
clearInspector();
constexpr glm::vec4 dimTextColor{0.533f, 0.533f, 0.533f, 1.0f}; // #888
+ constexpr glm::vec4 textColor{0.878f, 0.878f, 0.878f, 1.0f}; // #e0e0e0
if (currentEntity_ == INVALID_ENTITY || !registry_.valid(currentEntity_)) {
+ if (entityIconLabel_) {
+ entityIconLabel_->setText(ui::icons::Box);
+ entityIconLabel_->setColor(dimTextColor);
+ }
if (entityNameLabel_) {
entityNameLabel_->setText("No Selection");
entityNameLabel_->setColor(dimTextColor);
}
+ if (entityIdLabel_) {
+ entityIdLabel_->setText("");
+ }
+ if (componentCountLabel_) {
+ componentCountLabel_->setText("0 components");
+ }
auto noSelectionLabel = makeUnique<ui::Label>(
ui::WidgetId(contentPanel_->getId().path + "_no_selection"));
@@ -210,32 +336,59 @@ void InspectorPanel::rebuildInspector() {
return;
}
- constexpr glm::vec4 textColor{0.878f, 0.878f, 0.878f, 1.0f}; // #e0e0e0
+ std::string displayName = "Entity " + std::to_string(currentEntity_);
+ std::string entityIcon = ui::icons::Box;
+
+ if (registry_.has<ecs::Name>(currentEntity_)) {
+ displayName = registry_.get<ecs::Name>(currentEntity_).value;
+ }
+ if (registry_.has<ecs::Camera>(currentEntity_)) {
+ entityIcon = ui::icons::Camera;
+ } else if (registry_.has<ecs::Sprite>(currentEntity_)) {
+ entityIcon = ui::icons::Image;
+ }
+
+ if (entityIconLabel_) {
+ entityIconLabel_->setText(entityIcon);
+ entityIconLabel_->setColor(textColor);
+ }
if (entityNameLabel_) {
- std::string displayName = "Entity " + std::to_string(currentEntity_);
- if (registry_.has<ecs::Name>(currentEntity_)) {
- displayName = registry_.get<ecs::Name>(currentEntity_).value;
- }
entityNameLabel_->setText(displayName);
entityNameLabel_->setColor(textColor);
}
+ if (entityIdLabel_) {
+ entityIdLabel_->setText("ID: " + std::to_string(currentEntity_));
+ }
+
+ i32 componentCount = 0;
addTagsEditor(currentEntity_);
+ componentCount++;
if (registry_.has<ecs::Name>(currentEntity_)) {
addNameEditor(currentEntity_);
+ componentCount++;
}
if (registry_.has<ecs::LocalTransform>(currentEntity_)) {
addLocalTransformEditor(currentEntity_);
+ componentCount++;
}
if (registry_.has<ecs::Camera>(currentEntity_)) {
addCameraEditor(currentEntity_);
+ componentCount++;
}
if (registry_.has<ecs::Sprite>(currentEntity_)) {
addSpriteEditor(currentEntity_);
+ componentCount++;
+ }
+
+ if (componentCountLabel_) {
+ std::string countText = std::to_string(componentCount) +
+ (componentCount == 1 ? " component" : " components");
+ componentCountLabel_->setText(countText);
}
}
@@ -398,6 +551,29 @@ void InspectorPanel::addCameraEditor(Entity entity) {
content->addChild(std::move(fovEditor));
+ auto orthoSizeEditor = makeUnique<FloatEditor>(
+ ui::WidgetId(content->getId().path + "_orthoSize"),
+ "orthoSize");
+ orthoSizeEditor->setLabel("Ortho Size");
+ orthoSizeEditor->setValue(camera.orthoSize);
+ orthoSizeEditor->setRange(0.1f, 100.0f);
+ orthoSizeEditor->setCommandHistory(&history_);
+
+ editorConnections_.add(sink(orthoSizeEditor->onValueChanged).connect(
+ [this, entity](const std::any& value) {
+ if (registry_.valid(entity) && registry_.has<ecs::Camera>(entity)) {
+ auto& c = registry_.get<ecs::Camera>(entity);
+ try {
+ c.orthoSize = std::any_cast<f32>(value);
+ } catch (const std::bad_any_cast&) {
+ ES_LOG_ERROR("Failed to cast orthoSize value");
+ }
+ }
+ }
+ ));
+
+ content->addChild(std::move(orthoSizeEditor));
+
auto nearEditor = makeUnique<FloatEditor>(
ui::WidgetId(content->getId().path + "_near"),
"nearPlane");
@@ -442,6 +618,29 @@ void InspectorPanel::addCameraEditor(Entity entity) {
content->addChild(std::move(farEditor));
+ auto aspectEditor = makeUnique<FloatEditor>(
+ ui::WidgetId(content->getId().path + "_aspect"),
+ "aspectRatio");
+ aspectEditor->setLabel("Aspect");
+ aspectEditor->setValue(camera.aspectRatio);
+ aspectEditor->setRange(0.0f, 4.0f);
+ aspectEditor->setCommandHistory(&history_);
+
+ editorConnections_.add(sink(aspectEditor->onValueChanged).connect(
+ [this, entity](const std::any& value) {
+ if (registry_.valid(entity) && registry_.has<ecs::Camera>(entity)) {
+ auto& c = registry_.get<ecs::Camera>(entity);
+ try {
+ c.aspectRatio = std::any_cast<f32>(value);
+ } catch (const std::bad_any_cast&) {
+ ES_LOG_ERROR("Failed to cast aspectRatio value");
+ }
+ }
+ }
+ ));
+
+ content->addChild(std::move(aspectEditor));
+
auto activeEditor = makeUnique<BoolEditor>(
ui::WidgetId(content->getId().path + "_active"),
"isActive");
@@ -500,6 +699,28 @@ void InspectorPanel::addSpriteEditor(Entity entity) {
content->setHeight(ui::SizeValue::autoSize());
content->setPadding(ui::Insets(8.0f, 12.0f, 8.0f, 12.0f));
+ auto colorEditor = makeUnique<ColorEditor>(
+ ui::WidgetId(content->getId().path + "_color"),
+ "color");
+ colorEditor->setLabel("Color");
+ colorEditor->setValue(sprite.color);
+ colorEditor->setCommandHistory(&history_);
+
+ editorConnections_.add(sink(colorEditor->onValueChanged).connect(
+ [this, entity](const std::any& value) {
+ if (registry_.valid(entity) && registry_.has<ecs::Sprite>(entity)) {
+ auto& s = registry_.get<ecs::Sprite>(entity);
+ try {
+ s.color = std::any_cast<glm::vec4>(value);
+ } catch (const std::bad_any_cast&) {
+ ES_LOG_ERROR("Failed to cast color value");
+ }
+ }
+ }
+ ));
+
+ content->addChild(std::move(colorEditor));
+
auto sizeEditor = makeUnique<Vector2Editor>(
ui::WidgetId(content->getId().path + "_size"),
"size");
@@ -522,6 +743,50 @@ void InspectorPanel::addSpriteEditor(Entity entity) {
content->addChild(std::move(sizeEditor));
+ auto uvOffsetEditor = makeUnique<Vector2Editor>(
+ ui::WidgetId(content->getId().path + "_uvOffset"),
+ "uvOffset");
+ uvOffsetEditor->setLabel("UV Offset");
+ uvOffsetEditor->setValue(sprite.uvOffset);
+ uvOffsetEditor->setCommandHistory(&history_);
+
+ editorConnections_.add(sink(uvOffsetEditor->onValueChanged).connect(
+ [this, entity](const std::any& value) {
+ if (registry_.valid(entity) && registry_.has<ecs::Sprite>(entity)) {
+ auto& s = registry_.get<ecs::Sprite>(entity);
+ try {
+ s.uvOffset = std::any_cast<glm::vec2>(value);
+ } catch (const std::bad_any_cast&) {
+ ES_LOG_ERROR("Failed to cast uvOffset value");
+ }
+ }
+ }
+ ));
+
+ content->addChild(std::move(uvOffsetEditor));
+
+ auto uvScaleEditor = makeUnique<Vector2Editor>(
+ ui::WidgetId(content->getId().path + "_uvScale"),
+ "uvScale");
+ uvScaleEditor->setLabel("UV Scale");
+ uvScaleEditor->setValue(sprite.uvScale);
+ uvScaleEditor->setCommandHistory(&history_);
+
+ editorConnections_.add(sink(uvScaleEditor->onValueChanged).connect(
+ [this, entity](const std::any& value) {
+ if (registry_.valid(entity) && registry_.has<ecs::Sprite>(entity)) {
+ auto& s = registry_.get<ecs::Sprite>(entity);
+ try {
+ s.uvScale = std::any_cast<glm::vec2>(value);
+ } catch (const std::bad_any_cast&) {
+ ES_LOG_ERROR("Failed to cast uvScale value");
+ }
+ }
+ }
+ ));
+
+ content->addChild(std::move(uvScaleEditor));
+
auto layerEditor = makeUnique<IntEditor>(
ui::WidgetId(content->getId().path + "_layer"),
"layer");
diff --git a/src/esengine/editor/panels/InspectorPanel.hpp b/src/esengine/editor/panels/InspectorPanel.hpp
index 879393cd0..ae361f0e9 100644
--- a/src/esengine/editor/panels/InspectorPanel.hpp
+++ b/src/esengine/editor/panels/InspectorPanel.hpp
@@ -30,6 +30,7 @@
#include "../property/editors/BoolEditor.hpp"
#include "../property/editors/IntEditor.hpp"
#include "../property/editors/StringEditor.hpp"
+#include "../property/editors/ColorEditor.hpp"
#include "../../events/Connection.hpp"
#include <unordered_set>
@@ -99,7 +100,10 @@ private:
ui::Panel* rootPanel_ = nullptr;
ui::Panel* headerPanel_ = nullptr;
+ ui::Label* entityIconLabel_ = nullptr;
ui::Label* entityNameLabel_ = nullptr;
+ ui::Label* entityIdLabel_ = nullptr;
+ ui::Label* componentCountLabel_ = nullptr;
ui::ScrollView* scrollView_ = nullptr;
ui::Panel* contentPanel_ = nullptr;
diff --git a/src/esengine/editor/property/editors/ColorEditor.cpp b/src/esengine/editor/property/editors/ColorEditor.cpp
new file mode 100644
index 000000000..7256d35e9
--- /dev/null
+++ b/src/esengine/editor/property/editors/ColorEditor.cpp
@@ -0,0 +1,298 @@
+/**
+ * @file ColorEditor.cpp
+ * @brief ColorEditor implementation
+ *
+ * @author ESEngine Team
+ * @date 2026
+ *
+ * @copyright Copyright (c) 2026 ESEngine Team
+ * Licensed under the MIT License.
+ */
+
+#include "ColorEditor.hpp"
+#include "../../command/PropertyCommand.hpp"
+#include "../../../ui/UIContext.hpp"
+#include "../../../ui/rendering/UIBatchRenderer.hpp"
+#include "../../../events/Sink.hpp"
+
+namespace esengine::editor {
+
+// =============================================================================
+// Constructor
+// =============================================================================
+
+ColorEditor::ColorEditor(const ui::WidgetId& id, const std::string& propertyName)
+ : PropertyEditor(id, propertyName) {
+
+ if (showLabel_) {
+ auto mainLabelWidget = makeUnique<ui::Label>(ui::WidgetId(getId().path + "_label"));
+ mainLabelWidget->setText(label_);
+ mainLabelWidget->setFontSize(12.0f);
+ mainLabel_ = mainLabelWidget.get();
+ addChild(std::move(mainLabelWidget));
+ }
+
+ auto colorPreviewWidget = makeUnique<ui::Panel>(ui::WidgetId(getId().path + "_preview"));
+ colorPreviewWidget->setDrawBackground(true);
+ colorPreviewWidget->setBackgroundColor(value_);
+ colorPreview_ = colorPreviewWidget.get();
+ addChild(std::move(colorPreviewWidget));
+
+ auto rLabelWidget = makeUnique<ui::Label>(ui::WidgetId(getId().path + "_r_label"));
+ rLabelWidget->setText("R");
+ rLabelWidget->setFontSize(12.0f);
+ rLabel_ = rLabelWidget.get();
+ addChild(std::move(rLabelWidget));
+
+ auto rEditorWidget = makeUnique<FloatEditor>(ui::WidgetId(getId().path + "_r"), "r");
+ rEditorWidget->setShowLabel(false);
+ rEditorWidget->setRange(0.0f, 1.0f);
+ rEditor_ = rEditorWidget.get();
+ addChild(std::move(rEditorWidget));
+
+ auto gLabelWidget = makeUnique<ui::Label>(ui::WidgetId(getId().path + "_g_label"));
+ gLabelWidget->setText("G");
+ gLabelWidget->setFontSize(12.0f);
+ gLabel_ = gLabelWidget.get();
+ addChild(std::move(gLabelWidget));
+
+ auto gEditorWidget = makeUnique<FloatEditor>(ui::WidgetId(getId().path + "_g"), "g");
+ gEditorWidget->setShowLabel(false);
+ gEditorWidget->setRange(0.0f, 1.0f);
+ gEditor_ = gEditorWidget.get();
+ addChild(std::move(gEditorWidget));
+
+ auto bLabelWidget = makeUnique<ui::Label>(ui::WidgetId(getId().path + "_b_label"));
+ bLabelWidget->setText("B");
+ bLabelWidget->setFontSize(12.0f);
+ bLabel_ = bLabelWidget.get();
+ addChild(std::move(bLabelWidget));
+
+ auto bEditorWidget = makeUnique<FloatEditor>(ui::WidgetId(getId().path + "_b"), "b");
+ bEditorWidget->setShowLabel(false);
+ bEditorWidget->setRange(0.0f, 1.0f);
+ bEditor_ = bEditorWidget.get();
+ addChild(std::move(bEditorWidget));
+
+ auto aLabelWidget = makeUnique<ui::Label>(ui::WidgetId(getId().path + "_a_label"));
+ aLabelWidget->setText("A");
+ aLabelWidget->setFontSize(12.0f);
+ aLabel_ = aLabelWidget.get();
+ addChild(std::move(aLabelWidget));
+
+ auto aEditorWidget = makeUnique<FloatEditor>(ui::WidgetId(getId().path + "_a"), "a");
+ aEditorWidget->setShowLabel(false);
+ aEditorWidget->setRange(0.0f, 1.0f);
+ aEditor_ = aEditorWidget.get();
+ addChild(std::move(aEditorWidget));
+
+ connections_.add(sink(rEditor_->onValueChanged).connect(
+ [this](const std::any&) { onComponentChanged(); }
+ ));
+ connections_.add(sink(gEditor_->onValueChanged).connect(
+ [this](const std::any&) { onComponentChanged(); }
+ ));
+ connections_.add(sink(bEditor_->onValueChanged).connect(
+ [this](const std::any&) { onComponentChanged(); }
+ ));
+ connections_.add(sink(aEditor_->onValueChanged).connect(
+ [this](const std::any&) { onComponentChanged(); }
+ ));
+}
+
+// =============================================================================
+// PropertyEditor Interface
+// =============================================================================
+
+void ColorEditor::setValue(const std::any& value) {
+ try {
+ glm::vec4 newValue = std::any_cast<glm::vec4>(value);
+ if (value_ == newValue) {
+ return;
+ }
+
+ value_ = newValue;
+
+ updatingFromValue_ = true;
+ rEditor_->setValue(value_.r);
+ gEditor_->setValue(value_.g);
+ bEditor_->setValue(value_.b);
+ aEditor_->setValue(value_.a);
+ if (colorPreview_) {
+ colorPreview_->setBackgroundColor(value_);
+ }
+ updatingFromValue_ = false;
+ } catch (const std::bad_any_cast&) {
+ }
+}
+
+std::any ColorEditor::getValue() const {
+ return value_;
+}
+
+// =============================================================================
+// Widget Interface
+// =============================================================================
+
+glm::vec2 ColorEditor::measure(f32 availableWidth, f32 availableHeight) {
+ (void)availableWidth;
+ (void)availableHeight;
+
+ f32 width = 0.0f;
+ f32 height = ROW_HEIGHT * 2.0f + SPACING;
+
+ if (mainLabel_ && showLabel_) {
+ width += MAIN_LABEL_WIDTH + SPACING;
+ }
+
+ width += COLOR_PREVIEW_SIZE + SPACING;
+ width += (COMPONENT_LABEL_WIDTH + SPACING + FLOAT_EDITOR_WIDTH + SPACING) * 2;
+
+ return glm::vec2(width, height);
+}
+
+void ColorEditor::render(ui::UIBatchRenderer& renderer) {
+ const ui::Rect& bounds = getBounds();
+ f32 x = bounds.x;
+ f32 y = bounds.y;
+
+ constexpr glm::vec4 labelColor{0.686f, 0.686f, 0.686f, 1.0f};
+ constexpr glm::vec4 rColor{0.9f, 0.4f, 0.4f, 1.0f};
+ constexpr glm::vec4 gColor{0.4f, 0.9f, 0.4f, 1.0f};
+ constexpr glm::vec4 bColor{0.4f, 0.6f, 0.9f, 1.0f};
+ constexpr glm::vec4 aColor{0.7f, 0.7f, 0.7f, 1.0f};
+
+ if (mainLabel_ && showLabel_) {
+ mainLabel_->setColor(labelColor);
+ ui::Rect labelBounds{x, y, MAIN_LABEL_WIDTH, ROW_HEIGHT};
+ mainLabel_->layout(labelBounds);
+ mainLabel_->renderTree(renderer);
+ x += MAIN_LABEL_WIDTH + SPACING;
+ }
+
+ if (colorPreview_) {
+ colorPreview_->setBackgroundColor(value_);
+ ui::Rect previewBounds{x, y, COLOR_PREVIEW_SIZE, ROW_HEIGHT * 2.0f + SPACING};
+ colorPreview_->layout(previewBounds);
+ colorPreview_->renderTree(renderer);
+ x += COLOR_PREVIEW_SIZE + SPACING;
+ }
+
+ f32 rowX = x;
+
+ if (rLabel_) {
+ rLabel_->setColor(rColor);
+ ui::Rect labelBounds{rowX, y, COMPONENT_LABEL_WIDTH, ROW_HEIGHT};
+ rLabel_->layout(labelBounds);
+ rLabel_->renderTree(renderer);
+ rowX += COMPONENT_LABEL_WIDTH + SPACING;
+ }
+
+ if (rEditor_) {
+ ui::Rect editorBounds{rowX, y, FLOAT_EDITOR_WIDTH, ROW_HEIGHT};
+ rEditor_->layout(editorBounds);
+ rEditor_->renderTree(renderer);
+ rowX += FLOAT_EDITOR_WIDTH + SPACING;
+ }
+
+ if (gLabel_) {
+ gLabel_->setColor(gColor);
+ ui::Rect labelBounds{rowX, y, COMPONENT_LABEL_WIDTH, ROW_HEIGHT};
+ gLabel_->layout(labelBounds);
+ gLabel_->renderTree(renderer);
+ rowX += COMPONENT_LABEL_WIDTH + SPACING;
+ }
+
+ if (gEditor_) {
+ ui::Rect editorBounds{rowX, y, FLOAT_EDITOR_WIDTH, ROW_HEIGHT};
+ gEditor_->layout(editorBounds);
+ gEditor_->renderTree(renderer);
+ }
+
+ y += ROW_HEIGHT + SPACING;
+ rowX = x;
+
+ if (bLabel_) {
+ bLabel_->setColor(bColor);
+ ui::Rect labelBounds{rowX, y, COMPONENT_LABEL_WIDTH, ROW_HEIGHT};
+ bLabel_->layout(labelBounds);
+ bLabel_->renderTree(renderer);
+ rowX += COMPONENT_LABEL_WIDTH + SPACING;
+ }
+
+ if (bEditor_) {
+ ui::Rect editorBounds{rowX, y, FLOAT_EDITOR_WIDTH, ROW_HEIGHT};
+ bEditor_->layout(editorBounds);
+ bEditor_->renderTree(renderer);
+ rowX += FLOAT_EDITOR_WIDTH + SPACING;
+ }
+
+ if (aLabel_) {
+ aLabel_->setColor(aColor);
+ ui::Rect labelBounds{rowX, y, COMPONENT_LABEL_WIDTH, ROW_HEIGHT};
+ aLabel_->layout(labelBounds);
+ aLabel_->renderTree(renderer);
+ rowX += COMPONENT_LABEL_WIDTH + SPACING;
+ }
+
+ if (aEditor_) {
+ ui::Rect editorBounds{rowX, y, FLOAT_EDITOR_WIDTH, ROW_HEIGHT};
+ aEditor_->layout(editorBounds);
+ aEditor_->renderTree(renderer);
+ }
+}
+
+// =============================================================================
+// Protected Methods
+// =============================================================================
+
+Unique<Command> ColorEditor::createCommand(const std::any& oldValue,
+ const std::any& newValue) {
+ try {
+ glm::vec4 oldVec = std::any_cast<glm::vec4>(oldValue);
+ glm::vec4 newVec = std::any_cast<glm::vec4>(newValue);
+
+ return makeUnique<LambdaCommand>(
+ "Modify " + propertyName_,
+ [this, newVec]() {
+ setValue(newVec);
+ return CommandResult::Success;
+ },
+ [this, oldVec]() {
+ setValue(oldVec);
+ }
+ );
+ } catch (const std::bad_any_cast&) {
+ return nullptr;
+ }
+}
+
+// =============================================================================
+// Private Methods
+// =============================================================================
+
+void ColorEditor::onComponentChanged() {
+ if (updatingFromValue_) {
+ return;
+ }
+
+ glm::vec4 oldValue = value_;
+
+ try {
+ value_.r = std::any_cast<f32>(rEditor_->getValue());
+ value_.g = std::any_cast<f32>(gEditor_->getValue());
+ value_.b = std::any_cast<f32>(bEditor_->getValue());
+ value_.a = std::any_cast<f32>(aEditor_->getValue());
+
+ if (colorPreview_) {
+ colorPreview_->setBackgroundColor(value_);
+ }
+
+ if (oldValue != value_) {
+ notifyValueChanged(oldValue, value_);
+ }
+ } catch (const std::bad_any_cast&) {
+ }
+}
+
+} // namespace esengine::editor
diff --git a/src/esengine/editor/property/editors/ColorEditor.hpp b/src/esengine/editor/property/editors/ColorEditor.hpp
new file mode 100644
index 000000000..cfb1d008c
--- /dev/null
+++ b/src/esengine/editor/property/editors/ColorEditor.hpp
@@ -0,0 +1,74 @@
+/**
+ * @file ColorEditor.hpp
+ * @brief Property editor for RGBA color values
+ * @details Combines four FloatEditors (R, G, B, A) for editing glm::vec4.
+ *
+ * @author ESEngine Team
+ * @date 2026
+ *
+ * @copyright Copyright (c) 2026 ESEngine Team
+ * Licensed under the MIT License.
+ */
+#pragma once
+
+// =============================================================================
+// Includes
+// =============================================================================
+
+#include "../PropertyEditor.hpp"
+#include "FloatEditor.hpp"
+#include "../../../ui/widgets/Label.hpp"
+#include "../../../ui/widgets/Panel.hpp"
+#include "../../../events/Connection.hpp"
+
+#include <glm/glm.hpp>
+
+namespace esengine::editor {
+
+// =============================================================================
+// ColorEditor Class
+// =============================================================================
+
+class ColorEditor : public PropertyEditor {
+public:
+ explicit ColorEditor(const ui::WidgetId& id, const std::string& propertyName);
+ ~ColorEditor() override = default;
+
+ void setValue(const std::any& value) override;
+ std::any getValue() const override;
+
+ glm::vec2 measure(f32 availableWidth, f32 availableHeight) override;
+ void render(ui::UIBatchRenderer& renderer) override;
+
+protected:
+ Unique<Command> createCommand(const std::any& oldValue,
+ const std::any& newValue) override;
+
+private:
+ void onComponentChanged();
+
+ glm::vec4 value_{1.0f};
+ bool updatingFromValue_ = false;
+
+ ui::Label* mainLabel_ = nullptr;
+ ui::Panel* colorPreview_ = nullptr;
+ ui::Label* rLabel_ = nullptr;
+ ui::Label* gLabel_ = nullptr;
+ ui::Label* bLabel_ = nullptr;
+ ui::Label* aLabel_ = nullptr;
+
+ FloatEditor* rEditor_ = nullptr;
+ FloatEditor* gEditor_ = nullptr;
+ FloatEditor* bEditor_ = nullptr;
+ FloatEditor* aEditor_ = nullptr;
+ ConnectionHolder connections_;
+
+ static constexpr f32 MAIN_LABEL_WIDTH = 60.0f;
+ static constexpr f32 COLOR_PREVIEW_SIZE = 20.0f;
+ static constexpr f32 COMPONENT_LABEL_WIDTH = 10.0f;
+ static constexpr f32 FLOAT_EDITOR_WIDTH = 40.0f;
+ static constexpr f32 SPACING = 4.0f;
+ static constexpr f32 ROW_HEIGHT = 20.0f;
+};
+
+} // namespace esengine::editor
diff --git a/src/esengine/editor/property/editors/FloatEditor.cpp b/src/esengine/editor/property/editors/FloatEditor.cpp
index a30a7e10a..ff4cd0feb 100644
--- a/src/esengine/editor/property/editors/FloatEditor.cpp
+++ b/src/esengine/editor/property/editors/FloatEditor.cpp
@@ -30,6 +30,7 @@ FloatEditor::FloatEditor(const ui::WidgetId& id, const std::string& propertyName
if (showLabel_) {
auto labelWidget = makeUnique<ui::Label>(ui::WidgetId(getId().path + "_label"));
labelWidget->setText(label_);
+ labelWidget->setFontSize(12.0f);
labelWidget_ = labelWidget.get();
addChild(std::move(labelWidget));
}
@@ -39,9 +40,9 @@ FloatEditor::FloatEditor(const ui::WidgetId& id, const std::string& propertyName
textField_ = textField.get();
addChild(std::move(textField));
- sink(textField_->onTextChanged).connect(
+ connections_.add(sink(textField_->onTextChanged).connect(
[this](const std::string& text) { onTextChanged(text); }
- );
+ ));
updateTextFromValue();
}
@@ -110,9 +111,9 @@ void FloatEditor::setShowSlider(bool show) {
slider_ = sliderWidget.get();
addChild(std::move(sliderWidget));
- sink(slider_->onValueChanged).connect(
+ connections_.add(sink(slider_->onValueChanged).connect(
[this](f32 value) { onSliderChanged(value); }
- );
+ ));
updateSliderFromValue();
} else if (!showSlider_ && slider_) {
@@ -155,19 +156,28 @@ glm::vec2 FloatEditor::measure(f32 availableWidth, f32 availableHeight) {
void FloatEditor::render(ui::UIBatchRenderer& renderer) {
const ui::Rect& bounds = getBounds();
f32 x = bounds.x;
+ f32 remainingWidth = bounds.width;
+
+ constexpr glm::vec4 labelColor{0.686f, 0.686f, 0.686f, 1.0f};
if (labelWidget_ && showLabel_) {
+ labelWidget_->setColor(labelColor);
ui::Rect labelBounds{x, bounds.y, LABEL_WIDTH, bounds.height};
labelWidget_->layout(labelBounds);
labelWidget_->renderTree(renderer);
x += LABEL_WIDTH + SPACING;
+ remainingWidth -= LABEL_WIDTH + SPACING;
}
if (textField_) {
- ui::Rect textBounds{x, bounds.y, TEXTFIELD_WIDTH, bounds.height};
+ f32 textFieldWidth = remainingWidth;
+ if (slider_ && showSlider_) {
+ textFieldWidth = TEXTFIELD_WIDTH;
+ }
+ ui::Rect textBounds{x, bounds.y, textFieldWidth, bounds.height};
textField_->layout(textBounds);
textField_->renderTree(renderer);
- x += TEXTFIELD_WIDTH;
+ x += textFieldWidth;
}
if (slider_ && showSlider_) {
diff --git a/src/esengine/editor/property/editors/FloatEditor.hpp b/src/esengine/editor/property/editors/FloatEditor.hpp
index 15ccac4ad..199bcf631 100644
--- a/src/esengine/editor/property/editors/FloatEditor.hpp
+++ b/src/esengine/editor/property/editors/FloatEditor.hpp
@@ -20,6 +20,7 @@
#include "../../../ui/widgets/TextField.hpp"
#include "../../../ui/widgets/Slider.hpp"
#include "../../../ui/widgets/Label.hpp"
+#include "../../../events/Connection.hpp"
namespace esengine::editor {
@@ -143,6 +144,7 @@ private:
ui::Label* labelWidget_ = nullptr;
ui::TextField* textField_ = nullptr;
ui::Slider* slider_ = nullptr;
+ ConnectionHolder connections_;
static constexpr f32 LABEL_WIDTH = 60.0f;
static constexpr f32 TEXTFIELD_WIDTH = 80.0f;
diff --git a/src/esengine/editor/property/editors/IntEditor.cpp b/src/esengine/editor/property/editors/IntEditor.cpp
index 87bb8c5f8..8c7def330 100644
--- a/src/esengine/editor/property/editors/IntEditor.cpp
+++ b/src/esengine/editor/property/editors/IntEditor.cpp
@@ -141,6 +141,7 @@ glm::vec2 IntEditor::measure(f32 availableWidth, f32 availableHeight) {
void IntEditor::render(ui::UIBatchRenderer& renderer) {
const ui::Rect& bounds = getBounds();
f32 x = bounds.x;
+ f32 remainingWidth = bounds.width;
constexpr glm::vec4 labelColor{0.686f, 0.686f, 0.686f, 1.0f};
@@ -150,13 +151,18 @@ void IntEditor::render(ui::UIBatchRenderer& renderer) {
labelWidget_->layout(labelBounds);
labelWidget_->renderTree(renderer);
x += LABEL_WIDTH + SPACING;
+ remainingWidth -= LABEL_WIDTH + SPACING;
}
if (textField_) {
- ui::Rect textBounds{x, bounds.y, TEXTFIELD_WIDTH, bounds.height};
+ f32 textFieldWidth = remainingWidth;
+ if (slider_ && showSlider_) {
+ textFieldWidth = TEXTFIELD_WIDTH;
+ }
+ ui::Rect textBounds{x, bounds.y, textFieldWidth, bounds.height};
textField_->layout(textBounds);
textField_->renderTree(renderer);
- x += TEXTFIELD_WIDTH;
+ x += textFieldWidth;
}
if (slider_ && showSlider_) {
diff --git a/src/esengine/editor/property/editors/Vector3Editor.cpp b/src/esengine/editor/property/editors/Vector3Editor.cpp
index 8b55554e5..201b0ffe9 100644
--- a/src/esengine/editor/property/editors/Vector3Editor.cpp
+++ b/src/esengine/editor/property/editors/Vector3Editor.cpp
@@ -27,12 +27,14 @@ Vector3Editor::Vector3Editor(const ui::WidgetId& id, const std::string& property
if (showLabel_) {
auto mainLabelWidget = makeUnique<ui::Label>(ui::WidgetId(getId().path + "_label"));
mainLabelWidget->setText(label_);
+ mainLabelWidget->setFontSize(12.0f);
mainLabel_ = mainLabelWidget.get();
addChild(std::move(mainLabelWidget));
}
auto xLabelWidget = makeUnique<ui::Label>(ui::WidgetId(getId().path + "_x_label"));
xLabelWidget->setText("X");
+ xLabelWidget->setFontSize(12.0f);
xLabel_ = xLabelWidget.get();
addChild(std::move(xLabelWidget));
@@ -43,6 +45,7 @@ Vector3Editor::Vector3Editor(const ui::WidgetId& id, const std::string& property
auto yLabelWidget = makeUnique<ui::Label>(ui::WidgetId(getId().path + "_y_label"));
yLabelWidget->setText("Y");
+ yLabelWidget->setFontSize(12.0f);
yLabel_ = yLabelWidget.get();
addChild(std::move(yLabelWidget));
@@ -53,6 +56,7 @@ Vector3Editor::Vector3Editor(const ui::WidgetId& id, const std::string& property
auto zLabelWidget = makeUnique<ui::Label>(ui::WidgetId(getId().path + "_z_label"));
zLabelWidget->setText("Z");
+ zLabelWidget->setFontSize(12.0f);
zLabel_ = zLabelWidget.get();
addChild(std::move(zLabelWidget));
@@ -61,15 +65,15 @@ Vector3Editor::Vector3Editor(const ui::WidgetId& id, const std::string& property
zEditor_ = zEditorWidget.get();
addChild(std::move(zEditorWidget));
- sink(xEditor_->onValueChanged).connect(
+ connections_.add(sink(xEditor_->onValueChanged).connect(
[this](const std::any&) { onComponentChanged(); }
- );
- sink(yEditor_->onValueChanged).connect(
+ ));
+ connections_.add(sink(yEditor_->onValueChanged).connect(
[this](const std::any&) { onComponentChanged(); }
- );
- sink(zEditor_->onValueChanged).connect(
+ ));
+ connections_.add(sink(zEditor_->onValueChanged).connect(
[this](const std::any&) { onComponentChanged(); }
- );
+ ));
}
// =============================================================================
@@ -125,7 +129,13 @@ void Vector3Editor::render(ui::UIBatchRenderer& renderer) {
const ui::Rect& bounds = getBounds();
f32 x = bounds.x;
+ constexpr glm::vec4 labelColor{0.686f, 0.686f, 0.686f, 1.0f};
+ constexpr glm::vec4 xColor{0.9f, 0.4f, 0.4f, 1.0f};
+ constexpr glm::vec4 yColor{0.4f, 0.9f, 0.4f, 1.0f};
+ constexpr glm::vec4 zColor{0.4f, 0.6f, 0.9f, 1.0f};
+
if (mainLabel_ && showLabel_) {
+ mainLabel_->setColor(labelColor);
ui::Rect labelBounds{x, bounds.y, MAIN_LABEL_WIDTH, bounds.height};
mainLabel_->layout(labelBounds);
mainLabel_->renderTree(renderer);
@@ -133,6 +143,7 @@ void Vector3Editor::render(ui::UIBatchRenderer& renderer) {
}
if (xLabel_) {
+ xLabel_->setColor(xColor);
ui::Rect labelBounds{x, bounds.y, COMPONENT_LABEL_WIDTH, bounds.height};
xLabel_->layout(labelBounds);
xLabel_->renderTree(renderer);
@@ -147,6 +158,7 @@ void Vector3Editor::render(ui::UIBatchRenderer& renderer) {
}
if (yLabel_) {
+ yLabel_->setColor(yColor);
ui::Rect labelBounds{x, bounds.y, COMPONENT_LABEL_WIDTH, bounds.height};
yLabel_->layout(labelBounds);
yLabel_->renderTree(renderer);
@@ -161,6 +173,7 @@ void Vector3Editor::render(ui::UIBatchRenderer& renderer) {
}
if (zLabel_) {
+ zLabel_->setColor(zColor);
ui::Rect labelBounds{x, bounds.y, COMPONENT_LABEL_WIDTH, bounds.height};
zLabel_->layout(labelBounds);
zLabel_->renderTree(renderer);
diff --git a/src/esengine/editor/property/editors/Vector3Editor.hpp b/src/esengine/editor/property/editors/Vector3Editor.hpp
index e8920db46..a48b0336c 100644
--- a/src/esengine/editor/property/editors/Vector3Editor.hpp
+++ b/src/esengine/editor/property/editors/Vector3Editor.hpp
@@ -18,6 +18,7 @@
#include "../PropertyEditor.hpp"
#include "FloatEditor.hpp"
#include "../../../ui/widgets/Label.hpp"
+#include "../../../events/Connection.hpp"
#include <glm/glm.hpp>
@@ -85,6 +86,7 @@ private:
FloatEditor* xEditor_ = nullptr;
FloatEditor* yEditor_ = nullptr;
FloatEditor* zEditor_ = nullptr;
+ ConnectionHolder connections_;
static constexpr f32 MAIN_LABEL_WIDTH = 60.0f;
static constexpr f32 COMPONENT_LABEL_WIDTH = 12.0f;