chore: fix shouldStartNewRow docs and param names (#7558)

This commit is contained in:
Beka Westberg
2023-10-18 09:29:08 -07:00
committed by GitHub
parent 0e95e45fee
commit b2688441fa
2 changed files with 19 additions and 19 deletions

View File

@@ -345,34 +345,34 @@ export class RenderInfo {
/**
* Decide whether to start a new row between the two Blockly.Inputs.
*
* @param input The first input to consider
* @param lastInput The input that follows.
* @returns True if the next input should be rendered on a new row.
* @param currInput The current input.
* @param prevInput The previous input.
* @returns True if the current input should be rendered on a new row.
*/
protected shouldStartNewRow_(input: Input, lastInput?: Input): boolean {
protected shouldStartNewRow_(currInput: Input, prevInput?: Input): boolean {
// If this is the first input, just add to the existing row.
// That row is either empty or has some icons in it.
if (!lastInput) {
if (!prevInput) {
return false;
}
// If the previous input was an end-row input, then any following input
// should always be rendered on the next row.
if (lastInput instanceof EndRowInput) {
if (prevInput instanceof EndRowInput) {
return true;
}
// A statement input or an input following one always gets a new row.
if (
input instanceof StatementInput ||
lastInput instanceof StatementInput
currInput instanceof StatementInput ||
prevInput instanceof StatementInput
) {
return true;
}
// Value inputs, dummy inputs, and any input following an external value
// input get a new row if inputs are not inlined.
if (
input instanceof ValueInput ||
input instanceof DummyInput ||
lastInput instanceof ValueInput
currInput instanceof ValueInput ||
currInput instanceof DummyInput ||
prevInput instanceof ValueInput
) {
return !this.isInline;
}

View File

@@ -118,29 +118,29 @@ export class RenderInfo extends BaseRenderInfo {
this.finalize_();
}
override shouldStartNewRow_(input: Input, lastInput: Input): boolean {
override shouldStartNewRow_(currInput: Input, prevInput: Input): boolean {
// If this is the first input, just add to the existing row.
// That row is either empty or has some icons in it.
if (!lastInput) {
if (!prevInput) {
return false;
}
// If the previous input was an end-row input, then any following input
// should always be rendered on the next row.
if (lastInput instanceof EndRowInput) {
if (prevInput instanceof EndRowInput) {
return true;
}
// A statement input or an input following one always gets a new row.
if (
input instanceof StatementInput ||
lastInput instanceof StatementInput
currInput instanceof StatementInput ||
prevInput instanceof StatementInput
) {
return true;
}
// Value, dummy, and end-row inputs get new row if inputs are not inlined.
if (
input instanceof ValueInput ||
input instanceof DummyInput ||
input instanceof EndRowInput
currInput instanceof ValueInput ||
currInput instanceof DummyInput ||
currInput instanceof EndRowInput
) {
return !this.isInline || this.isMultiRow;
}