From f174f422ff4337b5481aa4ba620991d01f374a04 Mon Sep 17 00:00:00 2001 From: Sam El-Husseini <16690124+samelhusseini@users.noreply.github.com> Date: Thu, 15 Aug 2019 16:23:17 -0700 Subject: [PATCH] Set the border size on a text input to take into account scaling. (#2837) --- core/field_textinput.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/field_textinput.js b/core/field_textinput.js index 305e45e04..af4f2d98e 100644 --- a/core/field_textinput.js +++ b/core/field_textinput.js @@ -88,6 +88,11 @@ Blockly.FieldTextInput.prototype.SERIALIZABLE = true; */ Blockly.FieldTextInput.FONTSIZE = 11; +/** + * Pixel size of input border radius. Should match blocklyText's border-radius in CSS. + */ +Blockly.FieldTextInput.BORDERRADIUS = 4; + /** * Mouse cursor style when over the hotspot that initiates the editor. */ @@ -252,6 +257,9 @@ Blockly.FieldTextInput.prototype.widgetCreate_ = function() { (Blockly.FieldTextInput.FONTSIZE * this.workspace_.scale) + 'pt'; div.style.fontSize = fontSize; htmlInput.style.fontSize = fontSize; + var borderRadius = + (Blockly.FieldTextInput.BORDERRADIUS * this.workspace_.scale) + 'px'; + htmlInput.style.borderRadius = borderRadius; div.appendChild(htmlInput); htmlInput.value = htmlInput.defaultValue = this.value_;