mirror of
https://github.com/google/blockly.git
synced 2026-01-10 10:27:08 +01:00
refactor: Rename ALIGN to Align and move from constants.js to input.js (#5742)
This constant is used to specify the alignment of an Input, so it should live in the same file as the Input class. I've done this as a separate named export, but it could alternatively be made a static member of Input (i.e., Input.Align with only Input being exported by name). Where mocha tests were referring to Blockly.constants.ALIGN.* without actually requiring Blockly.constants, I have reverted them to refer to Blockly.ALIGN_* instead (pending conversion to named requries). Part of #5073.
This commit is contained in:
committed by
GitHub
parent
985af10f6e
commit
c0d22f2002
@@ -15,7 +15,18 @@
|
||||
*/
|
||||
goog.module('Blockly.Input');
|
||||
|
||||
const constants = goog.require('Blockly.constants');
|
||||
/**
|
||||
* Enum for alignment of inputs.
|
||||
* @enum {number}
|
||||
* @alias Blockly.Input.Align
|
||||
*/
|
||||
const Align = {
|
||||
LEFT: -1,
|
||||
CENTRE: 0,
|
||||
RIGHT: 1,
|
||||
};
|
||||
exports.Align = Align;
|
||||
|
||||
const fieldRegistry = goog.require('Blockly.fieldRegistry');
|
||||
/* eslint-disable-next-line no-unused-vars */
|
||||
const {BlockSvg} = goog.requireType('Blockly.BlockSvg');
|
||||
@@ -64,7 +75,7 @@ const Input = function(type, name, block, connection) {
|
||||
* Alignment of input's fields (left, right or centre).
|
||||
* @type {number}
|
||||
*/
|
||||
Input.prototype.align = constants.ALIGN.LEFT;
|
||||
Input.prototype.align = Align.LEFT;
|
||||
|
||||
/**
|
||||
* Is the input visible?
|
||||
@@ -249,8 +260,8 @@ Input.prototype.setCheck = function(check) {
|
||||
|
||||
/**
|
||||
* Change the alignment of the connection's field(s).
|
||||
* @param {number} align One of the values of constants.ALIGN.
|
||||
* In RTL mode directions are reversed, and ALIGN.RIGHT aligns to the left.
|
||||
* @param {number} align One of the values of Align
|
||||
* In RTL mode directions are reversed, and Align.RIGHT aligns to the left.
|
||||
* @return {!Input} The input being modified (to allow chaining).
|
||||
*/
|
||||
Input.prototype.setAlign = function(align) {
|
||||
|
||||
Reference in New Issue
Block a user