mirror of
https://github.com/google/blockly.git
synced 2026-01-09 10:00:09 +01:00
clang-format core/renderers/measurables/rows.js
This commit is contained in:
@@ -36,8 +36,7 @@ const object = goog.require('Blockly.utils.object');
|
||||
* @extends {Row}
|
||||
*/
|
||||
const BottomRow = function(constants) {
|
||||
BottomRow.superClass_.constructor.call(this,
|
||||
constants);
|
||||
BottomRow.superClass_.constructor.call(this, constants);
|
||||
this.type |= Types.BOTTOM_ROW;
|
||||
|
||||
/**
|
||||
@@ -69,16 +68,14 @@ const BottomRow = function(constants) {
|
||||
*/
|
||||
this.baseline = 0;
|
||||
};
|
||||
object.inherits(BottomRow,
|
||||
Row);
|
||||
object.inherits(BottomRow, Row);
|
||||
|
||||
/**
|
||||
* Returns whether or not the bottom row has a left square corner.
|
||||
* @param {!BlockSvg} block The block whose bottom row this represents.
|
||||
* @return {boolean} Whether or not the bottom row has a left square corner.
|
||||
*/
|
||||
BottomRow.prototype.hasLeftSquareCorner = function(
|
||||
block) {
|
||||
BottomRow.prototype.hasLeftSquareCorner = function(block) {
|
||||
return !!block.outputConnection || !!block.getNextBlock();
|
||||
};
|
||||
|
||||
@@ -87,8 +84,7 @@ BottomRow.prototype.hasLeftSquareCorner = function(
|
||||
* @param {!BlockSvg} _block The block whose bottom row this represents.
|
||||
* @return {boolean} Whether or not the bottom row has a right square corner.
|
||||
*/
|
||||
BottomRow.prototype.hasRightSquareCorner = function(
|
||||
_block) {
|
||||
BottomRow.prototype.hasRightSquareCorner = function(_block) {
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
@@ -39,8 +39,7 @@ const InputRow = function(constants) {
|
||||
*/
|
||||
this.connectedBlockWidths = 0;
|
||||
};
|
||||
object.inherits(InputRow,
|
||||
Row);
|
||||
object.inherits(InputRow, Row);
|
||||
|
||||
/**
|
||||
* Inspect all subcomponents and populate all size properties on the row.
|
||||
@@ -56,10 +55,9 @@ InputRow.prototype.measure = function() {
|
||||
if (Types.isInput(elem)) {
|
||||
if (Types.isStatementInput(elem)) {
|
||||
connectedBlockWidths += elem.connectedBlockWidth;
|
||||
} else if (Types.isExternalInput(elem) &&
|
||||
elem.connectedBlockWidth != 0) {
|
||||
connectedBlockWidths += (elem.connectedBlockWidth -
|
||||
elem.connectionWidth);
|
||||
} else if (Types.isExternalInput(elem) && elem.connectedBlockWidth != 0) {
|
||||
connectedBlockWidths +=
|
||||
(elem.connectedBlockWidth - elem.connectionWidth);
|
||||
}
|
||||
}
|
||||
if (!(Types.isSpacer(elem))) {
|
||||
|
||||
@@ -31,19 +31,15 @@ const object = goog.require('Blockly.utils.object');
|
||||
* @extends {Row}
|
||||
*/
|
||||
const SpacerRow = function(constants, height, width) {
|
||||
SpacerRow.superClass_.constructor.call(this,
|
||||
constants);
|
||||
this.type |= Types.SPACER |
|
||||
Types.BETWEEN_ROW_SPACER;
|
||||
SpacerRow.superClass_.constructor.call(this, constants);
|
||||
this.type |= Types.SPACER | Types.BETWEEN_ROW_SPACER;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.followsStatement = false;
|
||||
this.widthWithConnectedBlocks = 0;
|
||||
this.elements = [
|
||||
new InRowSpacer(this.constants_, width)];
|
||||
this.elements = [new InRowSpacer(this.constants_, width)];
|
||||
};
|
||||
object.inherits(SpacerRow,
|
||||
Row);
|
||||
object.inherits(SpacerRow, Row);
|
||||
|
||||
/**
|
||||
* @override
|
||||
|
||||
@@ -69,8 +69,7 @@ const TopRow = function(constants) {
|
||||
*/
|
||||
this.connection = null;
|
||||
};
|
||||
object.inherits(TopRow,
|
||||
Row);
|
||||
object.inherits(TopRow, Row);
|
||||
|
||||
/**
|
||||
* Returns whether or not the top row has a left square corner.
|
||||
@@ -78,13 +77,13 @@ object.inherits(TopRow,
|
||||
* @return {boolean} Whether or not the top row has a left square corner.
|
||||
*/
|
||||
TopRow.prototype.hasLeftSquareCorner = function(block) {
|
||||
const hasHat = (block.hat ?
|
||||
block.hat === 'cap' : this.constants_.ADD_START_HATS) &&
|
||||
const hasHat =
|
||||
(block.hat ? block.hat === 'cap' : this.constants_.ADD_START_HATS) &&
|
||||
!block.outputConnection && !block.previousConnection;
|
||||
const prevBlock = block.getPreviousBlock();
|
||||
|
||||
return !!block.outputConnection ||
|
||||
hasHat || (prevBlock ? prevBlock.getNextBlock() == block : false);
|
||||
return !!block.outputConnection || hasHat ||
|
||||
(prevBlock ? prevBlock.getNextBlock() == block : false);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -92,8 +91,7 @@ TopRow.prototype.hasLeftSquareCorner = function(block) {
|
||||
* @param {!BlockSvg} _block The block whose top row this represents.
|
||||
* @return {boolean} Whether or not the top row has a right square corner.
|
||||
*/
|
||||
TopRow.prototype.hasRightSquareCorner = function(
|
||||
_block) {
|
||||
TopRow.prototype.hasRightSquareCorner = function(_block) {
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user