From 75a98e6204042079fc32a2d8e64267677fb9940d Mon Sep 17 00:00:00 2001 From: kozbial Date: Thu, 29 Jul 2021 15:56:08 -0700 Subject: [PATCH] Migrate core/workspace_dragger.js named requires --- core/workspace_dragger.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/core/workspace_dragger.js b/core/workspace_dragger.js index 90aade9f3..f936a3eb5 100644 --- a/core/workspace_dragger.js +++ b/core/workspace_dragger.js @@ -13,9 +13,11 @@ goog.module('Blockly.WorkspaceDragger'); goog.module.declareLegacyNamespace(); -goog.require('Blockly.utils.Coordinate'); - -goog.requireType('Blockly.WorkspaceSvg'); +// TODO(#5073): Add Blockly require after fixing circular dependency. +// goog.require('Blockly'); +const Coordinate = goog.require('Blockly.utils.Coordinate'); +/* eslint-disable-next-line no-unused-vars */ +const WorkspaceSvg = goog.requireType('Blockly.WorkspaceSvg'); /** @@ -24,12 +26,12 @@ goog.requireType('Blockly.WorkspaceSvg'); * Note that the workspace itself manages whether or not it has a drag surface * and how to do translations based on that. This simply passes the right * commands based on events. - * @param {!Blockly.WorkspaceSvg} workspace The workspace to drag. + * @param {!WorkspaceSvg} workspace The workspace to drag. * @constructor */ const WorkspaceDragger = function(workspace) { /** - * @type {!Blockly.WorkspaceSvg} + * @type {!WorkspaceSvg} * @private */ this.workspace_ = workspace; @@ -51,10 +53,10 @@ const WorkspaceDragger = function(workspace) { /** * The scroll position of the workspace at the beginning of the drag. * Coordinate system: pixel coordinates. - * @type {!Blockly.utils.Coordinate} + * @type {!Coordinate} * @protected */ - this.startScrollXY_ = new Blockly.utils.Coordinate( + this.startScrollXY_ = new Coordinate( workspace.scrollX, workspace.scrollY); }; @@ -80,7 +82,7 @@ WorkspaceDragger.prototype.startDrag = function() { /** * Finish dragging the workspace and put everything back where it belongs. - * @param {!Blockly.utils.Coordinate} currentDragDeltaXY How far the pointer has + * @param {!Coordinate} currentDragDeltaXY How far the pointer has * moved from the position at the start of the drag, in pixel coordinates. * @package */ @@ -92,12 +94,12 @@ WorkspaceDragger.prototype.endDrag = function(currentDragDeltaXY) { /** * Move the workspace based on the most recent mouse movements. - * @param {!Blockly.utils.Coordinate} currentDragDeltaXY How far the pointer has + * @param {!Coordinate} currentDragDeltaXY How far the pointer has * moved from the position at the start of the drag, in pixel coordinates. * @package */ WorkspaceDragger.prototype.drag = function(currentDragDeltaXY) { - const newXY = Blockly.utils.Coordinate.sum(this.startScrollXY_, currentDragDeltaXY); + const newXY = Coordinate.sum(this.startScrollXY_, currentDragDeltaXY); if (this.horizontalScrollEnabled_ && this.verticalScrollEnabled_) { this.workspace_.scroll(newXY.x, newXY.y);