Skip to content

Commit f8b807d

Browse files
committed
Fix issue #4794 corrected Pitch block drag-and-drop behavior to match Name block
1 parent 5742a6e commit f8b807d

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

js/blocks.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,7 @@ class Blocks {
10371037
protoblock.name === "nameddo" &&
10381038
protoblock.defaults[0] === that.blockList[oldBlock].value
10391039
) {
1040-
setTimeout(() =>{
1040+
setTimeout(() => {
10411041
blockPalette.remove(protoblock, that.blockList[oldBlock].value);
10421042
delete that
10431043
.protoBlockDict["myDo_" + that.blockList[oldBlock].value];
@@ -1079,7 +1079,7 @@ class Blocks {
10791079
} else if (this.blockList[parentblk].name === "temperament1") {
10801080
cblk = this.blockList[parentblk].connections[1];
10811081
if (cblk == null) {
1082-
const postProcess = (args) =>{
1082+
const postProcess = (args) => {
10831083
const parentblk = args[0];
10841084
const oldBlock = args[1];
10851085

@@ -1351,7 +1351,7 @@ class Blocks {
13511351
return;
13521352
}
13531353
}
1354-
1354+
13551355
if (thisBlockobj.name === "rest2") {
13561356
this._deletePitchBlocks(thisBlock);
13571357
} else {
@@ -2096,8 +2096,9 @@ class Blocks {
20962096
}
20972097
}
20982098

2099-
this.addDefaultBlock(parentblk, thisBlock, actionCheck);
2100-
2099+
if (this.blockList[parentblk].name !== "pitch") {
2100+
this.addDefaultBlock(parentblk, thisBlock, actionCheck);
2101+
}
21012102
/**
21022103
* Put block adjustments inside a slight delay to make the
21032104
* addition/substraction of vspace and changes of block shape
@@ -2169,7 +2170,7 @@ class Blocks {
21692170
if (type1 === "vspacein" && type2 === "vspaceout") {
21702171
return true;
21712172
}
2172-
2173+
21732174
if (type1 === "in" && type2 === "out") {
21742175
return true;
21752176
}
@@ -3310,7 +3311,7 @@ class Blocks {
33103311

33113312
postProcessArg = [thisBlock, DEFAULTCHORD];
33123313
} else if (name === "accidentalname") {
3313-
postProcess = (args) =>{
3314+
postProcess = (args) => {
33143315
const b = args[0];
33153316
const v = args[1];
33163317
that.blockList[b].value = v;
@@ -6450,7 +6451,7 @@ class Blocks {
64506451
if (this.protoBlockDict[blockObjs[c][1][0]] !== undefined) {
64516452
if (
64526453
this.protoBlockDict[blockObjs[c][1][0]].dockTypes[
6453-
cc
6454+
cc
64546455
] !== "out"
64556456
) {
64566457
flowBlock = false;
@@ -7052,18 +7053,18 @@ class Blocks {
70527053
this.setSelectedBlocks = (blocks) => {
70537054
this.selectedBlocks = blocks;
70547055
};
7055-
7056+
70567057
/**
70577058
* Checks if coordinates intersect with any block
70587059
* @public
70597060
* @param {number} x - The x coordinate to check
70607061
* @param {number} y - The y coordinate to check
70617062
* @returns {boolean} True if coordinates intersect with a block
70627063
*/
7063-
this.isCoordinateOnBlock = function(x, y) {
7064+
this.isCoordinateOnBlock = function (x, y) {
70647065
return this.blockList.some(block => {
70657066
if (block.trash) return false;
7066-
7067+
70677068
const blockX = block.container.x;
70687069
const blockY = block.container.y;
70697070
return x >= blockX &&

0 commit comments

Comments
 (0)