From f1681625ec9127320559f8f2bf7ab5a3e4284c41 Mon Sep 17 00:00:00 2001 From: Kotaro Yoshimoto Date: Tue, 28 Jan 2025 01:23:07 +0900 Subject: [PATCH] =?UTF-8?q?SvgTextBuilder=E3=81=A7anchor=E3=82=92=E8=A8=AD?= =?UTF-8?q?=E5=AE=9A=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../crane_msg_wrappers/crane_visualizer_wrapper.hpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/utility/crane_msg_wrappers/include/crane_msg_wrappers/crane_visualizer_wrapper.hpp b/utility/crane_msg_wrappers/include/crane_msg_wrappers/crane_visualizer_wrapper.hpp index 75aad3a80..0b2b9ff7c 100644 --- a/utility/crane_msg_wrappers/include/crane_msg_wrappers/crane_visualizer_wrapper.hpp +++ b/utility/crane_msg_wrappers/include/crane_msg_wrappers/crane_visualizer_wrapper.hpp @@ -230,6 +230,8 @@ struct SvgTextBuilder bool view_box_position = false; + std::string anchor = "start"; + SvgTextBuilder() {} std::string getSvgString() const @@ -242,7 +244,7 @@ struct SvgTextBuilder oss << "x=\"" << text_position.x() * 1000. << "\" y=\"" << text_position.y() * 1000. << "\" "; } oss << "\" fill=\"" << fill_color << "\" fill-opacity=\"" << fill_opacity << "\" font-size=\"" - << font_size << "\">" << text_string << ""; + << font_size << "\" text-anchor=\"" << anchor << "\">" << text_string << ""; return oss.str(); } @@ -282,6 +284,12 @@ struct SvgTextBuilder font_size = size; return *this; } + + SvgTextBuilder & textAnchor(const std::string & anchor) + { + this->anchor = anchor; + return *this; + } }; struct SvgPolyLineBuilder