From f8b807d661b055a14b9503309df5bf1af3d8c835 Mon Sep 17 00:00:00 2001 From: Harihara Vardhan Date: Fri, 7 Nov 2025 23:56:26 +0530 Subject: [PATCH] Fix issue #4794 corrected Pitch block drag-and-drop behavior to match Name block --- js/blocks.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/js/blocks.js b/js/blocks.js index 5c684c5661..9d03d94ef0 100644 --- a/js/blocks.js +++ b/js/blocks.js @@ -1037,7 +1037,7 @@ class Blocks { protoblock.name === "nameddo" && protoblock.defaults[0] === that.blockList[oldBlock].value ) { - setTimeout(() =>{ + setTimeout(() => { blockPalette.remove(protoblock, that.blockList[oldBlock].value); delete that .protoBlockDict["myDo_" + that.blockList[oldBlock].value]; @@ -1079,7 +1079,7 @@ class Blocks { } else if (this.blockList[parentblk].name === "temperament1") { cblk = this.blockList[parentblk].connections[1]; if (cblk == null) { - const postProcess = (args) =>{ + const postProcess = (args) => { const parentblk = args[0]; const oldBlock = args[1]; @@ -1351,7 +1351,7 @@ class Blocks { return; } } - + if (thisBlockobj.name === "rest2") { this._deletePitchBlocks(thisBlock); } else { @@ -2096,8 +2096,9 @@ class Blocks { } } - this.addDefaultBlock(parentblk, thisBlock, actionCheck); - + if (this.blockList[parentblk].name !== "pitch") { + this.addDefaultBlock(parentblk, thisBlock, actionCheck); + } /** * Put block adjustments inside a slight delay to make the * addition/substraction of vspace and changes of block shape @@ -2169,7 +2170,7 @@ class Blocks { if (type1 === "vspacein" && type2 === "vspaceout") { return true; } - + if (type1 === "in" && type2 === "out") { return true; } @@ -3310,7 +3311,7 @@ class Blocks { postProcessArg = [thisBlock, DEFAULTCHORD]; } else if (name === "accidentalname") { - postProcess = (args) =>{ + postProcess = (args) => { const b = args[0]; const v = args[1]; that.blockList[b].value = v; @@ -6450,7 +6451,7 @@ class Blocks { if (this.protoBlockDict[blockObjs[c][1][0]] !== undefined) { if ( this.protoBlockDict[blockObjs[c][1][0]].dockTypes[ - cc + cc ] !== "out" ) { flowBlock = false; @@ -7052,7 +7053,7 @@ class Blocks { this.setSelectedBlocks = (blocks) => { this.selectedBlocks = blocks; }; - + /** * Checks if coordinates intersect with any block * @public @@ -7060,10 +7061,10 @@ class Blocks { * @param {number} y - The y coordinate to check * @returns {boolean} True if coordinates intersect with a block */ - this.isCoordinateOnBlock = function(x, y) { + this.isCoordinateOnBlock = function (x, y) { return this.blockList.some(block => { if (block.trash) return false; - + const blockX = block.container.x; const blockY = block.container.y; return x >= blockX &&