mirror of
https://github.com/google/blockly.git
synced 2026-01-20 07:17:10 +01:00
Improve bubble arrow paths for extreme ratios.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user