align should use rotate property

This commit is contained in:
nullobsi 2021-02-01 01:44:51 -08:00
parent c8d7b6fa92
commit 72cd753c02
No known key found for this signature in database
GPG Key ID: 4698F7ECCC7E2005
1 changed files with 15 additions and 5 deletions

View File

@ -32,14 +32,24 @@ ALabel::ALabel(const Json::Value& config, const std::string& name, const std::st
label_.set_width_chars(config_["min-length"].asUInt()); label_.set_width_chars(config_["min-length"].asUInt());
} }
uint rotate = 0;
if (config_["rotate"].isUInt()) {
rotate = config["rotate"].asUInt();
label_.set_angle(rotate);
}
if (config_["align"].isDouble()) { if (config_["align"].isDouble()) {
auto align = config_["align"].asFloat(); auto align = config_["align"].asFloat();
if (rotate == 90 || rotate == 270) {
label_.set_yalign(align);
} else {
label_.set_xalign(align); label_.set_xalign(align);
} }
if (config_["rotate"].isUInt()) {
label_.set_angle(config["rotate"].asUInt());
} }
} }
auto ALabel::update() -> void { auto ALabel::update() -> void {