From 6a7f002a94cc626010d1702503f9aa335c6b0e30 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Thu, 11 Nov 2021 19:47:59 +0100 Subject: [PATCH] Improved the sizing of screen corners in NinePatchComponent. --- es-core/src/components/NinePatchComponent.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/es-core/src/components/NinePatchComponent.cpp b/es-core/src/components/NinePatchComponent.cpp index 0f28b8635..51bc5c104 100644 --- a/es-core/src/components/NinePatchComponent.cpp +++ b/es-core/src/components/NinePatchComponent.cpp @@ -10,6 +10,7 @@ #include "Log.h" #include "ThemeData.h" +#include "resources/Font.h" #include "resources/TextureResource.h" NinePatchComponent::NinePatchComponent(Window* window, @@ -60,10 +61,10 @@ void NinePatchComponent::buildVertices() relCornerSize = mCornerSize; } else { - // Scale the corner size relative to the screen resolution. + // Scale the corner size relative to the screen resolution (using the medium sized + // default font as size reference). relCornerSize = glm::round( - mCornerSize * - ((Renderer::getScreenHeightModifier() + Renderer::getScreenWidthModifier()) / 2.0f)); + mCornerSize * (Font::get(FONT_SIZE_MEDIUM)->getLetterHeight() * 0.0568f / 2.0f)); } mTexture = TextureResource::get(mPath, false, false, false);