mirror of
https://github.com/google/blockly.git
synced 2026-01-08 17:40:09 +01:00
chore: runs clang format on all files (#5627)
This commit is contained in:
@@ -72,7 +72,7 @@ exports.isDebuggerEnabled = isDebuggerEnabled;
|
||||
* to register.
|
||||
* @throws {Error} if a renderer with the same name has already been registered.
|
||||
*/
|
||||
const register = function(name, rendererClass) {
|
||||
const register = function(name, rendererClass) {
|
||||
registry.register(registry.Type.RENDERER, name, rendererClass);
|
||||
};
|
||||
exports.register = register;
|
||||
|
||||
@@ -784,7 +784,8 @@ ConstantProvider.prototype.makeJaggedTeeth = function() {
|
||||
const width = this.JAGGED_TEETH_WIDTH;
|
||||
|
||||
const mainPath = svgPaths.line([
|
||||
svgPaths.point(width, height / 4), svgPaths.point(-width * 2, height / 2),
|
||||
svgPaths.point(width, height / 4),
|
||||
svgPaths.point(-width * 2, height / 2),
|
||||
svgPaths.point(width, height / 4),
|
||||
]);
|
||||
return {height: height, width: width, path: mainPath};
|
||||
@@ -800,7 +801,8 @@ ConstantProvider.prototype.makeStartHat = function() {
|
||||
const width = this.START_HAT_WIDTH;
|
||||
|
||||
const mainPath = svgPaths.curve('c', [
|
||||
svgPaths.point(30, -height), svgPaths.point(70, -height),
|
||||
svgPaths.point(30, -height),
|
||||
svgPaths.point(70, -height),
|
||||
svgPaths.point(width, 0),
|
||||
]);
|
||||
return {height: height, width: width, path: mainPath};
|
||||
@@ -837,7 +839,8 @@ ConstantProvider.prototype.makePuzzleTab = function() {
|
||||
'c',
|
||||
[
|
||||
svgPaths.point(0, forward * control1Y),
|
||||
svgPaths.point(-width, back * control2Y), endPoint1,
|
||||
svgPaths.point(-width, back * control2Y),
|
||||
endPoint1,
|
||||
]) +
|
||||
svgPaths.curve(
|
||||
's', [svgPaths.point(width, back * control3Y), endPoint2]);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @license
|
||||
* Copyright 2021 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Block rendering debugging functionality.
|
||||
|
||||
@@ -147,8 +147,7 @@ MarkerSvg.prototype.isCursor = function() {
|
||||
* @package
|
||||
*/
|
||||
MarkerSvg.prototype.createDom = function() {
|
||||
const className =
|
||||
this.isCursor() ? CURSOR_CLASS : MARKER_CLASS;
|
||||
const className = this.isCursor() ? CURSOR_CLASS : MARKER_CLASS;
|
||||
|
||||
this.svgGroup_ = dom.createSvgElement(Svg.G, {'class': className}, null);
|
||||
|
||||
|
||||
@@ -64,8 +64,7 @@ ConstantProvider.prototype.getCSS_ = function(selector) {
|
||||
// Insertion marker.
|
||||
selector + ' .blocklyInsertionMarker>.blocklyPathLight,',
|
||||
selector + ' .blocklyInsertionMarker>.blocklyPathDark {',
|
||||
'fill-opacity: ' + this.INSERTION_MARKER_OPACITY + ';',
|
||||
'stroke: none;',
|
||||
'fill-opacity: ' + this.INSERTION_MARKER_OPACITY + ';', 'stroke: none;',
|
||||
'}',
|
||||
/* eslint-enable indent */
|
||||
]);
|
||||
|
||||
@@ -215,7 +215,8 @@ HighlightConstantProvider.prototype.makePuzzleTab = function() {
|
||||
svgPaths.curve(
|
||||
'q',
|
||||
[
|
||||
svgPaths.point(-width * 0.05, 10), svgPaths.point(width * 0.3, 9.5),
|
||||
svgPaths.point(-width * 0.05, 10),
|
||||
svgPaths.point(width * 0.3, 9.5),
|
||||
]) +
|
||||
svgPaths.moveBy(width * 0.67, -1.9) +
|
||||
svgPaths.lineOnAxis('v', verticalOverlap);
|
||||
@@ -272,12 +273,14 @@ HighlightConstantProvider.prototype.makeJaggedTeeth = function() {
|
||||
HighlightConstantProvider.prototype.makeStartHat = function() {
|
||||
const hatHeight = this.constantProvider.START_HAT.height;
|
||||
const pathRtl = svgPaths.moveBy(25, -8.7) + svgPaths.curve('c', [
|
||||
svgPaths.point(29.7, -6.2), svgPaths.point(57.2, -0.5),
|
||||
svgPaths.point(29.7, -6.2),
|
||||
svgPaths.point(57.2, -0.5),
|
||||
svgPaths.point(75, 8.7),
|
||||
]);
|
||||
|
||||
const pathLtr = svgPaths.curve('c', [
|
||||
svgPaths.point(17.8, -9.2), svgPaths.point(45.3, -14.9),
|
||||
svgPaths.point(17.8, -9.2),
|
||||
svgPaths.point(45.3, -14.9),
|
||||
svgPaths.point(75, -8.7),
|
||||
]) + svgPaths.moveTo(100.5, hatHeight + 0.5);
|
||||
return {
|
||||
|
||||
@@ -59,7 +59,8 @@ InputRow.prototype.measure = function() {
|
||||
if (Types.isInput(elem)) {
|
||||
if (Types.isStatementInput(elem)) {
|
||||
connectedBlockWidths += elem.connectedBlockWidth;
|
||||
} else if (Types.isExternalInput(elem) && elem.connectedBlockWidth !== 0) {
|
||||
} else if (
|
||||
Types.isExternalInput(elem) && elem.connectedBlockWidth !== 0) {
|
||||
connectedBlockWidths +=
|
||||
(elem.connectedBlockWidth - elem.connectionWidth);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ const RoundCorner = function(constants, opt_position) {
|
||||
RoundCorner.superClass_.constructor.call(this, constants);
|
||||
this.type =
|
||||
((!opt_position || opt_position === 'left') ? Types.LEFT_ROUND_CORNER :
|
||||
Types.RIGHT_ROUND_CORNER) |
|
||||
Types.RIGHT_ROUND_CORNER) |
|
||||
Types.CORNER;
|
||||
this.width = this.constants_.CORNER_RADIUS;
|
||||
// The rounded corner extends into the next row by 4 so we only take the
|
||||
|
||||
@@ -38,7 +38,7 @@ const SquareCorner = function(constants, opt_position) {
|
||||
SquareCorner.superClass_.constructor.call(this, constants);
|
||||
this.type =
|
||||
((!opt_position || opt_position === 'left') ? Types.LEFT_SQUARE_CORNER :
|
||||
Types.RIGHT_SQUARE_CORNER) |
|
||||
Types.RIGHT_SQUARE_CORNER) |
|
||||
Types.CORNER;
|
||||
this.height = this.constants_.NO_PADDING;
|
||||
this.width = this.constants_.NO_PADDING;
|
||||
|
||||
@@ -52,7 +52,7 @@ const Types = {
|
||||
ROW: 1 << 20, // Row.
|
||||
TOP_ROW: 1 << 21, // Top Row.
|
||||
BOTTOM_ROW: 1 << 22, // Bottom Row.
|
||||
INPUT_ROW: 1 << 23, // Input Row.
|
||||
INPUT_ROW: 1 << 23, // Input Row.
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -216,21 +216,21 @@ const ConstantProvider = function() {
|
||||
0: 5 * this.GRID_UNIT, // Field in hexagon.
|
||||
1: 2 * this.GRID_UNIT, // Hexagon in hexagon.
|
||||
2: 5 * this.GRID_UNIT, // Round in hexagon.
|
||||
3: 5 * this.GRID_UNIT, // Square in hexagon.
|
||||
3: 5 * this.GRID_UNIT, // Square in hexagon.
|
||||
},
|
||||
2: {
|
||||
// Outer shape: round.
|
||||
0: 3 * this.GRID_UNIT, // Field in round.
|
||||
1: 3 * this.GRID_UNIT, // Hexagon in round.
|
||||
2: 1 * this.GRID_UNIT, // Round in round.
|
||||
3: 2 * this.GRID_UNIT, // Square in round.
|
||||
3: 2 * this.GRID_UNIT, // Square in round.
|
||||
},
|
||||
3: {
|
||||
// Outer shape: square.
|
||||
0: 2 * this.GRID_UNIT, // Field in square.
|
||||
1: 2 * this.GRID_UNIT, // Hexagon in square.
|
||||
2: 2 * this.GRID_UNIT, // Round in square.
|
||||
3: 2 * this.GRID_UNIT, // Square in square.
|
||||
3: 2 * this.GRID_UNIT, // Square in square.
|
||||
},
|
||||
};
|
||||
|
||||
@@ -455,7 +455,8 @@ ConstantProvider.prototype.makeStartHat = function() {
|
||||
const width = this.START_HAT_WIDTH;
|
||||
|
||||
const mainPath = svgPaths.curve('c', [
|
||||
svgPaths.point(25, -height), svgPaths.point(71, -height),
|
||||
svgPaths.point(25, -height),
|
||||
svgPaths.point(71, -height),
|
||||
svgPaths.point(width, 0),
|
||||
]);
|
||||
return {height: height, width: width, path: mainPath};
|
||||
|
||||
@@ -271,8 +271,7 @@ RenderInfo.prototype.addInput_ = function(input, activeRow) {
|
||||
activeRow.rightAlignedDummyInput = input;
|
||||
} else if (input.type === inputTypes.STATEMENT) {
|
||||
// Handle statements without next connections correctly.
|
||||
activeRow.elements.push(
|
||||
new StatementInput(this.constants_, input));
|
||||
activeRow.elements.push(new StatementInput(this.constants_, input));
|
||||
activeRow.hasStatement = true;
|
||||
|
||||
if (activeRow.align === null) {
|
||||
@@ -327,7 +326,7 @@ RenderInfo.prototype.adjustXPosition_ = function() {
|
||||
const nextSpacer = this.rows[i + 1];
|
||||
|
||||
const hasPrevNotch = i === 2 ? !!this.topRow.hasPreviousConnection :
|
||||
!!prevSpacer.followsStatement;
|
||||
!!prevSpacer.followsStatement;
|
||||
const hasNextNotch = i + 2 >= this.rows.length - 1 ?
|
||||
!!this.bottomRow.hasNextConnection :
|
||||
!!nextSpacer.precedesStatement;
|
||||
@@ -505,7 +504,8 @@ RenderInfo.prototype.getNegativeSpacing_ = function(elem) {
|
||||
return 0;
|
||||
}
|
||||
// Special case for hexagonal output.
|
||||
if (outerShape === constants.SHAPES.HEXAGONAL && outerShape !== innerShape) {
|
||||
if (outerShape === constants.SHAPES.HEXAGONAL &&
|
||||
outerShape !== innerShape) {
|
||||
return 0;
|
||||
}
|
||||
return connectionWidth -
|
||||
|
||||
Reference in New Issue
Block a user