Skip to content

Commit ac82a9a

Browse files
committed
fix(input): scale the radius
1 parent 69a42de commit ac82a9a

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/ui/controls/input.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ namespace {
7373
constexpr std::size_t kUndoStackLimit = 100;
7474
constexpr auto kTypingUndoCoalesceWindow = std::chrono::milliseconds(1000);
7575

76+
float chromeScaleForControlHeight(float controlHeight) noexcept {
77+
return std::max(0.1f, controlHeight / Style::controlHeight);
78+
}
79+
7680
bool isWordCodepoint(const std::string& text, std::size_t bytePos) {
7781
if (bytePos >= text.size()) {
7882
return false;
@@ -781,6 +785,7 @@ void Input::applyVisualState() {
781785
const bool clearButtonHovered = m_clearButtonArea != nullptr && m_clearButtonArea->hovered();
782786
const bool inputHovered = (m_inputArea != nullptr && m_inputArea->hovered()) || clearButtonHovered;
783787
const bool readOnly = isReadOnlyVisual();
788+
const float chromeScale = chromeScaleForControlHeight(m_controlHeight);
784789

785790
if (m_frameVisible) {
786791
m_background->setVisible(true);
@@ -794,7 +799,7 @@ void Input::applyVisualState() {
794799
.fill = fill,
795800
.border = border,
796801
.fillMode = FillMode::Solid,
797-
.radius = Style::scaledRadiusMd(),
802+
.radius = Style::scaledRadiusMd(chromeScale),
798803
.softness = 1.0f,
799804
.borderWidth = Style::borderWidth,
800805
});

0 commit comments

Comments
 (0)