From 50842fa85e60be8f34d4333c3124ffdcc1c2ddeb Mon Sep 17 00:00:00 2001 From: alschmiedt Date: Fri, 21 May 2021 15:48:57 -0700 Subject: [PATCH] Adds a getter for the draggers on gesture (#4844) --- core/gesture.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/core/gesture.js b/core/gesture.js index 8c22c423b..48e5c46a1 100644 --- a/core/gesture.js +++ b/core/gesture.js @@ -968,6 +968,23 @@ Blockly.Gesture.prototype.getInsertionMarkers = function() { return []; }; +/** + * Gets the current dragger if an item is being dragged. Null if nothing is + * being dragged. + * @return {!Blockly.WorkspaceDragger|!Blockly.BubbleDragger|!Blockly.IBlockDragger|null} + * The dragger that is currently in use or null if no drag is in progress. + */ +Blockly.Gesture.prototype.getCurrentDragger = function() { + if (this.isDraggingBlock_) { + return this.blockDragger_; + } else if (this.isDraggingWorkspace_) { + return this.workspaceDragger_; + } else if (this.isDraggingBubble_) { + return this.bubbleDragger_; + } + return null; +}; + /** * Is a drag or other gesture currently in progress on any workspace? * @return {boolean} True if gesture is occurring.