From 13c5d9b3dd088f3a23a2750747226d3aecb267ed Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Tue, 27 Sep 2016 18:26:25 -0700 Subject: [PATCH] Improve bubble arrow paths for extreme ratios. --- core/block.js | 3 ++- core/bubble.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/block.js b/core/block.js index 2021d3f81..8bc08aeff 100644 --- a/core/block.js +++ b/core/block.js @@ -1060,7 +1060,8 @@ Blockly.Block.prototype.interpolate_ = function(message, args, lastDummyAlign) { 'Message does not reference all %s arg(s).', args.length); // Add last dummy input if needed. if (elements.length && (typeof elements[elements.length - 1] == 'string' || - elements[elements.length - 1]['type'].indexOf('field_') == 0)) { + goog.string.startsWith(elements[elements.length - 1]['type'], + 'field_'))) { var dummyInput = {type: 'input_dummy'}; if (lastDummyAlign) { dummyInput['align'] = lastDummyAlign; diff --git a/core/bubble.js b/core/bubble.js index 243ec31e2..cecff159c 100644 --- a/core/bubble.js +++ b/core/bubble.js @@ -93,7 +93,7 @@ Blockly.Bubble.BORDER_WIDTH = 6; * Determines the thickness of the base of the arrow in relation to the size * of the bubble. Higher numbers result in thinner arrows. */ -Blockly.Bubble.ARROW_THICKNESS = 10; +Blockly.Bubble.ARROW_THICKNESS = 5; /** * The number of degrees that the arrow bends counter-clockwise. @@ -530,7 +530,7 @@ Blockly.Bubble.prototype.renderArrow_ = function() { var bubbleSize = this.getBubbleSize(); var thickness = (bubbleSize.width + bubbleSize.height) / Blockly.Bubble.ARROW_THICKNESS; - thickness = Math.min(thickness, bubbleSize.width, bubbleSize.height) / 2; + thickness = Math.min(thickness, bubbleSize.width, bubbleSize.height) / 4; // Back the tip of the arrow off of the anchor. var backoffRatio = 1 - Blockly.Bubble.ANCHOR_RADIUS / hypotenuse;