From a59dc3fad63f92568a04944f74867ccd68773e2f Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Mon, 12 Aug 2024 11:49:25 +0800 Subject: [PATCH 1/8] fix: blockly drag and zoom --- packages/bot-skeleton/src/scratch/hooks/gesture.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/bot-skeleton/src/scratch/hooks/gesture.js b/packages/bot-skeleton/src/scratch/hooks/gesture.js index 487e45bde6c9..357bc79a78eb 100644 --- a/packages/bot-skeleton/src/scratch/hooks/gesture.js +++ b/packages/bot-skeleton/src/scratch/hooks/gesture.js @@ -27,6 +27,9 @@ Blockly.Gesture.prototype.updateIsDraggingFromFlyout = function () { this.startBlock = null; this.targetBlock = this.flyout.createBlock(this.mostRecentEvent, this.targetBlock); this.targetBlock.select(); + + // retuning true since block is being dragged from flyout + Blockly.Gesture.inProgress = () => false; return true; } return false; From 638746df8a4c79c9a5683fed4db9bc38b4ebc9d3 Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Mon, 12 Aug 2024 11:49:50 +0800 Subject: [PATCH 2/8] fix: blockly drag and zoom --- packages/bot-skeleton/src/scratch/hooks/gesture.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/bot-skeleton/src/scratch/hooks/gesture.js b/packages/bot-skeleton/src/scratch/hooks/gesture.js index 357bc79a78eb..e08bdf587753 100644 --- a/packages/bot-skeleton/src/scratch/hooks/gesture.js +++ b/packages/bot-skeleton/src/scratch/hooks/gesture.js @@ -28,7 +28,7 @@ Blockly.Gesture.prototype.updateIsDraggingFromFlyout = function () { this.targetBlock = this.flyout.createBlock(this.mostRecentEvent, this.targetBlock); this.targetBlock.select(); - // retuning true since block is being dragged from flyout + // retuning true since block has been dragged from flyout Blockly.Gesture.inProgress = () => false; return true; } From 709b3a96e1e86e1bc20be9a5f96b69c810131b9b Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Mon, 12 Aug 2024 11:54:41 +0800 Subject: [PATCH 3/8] fix: blockly drag and zoom --- packages/bot-skeleton/src/scratch/hooks/gesture.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/bot-skeleton/src/scratch/hooks/gesture.js b/packages/bot-skeleton/src/scratch/hooks/gesture.js index e08bdf587753..777c8135ebba 100644 --- a/packages/bot-skeleton/src/scratch/hooks/gesture.js +++ b/packages/bot-skeleton/src/scratch/hooks/gesture.js @@ -28,7 +28,7 @@ Blockly.Gesture.prototype.updateIsDraggingFromFlyout = function () { this.targetBlock = this.flyout.createBlock(this.mostRecentEvent, this.targetBlock); this.targetBlock.select(); - // retuning true since block has been dragged from flyout + // retuning false since block has been dragged from flyout Blockly.Gesture.inProgress = () => false; return true; } From 8c6fb477791b6c4379e958d53bd5c40b9d43bd27 Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Mon, 12 Aug 2024 15:32:56 +0800 Subject: [PATCH 4/8] fix: for flyout gesture --- packages/bot-skeleton/src/scratch/dbot.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/bot-skeleton/src/scratch/dbot.js b/packages/bot-skeleton/src/scratch/dbot.js index d0cde99066b3..0cf844fc6470 100644 --- a/packages/bot-skeleton/src/scratch/dbot.js +++ b/packages/bot-skeleton/src/scratch/dbot.js @@ -133,7 +133,10 @@ class DBot { this.workspace.addChangeListener(event => updateDisabledBlocks(this.workspace, event)); this.workspace.addChangeListener(event => this.workspace.dispatchBlockEventEffects(event)); this.workspace.addChangeListener(event => { - if (event.type === 'drag' && !event.isStart && !is_mobile) validateErrorOnBlockDelete(); + if (event.type === 'drag' && !event.isStart && !is_mobile) { + this.workspace.cancelCurrentGesture(); + validateErrorOnBlockDelete(); + } if (event.type == Blockly.Events.BLOCK_CHANGE) { const block = this.workspace.getBlockById(event.blockId); if (is_mobile && block && event.element == 'collapsed') { From 24447263eba31c3c7e3ce8dfdd4721775f7c051f Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Mon, 12 Aug 2024 15:35:16 +0800 Subject: [PATCH 5/8] fix: for flyout gesture --- packages/bot-skeleton/src/scratch/hooks/gesture.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/bot-skeleton/src/scratch/hooks/gesture.js b/packages/bot-skeleton/src/scratch/hooks/gesture.js index 777c8135ebba..487e45bde6c9 100644 --- a/packages/bot-skeleton/src/scratch/hooks/gesture.js +++ b/packages/bot-skeleton/src/scratch/hooks/gesture.js @@ -27,9 +27,6 @@ Blockly.Gesture.prototype.updateIsDraggingFromFlyout = function () { this.startBlock = null; this.targetBlock = this.flyout.createBlock(this.mostRecentEvent, this.targetBlock); this.targetBlock.select(); - - // retuning false since block has been dragged from flyout - Blockly.Gesture.inProgress = () => false; return true; } return false; From 86fd2b24469e8610e7c619019bcc0e777e34bdc9 Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Tue, 13 Aug 2024 12:13:32 +0800 Subject: [PATCH 6/8] fix: removing gesture --- packages/bot-skeleton/src/scratch/hooks/gesture.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/bot-skeleton/src/scratch/hooks/gesture.js b/packages/bot-skeleton/src/scratch/hooks/gesture.js index 487e45bde6c9..cef3f7e99f4a 100644 --- a/packages/bot-skeleton/src/scratch/hooks/gesture.js +++ b/packages/bot-skeleton/src/scratch/hooks/gesture.js @@ -27,6 +27,7 @@ Blockly.Gesture.prototype.updateIsDraggingFromFlyout = function () { this.startBlock = null; this.targetBlock = this.flyout.createBlock(this.mostRecentEvent, this.targetBlock); this.targetBlock.select(); + this.startBlock.workspace.clearGesture(); return true; } return false; From a72cf679e195d286f3e720b6550a986f063e270f Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Tue, 13 Aug 2024 12:14:54 +0800 Subject: [PATCH 7/8] fix: removing gesture --- packages/bot-skeleton/src/scratch/dbot.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/bot-skeleton/src/scratch/dbot.js b/packages/bot-skeleton/src/scratch/dbot.js index 0cf844fc6470..d0cde99066b3 100644 --- a/packages/bot-skeleton/src/scratch/dbot.js +++ b/packages/bot-skeleton/src/scratch/dbot.js @@ -133,10 +133,7 @@ class DBot { this.workspace.addChangeListener(event => updateDisabledBlocks(this.workspace, event)); this.workspace.addChangeListener(event => this.workspace.dispatchBlockEventEffects(event)); this.workspace.addChangeListener(event => { - if (event.type === 'drag' && !event.isStart && !is_mobile) { - this.workspace.cancelCurrentGesture(); - validateErrorOnBlockDelete(); - } + if (event.type === 'drag' && !event.isStart && !is_mobile) validateErrorOnBlockDelete(); if (event.type == Blockly.Events.BLOCK_CHANGE) { const block = this.workspace.getBlockById(event.blockId); if (is_mobile && block && event.element == 'collapsed') { From 5d13edb628d84b2b247448bc6773b89c870e2957 Mon Sep 17 00:00:00 2001 From: rupato-deriv Date: Tue, 13 Aug 2024 12:16:36 +0800 Subject: [PATCH 8/8] fix: removing gesture --- packages/bot-skeleton/src/scratch/hooks/gesture.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/bot-skeleton/src/scratch/hooks/gesture.js b/packages/bot-skeleton/src/scratch/hooks/gesture.js index cef3f7e99f4a..aa3a74e86f65 100644 --- a/packages/bot-skeleton/src/scratch/hooks/gesture.js +++ b/packages/bot-skeleton/src/scratch/hooks/gesture.js @@ -24,10 +24,10 @@ Blockly.Gesture.prototype.updateIsDraggingFromFlyout = function () { } // The start block is no longer relevant, because this is a drag. + this.startBlock.workspace.clearGesture(); this.startBlock = null; this.targetBlock = this.flyout.createBlock(this.mostRecentEvent, this.targetBlock); this.targetBlock.select(); - this.startBlock.workspace.clearGesture(); return true; } return false;