diff --git a/core/drag_target.js b/core/drag_target.js index 438bf6a31..18e29b40a 100644 --- a/core/drag_target.js +++ b/core/drag_target.js @@ -12,65 +12,68 @@ 'use strict'; -goog.provide('Blockly.DragTarget'); +goog.module('Blockly.DragTarget'); +goog.module.declareLegacyNamespace(); -goog.require('Blockly.IDragTarget'); - -goog.requireType('Blockly.IDraggable'); -goog.requireType('Blockly.utils.Rect'); +/* eslint-disable-next-line no-unused-vars */ +const IDragTarget = goog.require('Blockly.IDragTarget'); +/* eslint-disable-next-line no-unused-vars */ +const IDraggable = goog.requireType('Blockly.IDraggable'); +/* eslint-disable-next-line no-unused-vars */ +const Rect = goog.requireType('Blockly.utils.Rect'); /** * Abstract class for a component with custom behaviour when a block or bubble * is dragged over or dropped on top of it. - * @implements {Blockly.IDragTarget} + * @implements {IDragTarget} * @constructor */ -Blockly.DragTarget = function() {}; +const DragTarget = function() {}; /** * Returns the bounding rectangle of the drag target area in pixel units * relative to the Blockly injection div. - * @return {?Blockly.utils.Rect} The component's bounding box. Null if drag + * @return {?Rect} The component's bounding box. Null if drag * target area should be ignored. */ -Blockly.DragTarget.prototype.getClientRect; +DragTarget.prototype.getClientRect; /** * Handles when a cursor with a block or bubble enters this drag target. - * @param {!Blockly.IDraggable} _dragElement The block or bubble currently being + * @param {!IDraggable} _dragElement The block or bubble currently being * dragged. */ -Blockly.DragTarget.prototype.onDragEnter = function(_dragElement) { +DragTarget.prototype.onDragEnter = function(_dragElement) { // no-op }; /** * Handles when a cursor with a block or bubble is dragged over this drag * target. - * @param {!Blockly.IDraggable} _dragElement The block or bubble currently being + * @param {!IDraggable} _dragElement The block or bubble currently being * dragged. */ -Blockly.DragTarget.prototype.onDragOver = function(_dragElement) { +DragTarget.prototype.onDragOver = function(_dragElement) { // no-op }; /** * Handles when a cursor with a block or bubble exits this drag target. - * @param {!Blockly.IDraggable} _dragElement The block or bubble currently being + * @param {!IDraggable} _dragElement The block or bubble currently being * dragged. */ -Blockly.DragTarget.prototype.onDragExit = function(_dragElement) { +DragTarget.prototype.onDragExit = function(_dragElement) { // no-op }; /** * Handles when a block or bubble is dropped on this component. * Should not handle delete here. - * @param {!Blockly.IDraggable} _dragElement The block or bubble currently being + * @param {!IDraggable} _dragElement The block or bubble currently being * dragged. */ -Blockly.DragTarget.prototype.onDrop = function(_dragElement) { +DragTarget.prototype.onDrop = function(_dragElement) { // no-op }; @@ -78,11 +81,13 @@ Blockly.DragTarget.prototype.onDrop = function(_dragElement) { * Returns whether the provided block or bubble should not be moved after being * dropped on this component. If true, the element will return to where it was * when the drag started. - * @param {!Blockly.IDraggable} _dragElement The block or bubble currently being + * @param {!IDraggable} _dragElement The block or bubble currently being * dragged. * @return {boolean} Whether the block or bubble provided should be returned to * drag start. */ -Blockly.DragTarget.prototype.shouldPreventMove = function(_dragElement) { +DragTarget.prototype.shouldPreventMove = function(_dragElement) { return false; }; + +exports = DragTarget; diff --git a/tests/deps.js b/tests/deps.js index fb0b9793c..b111355f8 100644 --- a/tests/deps.js +++ b/tests/deps.js @@ -29,7 +29,7 @@ goog.addDependency('../../core/contextmenu_items.js', ['Blockly.ContextMenuItems goog.addDependency('../../core/contextmenu_registry.js', ['Blockly.ContextMenuRegistry'], [], {'lang': 'es5'}); goog.addDependency('../../core/css.js', ['Blockly.Css'], [], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/delete_area.js', ['Blockly.DeleteArea'], ['Blockly.BlockSvg', 'Blockly.DragTarget', 'Blockly.IDeleteArea']); -goog.addDependency('../../core/drag_target.js', ['Blockly.DragTarget'], ['Blockly.IDragTarget']); +goog.addDependency('../../core/drag_target.js', ['Blockly.DragTarget'], ['Blockly.IDragTarget'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/dropdowndiv.js', ['Blockly.DropDownDiv'], ['Blockly.utils.Rect', 'Blockly.utils.dom', 'Blockly.utils.math', 'Blockly.utils.style']); goog.addDependency('../../core/events/block_events.js', ['Blockly.Events.BlockBase', 'Blockly.Events.BlockChange', 'Blockly.Events.BlockCreate', 'Blockly.Events.BlockDelete', 'Blockly.Events.BlockMove', 'Blockly.Events.Change', 'Blockly.Events.Create', 'Blockly.Events.Delete', 'Blockly.Events.Move'], ['Blockly.Events', 'Blockly.Events.Abstract', 'Blockly.Xml', 'Blockly.connectionTypes', 'Blockly.registry', 'Blockly.utils.Coordinate', 'Blockly.utils.object', 'Blockly.utils.xml']); goog.addDependency('../../core/events/events.js', ['Blockly.Events'], ['Blockly.registry', 'Blockly.utils']);