From acfe5f24fe74bf199e22dde17b07b939eac0ee79 Mon Sep 17 00:00:00 2001 From: divyansh Date: Sat, 6 Apr 2024 23:16:41 +0530 Subject: [PATCH 1/4] Resolves #3849 --- js/block.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/block.js b/js/block.js index 49a417ca8..4dea79dc3 100644 --- a/js/block.js +++ b/js/block.js @@ -2819,7 +2819,7 @@ class Block { let topBlk; const dx = event.stageX / that.activity.getStageScale() - that.container.x; - if (!moved && that.isCollapsible() && dx < 30 / that.activity.getStageScale()) { + if (that.isCollapsible() && dx < 30 / that.activity.getStageScale()) { that.collapseToggle(); } else if ((!window.hasMouse && getInput) || (window.hasMouse && !moved)) { if (that.name === "media") { From 5297fd36b8bbe238ea973d0a006a649ea60dfc7b Mon Sep 17 00:00:00 2001 From: divyansh Date: Wed, 10 Apr 2024 01:43:32 +0530 Subject: [PATCH 2/4] Updated fix --- js/block.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/block.js b/js/block.js index 4dea79dc3..0e63692f0 100644 --- a/js/block.js +++ b/js/block.js @@ -2819,7 +2819,7 @@ class Block { let topBlk; const dx = event.stageX / that.activity.getStageScale() - that.container.x; - if (that.isCollapsible() && dx < 30 / that.activity.getStageScale()) { + if (!moved && that.isCollapsible() && dx < 30 / that.activity.getStageScale()) { that.collapseToggle(); } else if ((!window.hasMouse && getInput) || (window.hasMouse && !moved)) { if (that.name === "media") { @@ -2974,6 +2974,10 @@ class Block { if (that.activity.blocksContainer.y === 0 && finalPos < 45) { dy += 45 - finalPos; } + //detect if movement was extremely small. + if(dx<10 && dy<10){ + moved = false; + } // scroll when reached edges. if (event.stageX < 10 && that.activity.scrollBlockContainer) From a9de23f7c056b535e3429a6c82b471febc8c79f2 Mon Sep 17 00:00:00 2001 From: divyansh Date: Wed, 10 Apr 2024 02:22:28 +0530 Subject: [PATCH 3/4] Updated fixv2 --- js/block.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/js/block.js b/js/block.js index 0e63692f0..ba22326fc 100644 --- a/js/block.js +++ b/js/block.js @@ -2819,7 +2819,7 @@ class Block { let topBlk; const dx = event.stageX / that.activity.getStageScale() - that.container.x; - if (!moved && that.isCollapsible() && dx < 30 / that.activity.getStageScale()) { + if (that.isCollapsible() && dx < 30 / that.activity.getStageScale()) { that.collapseToggle(); } else if ((!window.hasMouse && getInput) || (window.hasMouse && !moved)) { if (that.name === "media") { @@ -2974,11 +2974,7 @@ class Block { if (that.activity.blocksContainer.y === 0 && finalPos < 45) { dy += 45 - finalPos; } - //detect if movement was extremely small. - if(dx<10 && dy<10){ - moved = false; - } - + // scroll when reached edges. if (event.stageX < 10 && that.activity.scrollBlockContainer) that.blocks.moveAllBlocksExcept(that, 10, 0); From 3552627f884821f35d778713867509039c9d7925 Mon Sep 17 00:00:00 2001 From: divyansh Date: Sat, 13 Apr 2024 15:33:55 +0530 Subject: [PATCH 4/4] Updated fixv3 --- js/block.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/js/block.js b/js/block.js index ba22326fc..2b2bd5580 100644 --- a/js/block.js +++ b/js/block.js @@ -2819,7 +2819,7 @@ class Block { let topBlk; const dx = event.stageX / that.activity.getStageScale() - that.container.x; - if (that.isCollapsible() && dx < 30 / that.activity.getStageScale()) { + if (!moved && that.isCollapsible() && dx < 30 / that.activity.getStageScale()) { that.collapseToggle(); } else if ((!window.hasMouse && getInput) || (window.hasMouse && !moved)) { if (that.name === "media") { @@ -2913,13 +2913,17 @@ class Block { y: Math.round(that.container.y - that.original.y) }; }); - + /** * Handles the pressmove event on the block container. * @param {Event} event - The pressmove event. */ this.container.on("pressmove", (event) =>{ // FIXME: More voodoo + + let disX = Math.abs(event.stageX / that.activity.getStageScale() - that.original.x); + let disY = Math.abs(event.stageY / that.activity.getStageScale() - that.original.y); + event.nativeEvent.preventDefault(); // Don't allow silence block to be dragged out of a note. @@ -2946,7 +2950,9 @@ class Block { } if (window.hasMouse) { - moved = true; + //check for shaky movements + if(disX > 2 || disY > 2) { + moved = true;} } else { // Make it eaiser to select text on mobile. setTimeout(() => {