Skip to content

Commit 98a1f55

Browse files
Refactor: Remove unused duplicate functions from block.js (#5333)
1 parent c22caa8 commit 98a1f55

File tree

1 file changed

+0
-109
lines changed

1 file changed

+0
-109
lines changed

js/block.js

Lines changed: 0 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -4182,115 +4182,6 @@ class Block {
41824182
return new Date().getTime() - this._piemenuExitTime > 200;
41834183
}
41844184

4185-
/**
4186-
* Checks if the block's input is a number value.
4187-
* @private
4188-
* @param {number} c - The index of the connection.
4189-
* @returns {boolean} - True if the input is a number value, false otherwise.
4190-
*/
4191-
_noteValueNumber(c) {
4192-
// Is this a number block being used as a note value
4193-
// denominator argument?
4194-
const dblk = this.connections[0];
4195-
// Are we connected to a divide block?
4196-
if (
4197-
this.name === "number" &&
4198-
dblk !== null &&
4199-
this.blocks.blockList[dblk].name === "divide"
4200-
) {
4201-
// Are we the denominator (c == 2) or numerator (c == 1)?
4202-
if (
4203-
this.blocks.blockList[dblk].connections[c] === this.blocks.blockList.indexOf(this)
4204-
) {
4205-
// Is the divide block connected to a note value block?
4206-
const cblk = this.blocks.blockList[dblk].connections[0];
4207-
if (cblk !== null) {
4208-
// Is it the first or second arg?
4209-
switch (this.blocks.blockList[cblk].name) {
4210-
case "newnote":
4211-
case "pickup":
4212-
case "tuplet4":
4213-
case "newstaccato":
4214-
case "newslur":
4215-
case "elapsednotes2":
4216-
return this.blocks.blockList[cblk].connections[1] === dblk;
4217-
case "meter":
4218-
this._check_meter_block = cblk;
4219-
// eslint-disable-next-line no-fallthrough
4220-
case "setbpm2":
4221-
case "setmasterbpm2":
4222-
case "stuplet":
4223-
case "rhythm2":
4224-
case "newswing2":
4225-
case "vibrato":
4226-
case "neighbor":
4227-
case "neighbor2":
4228-
return this.blocks.blockList[cblk].connections[2] === dblk;
4229-
default:
4230-
return false;
4231-
}
4232-
}
4233-
}
4234-
}
4235-
4236-
return false;
4237-
}
4238-
4239-
/**
4240-
* Gets the value of the number block being used as a note value.
4241-
* @private
4242-
* @returns {number} - The value of the number block being used as a note value.
4243-
*/
4244-
_noteValueValue() {
4245-
// Return the number block value being used as a note value
4246-
// denominator argument.
4247-
const dblk = this.connections[0];
4248-
// We are connected to a divide block.
4249-
// Is the divide block connected to a note value block?
4250-
let cblk = this.blocks.blockList[dblk].connections[0];
4251-
if (cblk !== null) {
4252-
// Is it the first or second arg?
4253-
switch (this.blocks.blockList[cblk].name) {
4254-
case "newnote":
4255-
case "pickup":
4256-
case "tuplet4":
4257-
case "newstaccato":
4258-
case "newslur":
4259-
case "elapsednotes2":
4260-
if (this.blocks.blockList[cblk].connections[1] === dblk) {
4261-
cblk = this.blocks.blockList[dblk].connections[2];
4262-
return this.blocks.blockList[cblk].value;
4263-
} else {
4264-
return 1;
4265-
}
4266-
case "meter":
4267-
this._check_meter_block = cblk;
4268-
// eslint-disable-next-line no-fallthrough
4269-
case "setbpm2":
4270-
case "setmasterbpm2":
4271-
case "stuplet":
4272-
case "rhythm2":
4273-
case "newswing2":
4274-
case "vibrato":
4275-
case "neighbor":
4276-
case "neighbor2":
4277-
if (this.blocks.blockList[cblk].connections[2] === dblk) {
4278-
if (this.blocks.blockList[cblk].connections[1] === dblk) {
4279-
cblk = this.blocks.blockList[dblk].connections[2];
4280-
return this.blocks.blockList[cblk].value;
4281-
} else {
4282-
return 1;
4283-
}
4284-
} else {
4285-
return 1;
4286-
}
4287-
default:
4288-
return 1;
4289-
}
4290-
}
4291-
4292-
return 1;
4293-
}
42944185

42954186
/**
42964187
* Checks and reinitializes widget windows if their labels are changed.

0 commit comments

Comments
 (0)