From 2dd8c1f669c9941709556cc233d8435d827f8149 Mon Sep 17 00:00:00 2001 From: Sandeep Dubey Date: Sun, 3 Dec 2017 02:40:11 +0530 Subject: [PATCH] Made the changes asked by the reviewer --- core/css.js | 3 +++ core/field_dropdown.js | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/core/css.js b/core/css.js index d5074b0e3..134b31dea 100644 --- a/core/css.js +++ b/core/css.js @@ -499,6 +499,9 @@ Blockly.Css.CONTENT = [ '.blocklyDropdownMenu {', 'padding: 0 !important;', + /* max-height value is same as the constant + * Blockly.FieldDropdown.MAX_MENU_HEIGHT defined in field_dropdown.js. */ + 'max-height: 300px !important;', '}', /* Override the default Closure URL. */ diff --git a/core/field_dropdown.js b/core/field_dropdown.js index d70212186..2f9c11e61 100644 --- a/core/field_dropdown.js +++ b/core/field_dropdown.js @@ -68,6 +68,12 @@ goog.inherits(Blockly.FieldDropdown, Blockly.Field); */ Blockly.FieldDropdown.CHECKMARK_OVERHANG = 25; +/** + * Maximum height of the dropdown menu,it's also referenced in css.js as + * part of .blocklyDropdownMenu. + */ +Blockly.FieldDropdown.MAX_MENU_HEIGHT = 300; + /** * Android can't (in 2014) display "▾", so use "▼" instead. */ @@ -239,6 +245,10 @@ Blockly.FieldDropdown.prototype.positionMenu_ = function(menu) { this.createWidget_(menu); var menuSize = Blockly.utils.uiMenu.getSize(menu); + if (menuSize.height > Blockly.FieldDropdown.MAX_MENU_HEIGHT) { + menuSize.height = Blockly.FieldDropdown.MAX_MENU_HEIGHT; + } + if (this.sourceBlock_.RTL) { Blockly.utils.uiMenu.adjustBBoxesForRTL(viewportBBox, anchorBBox, menuSize); }