修复文本y坐标不正确
This commit is contained in:
@@ -247,7 +247,7 @@ void text_layout_t::line_t::format(const font_face_ptr& in_primary_font, float i
|
||||
|
||||
const float size_y_diff = g_metrics.rect.size().y() - static_cast<float>(g.region->rect.size().y());
|
||||
const float baseline_y = position_y + metrics.ascent + (line_height - metrics.line_height) / 2.0f;
|
||||
g.position.y() = baseline_y + g_metrics.offset.y() + size_y_diff;
|
||||
g.position.y() = baseline_y + g_metrics.offset.y() + size_y_diff - metrics.descent;
|
||||
|
||||
cursor_x += kerning + g_metrics.advance.x();
|
||||
|
||||
|
||||
@@ -55,9 +55,10 @@ void meditable_text_box::on_paint(mirage_paint_context& in_context) {
|
||||
in_context.geo()
|
||||
);
|
||||
if (is_focus()) {
|
||||
const float line_height = layout_.get_last_line().get_line_height();
|
||||
const float line_width = layout_.get_last_line().line_width;
|
||||
const auto& cursor_pos = Eigen::Vector2f(line_width, layout_.get_last_line().position_y) + Eigen::Vector2f(round_, round_);
|
||||
const auto& last_line = layout_.get_last_line();
|
||||
const float line_height = last_line.get_line_height() * line_spacing_;
|
||||
const float line_width = last_line.line_width;
|
||||
const auto& cursor_pos = Eigen::Vector2f(line_width, last_line.position_y) + Eigen::Vector2f(round_, round_);
|
||||
// 绘制光标
|
||||
in_context.drawer().make_rounded_rect(
|
||||
cursor_pos,
|
||||
|
||||
Reference in New Issue
Block a user