|
@@ -1539,7 +1539,7 @@ int64_t TextServer::shaped_text_hit_test_position(const RID &p_shaped, double p_
|
|
|
// Cursor placement hit test.
|
|
|
|
|
|
// Place caret to the left of the leftmost grapheme, or to position 0 if string is empty.
|
|
|
- if (p_coords <= 0) {
|
|
|
+ if (Math::floor(p_coords) <= 0) {
|
|
|
if (v_size > 0) {
|
|
|
if ((glyphs[0].flags & GRAPHEME_IS_RTL) == GRAPHEME_IS_RTL) {
|
|
|
return glyphs[0].end;
|
|
@@ -1552,7 +1552,7 @@ int64_t TextServer::shaped_text_hit_test_position(const RID &p_shaped, double p_
|
|
|
}
|
|
|
|
|
|
// Place caret to the right of the rightmost grapheme, or to position 0 if string is empty.
|
|
|
- if (p_coords >= shaped_text_get_width(p_shaped)) {
|
|
|
+ if (Math::ceil(p_coords) >= shaped_text_get_width(p_shaped)) {
|
|
|
if (v_size > 0) {
|
|
|
if ((glyphs[v_size - 1].flags & GRAPHEME_IS_RTL) == GRAPHEME_IS_RTL) {
|
|
|
return glyphs[v_size - 1].start;
|
|
@@ -1622,7 +1622,8 @@ int64_t TextServer::shaped_text_hit_test_position(const RID &p_shaped, double p_
|
|
|
}
|
|
|
off += glyphs[i].advance * glyphs[i].repeat;
|
|
|
}
|
|
|
- return 0;
|
|
|
+
|
|
|
+ return -1;
|
|
|
}
|
|
|
|
|
|
Vector2 TextServer::shaped_text_get_grapheme_bounds(const RID &p_shaped, int64_t p_pos) const {
|