From 0272401dcb420140808f5b37e3c1e8ae3ed6d455 Mon Sep 17 00:00:00 2001 From: alschmiedt Date: Thu, 11 Jun 2020 10:21:55 -0700 Subject: [PATCH] Emit workspace click event (#3956) --- core/gesture.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core/gesture.js b/core/gesture.js index bf9a68d15..e4aea332c 100644 --- a/core/gesture.js +++ b/core/gesture.js @@ -651,11 +651,25 @@ Blockly.Gesture.prototype.handleWsStart = function(e, ws) { this.setStartWorkspace_(ws); this.mostRecentEvent_ = e; this.doStart(e); + if (!this.startBlock_ && !this.startBubble_) { + this.fireWorkspaceClick_(ws); + } if (this.startWorkspace_.keyboardAccessibilityMode) { Blockly.navigation.setState(Blockly.navigation.STATE_WS); } }; +/** + * Fires a workspace click event. + * @param {!Blockly.WorkspaceSvg} ws The workspace that a user clicks on. + * @private + */ +Blockly.Gesture.prototype.fireWorkspaceClick_ = function(ws) { + var clickEvent = new Blockly.Events.Ui(null, "workspaceClick", null, null); + clickEvent.workspaceId = ws.id; + Blockly.Events.fire(clickEvent); +}; + /** * Handle a mousedown/touchstart event on a flyout. * @param {!Event} e A mouse down or touch start event.