aboutsummaryrefslogtreecommitdiff
path: root/src/theme_builder/components/properties/PointPropertyEditor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/theme_builder/components/properties/PointPropertyEditor.cpp')
-rw-r--r--src/theme_builder/components/properties/PointPropertyEditor.cpp30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/theme_builder/components/properties/PointPropertyEditor.cpp b/src/theme_builder/components/properties/PointPropertyEditor.cpp
index 60f3c06c..6d4277aa 100644
--- a/src/theme_builder/components/properties/PointPropertyEditor.cpp
+++ b/src/theme_builder/components/properties/PointPropertyEditor.cpp
@@ -9,21 +9,17 @@ PointPropertyEditor::PointPropertyEditor() {
container_.AddChild(&text_);
text_.TextChangeEvent()->AddHandler([this](std::nullptr_t) {
- if (!suppress_next_change_event_) {
- auto text = text_.GetTextView();
- auto point_mapper =
- ui::mapper::MapperRegistry::GetInstance()->GetMapper<ui::Point>();
- try {
- auto point = point_mapper->MapFromString(text.ToString());
- point_ = point;
- is_text_valid_ = true;
- change_event_.Raise(nullptr);
- } catch (const Exception&) {
- is_text_valid_ = false;
- // TODO: Show error!
- }
- } else {
- suppress_next_change_event_ = false;
+ auto text = text_.GetTextView();
+ auto point_mapper =
+ ui::mapper::MapperRegistry::GetInstance()->GetMapper<ui::Point>();
+ try {
+ auto point = point_mapper->MapFromString(text.ToString());
+ point_ = point;
+ is_text_valid_ = true;
+ RaiseChangeEvent();
+ } catch (const Exception&) {
+ is_text_valid_ = false;
+ // TODO: Show error!
}
});
}
@@ -32,9 +28,7 @@ PointPropertyEditor::~PointPropertyEditor() {}
void PointPropertyEditor::SetValue(const ui::Point& point,
bool trigger_change) {
- point_ = point;
- is_text_valid_ = true;
- if (!trigger_change) suppress_next_change_event_ = true;
+ if (!trigger_change) SuppressNextChangeEvent();
text_.SetText(ConvertPointToString(point));
}