2
0
Эх сурвалжийг харах

fixed TextBox caret image aspect ratio

Andrew Karpushin 12 жил өмнө
parent
commit
1adf673c1c

+ 2 - 1
gameplay/src/TextBox.cpp

@@ -397,7 +397,8 @@ void TextBox::drawImages(SpriteBatch* spriteBatch, const Rectangle& clip)
             Vector4 color = _caretImage->getColor();
             Vector4 color = _caretImage->getColor();
             color.w *= _opacity;
             color.w *= _opacity;
 
 
-            spriteBatch->draw(_caretLocation.x - (region.width / 2.0f), _caretLocation.y, region.width, _fontSize, uvs.u1, uvs.v1, uvs.u2, uvs.v2, color, _viewportClipBounds);
+            float caretWidth = region.width * _fontSize / region.height;
+            spriteBatch->draw(_caretLocation.x - caretWidth * 0.5f, _caretLocation.y, caretWidth, _fontSize, uvs.u1, uvs.v1, uvs.u2, uvs.v2, color, _viewportClipBounds);
         }
         }
     }
     }