mirror of
https://github.com/scratchfoundation/scratch-blocks.git
synced 2025-06-26 04:00:23 -04:00
Require spaces around infix ops
This commit is contained in:
parent
0477aaa257
commit
efcb456424
8 changed files with 509 additions and 508 deletions
|
@ -41,6 +41,7 @@
|
||||||
"quotes": ["off"], # Blockly mixes single and double quotes
|
"quotes": ["off"], # Blockly mixes single and double quotes
|
||||||
"semi": ["error", "always"],
|
"semi": ["error", "always"],
|
||||||
"space-before-function-paren": ["error", "never"], # Blockly doesn't have space before function paren
|
"space-before-function-paren": ["error", "never"], # Blockly doesn't have space before function paren
|
||||||
|
"space-infix-ops": ["error"],
|
||||||
"strict": ["off"], # Blockly uses 'use strict' in files
|
"strict": ["off"], # Blockly uses 'use strict' in files
|
||||||
"no-cond-assign": ["off"], # Blockly often uses cond-assignment in loops
|
"no-cond-assign": ["off"], # Blockly often uses cond-assignment in loops
|
||||||
"no-redeclare": ["off"], # Closure style allows redeclarations
|
"no-redeclare": ["off"], # Closure style allows redeclarations
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -207,7 +207,7 @@ Blockly.BlockDragSurfaceSvg.prototype.translateAndScaleGroup = function(x, y, sc
|
||||||
var fixedX = x.toFixed(0);
|
var fixedX = x.toFixed(0);
|
||||||
var fixedY = y.toFixed(0);
|
var fixedY = y.toFixed(0);
|
||||||
this.dragGroup_.setAttribute('transform',
|
this.dragGroup_.setAttribute('transform',
|
||||||
'translate('+ fixedX + ','+ fixedY + ') scale(' + scale + ')');
|
'translate(' + fixedX + ',' + fixedY + ') scale(' + scale + ')');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -118,7 +118,7 @@ Blockly.BlockSvg.FIELD_DEFAULT_CORNER_RADIUS = 4 * Blockly.BlockSvg.GRID_UNIT;
|
||||||
* Minimum width of a block.
|
* Minimum width of a block.
|
||||||
* @const
|
* @const
|
||||||
*/
|
*/
|
||||||
Blockly.BlockSvg.MIN_BLOCK_X = 1/2 * 16 * Blockly.BlockSvg.GRID_UNIT;
|
Blockly.BlockSvg.MIN_BLOCK_X = 1 / 2 * 16 * Blockly.BlockSvg.GRID_UNIT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Minimum height of a block.
|
* Minimum height of a block.
|
||||||
|
@ -176,7 +176,7 @@ Blockly.BlockSvg.NOTCH_PATH_DOWN =
|
||||||
* @const
|
* @const
|
||||||
*/
|
*/
|
||||||
Blockly.BlockSvg.NOTCH_PATH_UP =
|
Blockly.BlockSvg.NOTCH_PATH_UP =
|
||||||
'c 0,-2 1,-3 2,-4 '+
|
'c 0,-2 1,-3 2,-4 ' +
|
||||||
'l 4,-4 ' +
|
'l 4,-4 ' +
|
||||||
'c 1,-1 2,-2 2,-4 ' +
|
'c 1,-1 2,-2 2,-4 ' +
|
||||||
'v -12 ' +
|
'v -12 ' +
|
||||||
|
|
|
@ -173,7 +173,7 @@ Blockly.BlockSvg.NOTCH_PATH_LEFT = (
|
||||||
* @const
|
* @const
|
||||||
*/
|
*/
|
||||||
Blockly.BlockSvg.NOTCH_PATH_RIGHT = (
|
Blockly.BlockSvg.NOTCH_PATH_RIGHT = (
|
||||||
'c -2,0 -3,1 -4,2 '+
|
'c -2,0 -3,1 -4,2 ' +
|
||||||
'l -4,4 ' +
|
'l -4,4 ' +
|
||||||
'c -1,1 -2,2 -4,2 ' +
|
'c -1,1 -2,2 -4,2 ' +
|
||||||
'h -12 ' +
|
'h -12 ' +
|
||||||
|
@ -1452,7 +1452,7 @@ Blockly.BlockSvg.prototype.renderDrawLeft_ = function(steps) {
|
||||||
// Draw the left-side edge shape.
|
// Draw the left-side edge shape.
|
||||||
if (this.edgeShape_ === Blockly.OUTPUT_SHAPE_ROUND) {
|
if (this.edgeShape_ === Blockly.OUTPUT_SHAPE_ROUND) {
|
||||||
// Draw a rounded arc.
|
// Draw a rounded arc.
|
||||||
steps.push('a ' + this.edgeShapeWidth_ + ' ' + this.edgeShapeWidth_ + ' 0 0 1 0 -' + this.edgeShapeWidth_*2);
|
steps.push('a ' + this.edgeShapeWidth_ + ' ' + this.edgeShapeWidth_ + ' 0 0 1 0 -' + this.edgeShapeWidth_ * 2);
|
||||||
} else if (this.edgeShape_ === Blockly.OUTPUT_SHAPE_HEXAGONAL) {
|
} else if (this.edgeShape_ === Blockly.OUTPUT_SHAPE_HEXAGONAL) {
|
||||||
// Draw a half-hexagon.
|
// Draw a half-hexagon.
|
||||||
steps.push('l ' + -this.edgeShapeWidth_ + ' ' + -this.edgeShapeWidth_ +
|
steps.push('l ' + -this.edgeShapeWidth_ + ' ' + -this.edgeShapeWidth_ +
|
||||||
|
|
|
@ -361,7 +361,7 @@ Blockly.FieldAngle.prototype.updateGraph_ = function() {
|
||||||
this.gauge_.setAttribute('d', path.join(''));
|
this.gauge_.setAttribute('d', path.join(''));
|
||||||
this.line_.setAttribute('x2', x2);
|
this.line_.setAttribute('x2', x2);
|
||||||
this.line_.setAttribute('y2', y2);
|
this.line_.setAttribute('y2', y2);
|
||||||
this.handle_.setAttribute('transform', 'translate(' + x2 + ',' + y2 +')');
|
this.handle_.setAttribute('transform', 'translate(' + x2 + ',' + y2 + ')');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -240,7 +240,7 @@ Blockly.FieldTextInput.prototype.showEditor_ = function(
|
||||||
if (opt_withArrow) {
|
if (opt_withArrow) {
|
||||||
// Move text in input to account for displayed drop-down arrow.
|
// Move text in input to account for displayed drop-down arrow.
|
||||||
if (this.sourceBlock_.RTL) {
|
if (this.sourceBlock_.RTL) {
|
||||||
htmlInput.style.paddingLeft = (this.arrowSize_+ Blockly.BlockSvg.DROPDOWN_ARROW_PADDING) + 'px';
|
htmlInput.style.paddingLeft = (this.arrowSize_ + Blockly.BlockSvg.DROPDOWN_ARROW_PADDING) + 'px';
|
||||||
} else {
|
} else {
|
||||||
htmlInput.style.paddingRight = (this.arrowSize_ + Blockly.BlockSvg.DROPDOWN_ARROW_PADDING) + 'px';
|
htmlInput.style.paddingRight = (this.arrowSize_ + Blockly.BlockSvg.DROPDOWN_ARROW_PADDING) + 'px';
|
||||||
}
|
}
|
||||||
|
|
|
@ -624,7 +624,7 @@ Blockly.Flyout.prototype.recordCategoryScrollPositions_ = function() {
|
||||||
if (numCategories > 0) {
|
if (numCategories > 0) {
|
||||||
for (var i = 0; i < numCategories - 1; i++) {
|
for (var i = 0; i < numCategories - 1; i++) {
|
||||||
var currentPos = this.categoryScrollPositions[i].position;
|
var currentPos = this.categoryScrollPositions[i].position;
|
||||||
var nextPos = this.categoryScrollPositions[i+1].position;
|
var nextPos = this.categoryScrollPositions[i + 1].position;
|
||||||
var length = nextPos - currentPos;
|
var length = nextPos - currentPos;
|
||||||
this.categoryScrollPositions[i].length = length;
|
this.categoryScrollPositions[i].length = length;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue