修复了编辑器失去焦点时依然显示指针的问题

This commit is contained in:
梦凌汐 2024-12-19 16:53:45 +08:00
parent 43540603c5
commit 09c45e5af8
2 changed files with 7 additions and 2 deletions

View File

@ -90,7 +90,10 @@ public:
void onKeyPress(int key) override { return; }
void setVisibility(bool visibility) { visibility_ = visibility; }
void setVisibility(bool visibility) {
if(visibility == visibility_) return;
visibility_ = visibility;
}
bool isVisible() { return visibility_; }
};

View File

@ -12,7 +12,7 @@
class Editor : public BaseComponent {
private:
TextArea textArea_ = TextArea(0, 0, 0, 0);
Cursor cursor_;
Cursor cursor_ = Cursor(0, 0, false);
std::string content_;
RichText coloredContent_;
std::string ruleName_;
@ -120,6 +120,8 @@ public:
void setFocus(bool focusStatus) {
BaseComponent::setFocus(focusStatus);
cursor_.setVisibility(focusStatus);
draw();
}
void onKeyPress(int key) override {