Improve bubble arrow paths for extreme ratios.

This commit is contained in:
Neil Fraser
2016-09-27 18:26:25 -07:00
parent 972e3b00eb
commit 13c5d9b3dd
2 changed files with 4 additions and 3 deletions

View File

@@ -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;

View File

@@ -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;