From 2cc3a8b3d95eed897924fe8311811d4ef7ddd375 Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Tue, 18 Dec 2018 08:41:14 -0500 Subject: [PATCH] Scroll very long context menus --- core/css.js | 1 + core/widgetdiv.js | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/css.js b/core/css.js index 94a75f723..66a789e9b 100644 --- a/core/css.js +++ b/core/css.js @@ -584,6 +584,7 @@ Blockly.Css.CONTENT = [ '.blocklyContextMenu {', 'border-radius: 4px;', + 'max-height: 100%;', '}', '.blocklyDropdownMenu {', diff --git a/core/widgetdiv.js b/core/widgetdiv.js index 8edad91ff..b51dc5e8d 100644 --- a/core/widgetdiv.js +++ b/core/widgetdiv.js @@ -186,7 +186,12 @@ Blockly.WidgetDiv.positionWithAnchor = function(viewportBBox, anchorBBox, var x = Blockly.WidgetDiv.calculateX_(viewportBBox, anchorBBox, widgetSize, rtl); - Blockly.WidgetDiv.positionInternal_(x, y, widgetSize.height); + if (y < 0) { + Blockly.WidgetDiv.positionInternal_(x, 0, widgetSize.height + y); + } + else { + Blockly.WidgetDiv.positionInternal_(x, y, widgetSize.height); + } }; /**