diff --git a/core/blockly.js b/core/blockly.js index d1b987180..0123d7626 100644 --- a/core/blockly.js +++ b/core/blockly.js @@ -17,7 +17,7 @@ goog.provide('Blockly'); goog.require('Blockly.constants'); -goog.require('Blockly.eventHandling'); +goog.require('Blockly.browserEvents'); goog.require('Blockly.Events'); goog.require('Blockly.Events.Ui'); goog.require('Blockly.Events.UiBase'); @@ -485,6 +485,6 @@ Blockly.setParentContainer = function(container) { }; /** Aliases. */ -Blockly.bindEvent_ = Blockly.eventHandling.bind; -Blockly.unbindEvent_ = Blockly.eventHandling.unbind; -Blockly.bindEventWithChecks_ = Blockly.eventHandling.checkAndBind; +Blockly.bindEvent_ = Blockly.browserEvents.bind; +Blockly.unbindEvent_ = Blockly.browserEvents.unbind; +Blockly.bindEventWithChecks_ = Blockly.browserEvents.checkAndBind; diff --git a/core/bubble.js b/core/bubble.js index fd696014c..5ee397c5b 100644 --- a/core/bubble.js +++ b/core/bubble.js @@ -12,7 +12,7 @@ goog.provide('Blockly.Bubble'); -goog.require('Blockly.eventHandling'); +goog.require('Blockly.browserEvents'); goog.require('Blockly.Scrollbar'); goog.require('Blockly.Touch'); goog.require('Blockly.utils'); @@ -67,14 +67,14 @@ Blockly.Bubble = function( /** * Mouse down on bubbleBack_ event data. - * @type {?Blockly.eventHandling.Data} + * @type {?Blockly.browserEvents.Data} * @private */ this.onMouseDownBubbleWrapper_ = null; /** * Mouse down on resizeGroup_ event data. - * @type {?Blockly.eventHandling.Data} + * @type {?Blockly.browserEvents.Data} * @private */ this.onMouseDownResizeWrapper_ = null; @@ -138,14 +138,14 @@ Blockly.Bubble.ANCHOR_RADIUS = 8; /** * Mouse up event data. - * @type {?Blockly.eventHandling.Data} + * @type {?Blockly.browserEvents.Data} * @private */ Blockly.Bubble.onMouseUpWrapper_ = null; /** * Mouse move event data. - * @type {?Blockly.eventHandling.Data} + * @type {?Blockly.browserEvents.Data} * @private */ Blockly.Bubble.onMouseMoveWrapper_ = null; @@ -156,11 +156,11 @@ Blockly.Bubble.onMouseMoveWrapper_ = null; */ Blockly.Bubble.unbindDragEvents_ = function() { if (Blockly.Bubble.onMouseUpWrapper_) { - Blockly.eventHandling.unbind(Blockly.Bubble.onMouseUpWrapper_); + Blockly.browserEvents.unbind(Blockly.Bubble.onMouseUpWrapper_); Blockly.Bubble.onMouseUpWrapper_ = null; } if (Blockly.Bubble.onMouseMoveWrapper_) { - Blockly.eventHandling.unbind(Blockly.Bubble.onMouseMoveWrapper_); + Blockly.browserEvents.unbind(Blockly.Bubble.onMouseMoveWrapper_); Blockly.Bubble.onMouseMoveWrapper_ = null; } }; @@ -300,10 +300,10 @@ Blockly.Bubble.prototype.createDom_ = function(content, hasResize) { } if (!this.workspace_.options.readOnly) { - this.onMouseDownBubbleWrapper_ = Blockly.eventHandling.checkAndBind( + this.onMouseDownBubbleWrapper_ = Blockly.browserEvents.checkAndBind( this.bubbleBack_, 'mousedown', this, this.bubbleMouseDown_); if (this.resizeGroup_) { - this.onMouseDownResizeWrapper_ = Blockly.eventHandling.checkAndBind( + this.onMouseDownResizeWrapper_ = Blockly.browserEvents.checkAndBind( this.resizeGroup_, 'mousedown', this, this.resizeMouseDown_); } } @@ -388,9 +388,9 @@ Blockly.Bubble.prototype.resizeMouseDown_ = function(e) { new Blockly.utils.Coordinate( this.workspace_.RTL ? -this.width_ : this.width_, this.height_)); - Blockly.Bubble.onMouseUpWrapper_ = Blockly.eventHandling.checkAndBind( + Blockly.Bubble.onMouseUpWrapper_ = Blockly.browserEvents.checkAndBind( document, 'mouseup', this, Blockly.Bubble.bubbleMouseUp_); - Blockly.Bubble.onMouseMoveWrapper_ = Blockly.eventHandling.checkAndBind( + Blockly.Bubble.onMouseMoveWrapper_ = Blockly.browserEvents.checkAndBind( document, 'mousemove', this, this.resizeMouseMove_); Blockly.hideChaff(); // This event has been handled. No need to bubble up to the document. @@ -822,10 +822,10 @@ Blockly.Bubble.prototype.setColour = function(hexColour) { */ Blockly.Bubble.prototype.dispose = function() { if (this.onMouseDownBubbleWrapper_) { - Blockly.eventHandling.unbind(this.onMouseDownBubbleWrapper_); + Blockly.browserEvents.unbind(this.onMouseDownBubbleWrapper_); } if (this.onMouseDownResizeWrapper_) { - Blockly.eventHandling.unbind(this.onMouseDownResizeWrapper_); + Blockly.browserEvents.unbind(this.onMouseDownResizeWrapper_); } Blockly.Bubble.unbindDragEvents_(); Blockly.utils.dom.removeNode(this.bubbleGroup_); diff --git a/core/comment.js b/core/comment.js index 0310869b7..2b261ed38 100644 --- a/core/comment.js +++ b/core/comment.js @@ -61,28 +61,28 @@ Blockly.Comment = function(block) { /** * Mouse up event data. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.onMouseUpWrapper_ = null; /** * Wheel event data. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.onWheelWrapper_ = null; /** * Change event data. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.onChangeWrapper_ = null; /** * Input event data. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.onInputWrapper_ = null; diff --git a/core/event_handling.js b/core/event_handling.js index fa9183bce..9d98b54c4 100644 --- a/core/event_handling.js +++ b/core/event_handling.js @@ -10,18 +10,18 @@ */ 'use strict'; -goog.provide('Blockly.eventHandling'); +goog.provide('Blockly.browserEvents'); goog.require('Blockly.Touch'); /** * Blockly opaque event data used to unbind events when using - * `Blockly.eventHandling.bindEvent_` and - * `Blockly.eventHandling.bindEventWithChecks_`. + * `Blockly.browserEvents.bindEvent_` and + * `Blockly.browserEvents.bindEventWithChecks_`. * @typedef {!Array.} */ -Blockly.eventHandling.Data; +Blockly.browserEvents.Data; /** * Bind an event to a function call. When calling the function, verifies that @@ -38,11 +38,11 @@ Blockly.eventHandling.Data; * should prevent the default handler. False by default. If * opt_noPreventDefault is provided, opt_noCaptureIdentifier must also be * provided. - * @return {!Blockly.eventHandling.Data} Opaque data that can be passed to + * @return {!Blockly.browserEvents.Data} Opaque data that can be passed to * unbindEvent_. * @public */ -Blockly.eventHandling.checkAndBind = function( +Blockly.browserEvents.checkAndBind = function( node, name, thisObject, func, opt_noCaptureIdentifier, opt_noPreventDefault) { var handled = false; @@ -106,11 +106,11 @@ Blockly.eventHandling.checkAndBind = function( * @param {string} name Event name to listen to (e.g. 'mousedown'). * @param {Object} thisObject The value of 'this' in the function. * @param {!Function} func Function to call when event is triggered. - * @return {!Blockly.eventHandling.Data} Opaque data that can be passed to + * @return {!Blockly.browserEvents.Data} Opaque data that can be passed to * unbindEvent_. * @public */ -Blockly.eventHandling.bind = function(node, name, thisObject, func) { +Blockly.browserEvents.bind = function(node, name, thisObject, func) { var wrapFunc = function(e) { if (thisObject) { func.call(thisObject, e); @@ -156,12 +156,12 @@ Blockly.eventHandling.bind = function(node, name, thisObject, func) { /** * Unbind one or more events event from a function call. - * @param {!Blockly.eventHandling.Data} bindData Opaque data from bindEvent_. + * @param {!Blockly.browserEvents.Data} bindData Opaque data from bindEvent_. * This list is emptied during the course of calling this function. * @return {!Function} The function call. * @public */ -Blockly.eventHandling.unbind = function(bindData) { +Blockly.browserEvents.unbind = function(bindData) { while (bindData.length) { var bindDatum = bindData.pop(); var node = bindDatum[0]; diff --git a/core/field.js b/core/field.js index 8f450ccc8..abb903d22 100644 --- a/core/field.js +++ b/core/field.js @@ -131,7 +131,7 @@ Blockly.Field = function(value, opt_validator, opt_config) { /** * Mouse down event listener data. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.mouseDownWrapper_ = null; diff --git a/core/field_angle.js b/core/field_angle.js index cbafe10c6..a5db25434 100644 --- a/core/field_angle.js +++ b/core/field_angle.js @@ -88,21 +88,21 @@ Blockly.FieldAngle = function(opt_value, opt_validator, opt_config) { /** * Wrapper click event data. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.clickWrapper_ = null; /** * Surface click event data. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.clickSurfaceWrapper_ = null; /** * Surface mouse move event data. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.moveSurfaceWrapper_ = null; diff --git a/core/field_colour.js b/core/field_colour.js index 7ff85e5cd..322516019 100644 --- a/core/field_colour.js +++ b/core/field_colour.js @@ -61,35 +61,35 @@ Blockly.FieldColour = function(opt_value, opt_validator, opt_config) { /** * Mouse click event data. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.onClickWrapper_ = null; /** * Mouse move event data. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.onMouseMoveWrapper_ = null; /** * Mouse enter event data. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.onMouseEnterWrapper_ = null; /** * Mouse leave event data. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.onMouseLeaveWrapper_ = null; /** * Key down event data. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.onKeyDownWrapper_ = null; diff --git a/core/field_textinput.js b/core/field_textinput.js index cd871f3ce..186f27f75 100644 --- a/core/field_textinput.js +++ b/core/field_textinput.js @@ -62,14 +62,14 @@ Blockly.FieldTextInput = function(opt_value, opt_validator, opt_config) { /** * Key down event data. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.onKeyDownWrapper_ = null; /** * Key input event data. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.onKeyInputWrapper_ = null; diff --git a/core/flyout_button.js b/core/flyout_button.js index 00e63b99d..b29341cec 100644 --- a/core/flyout_button.js +++ b/core/flyout_button.js @@ -85,7 +85,7 @@ Blockly.FlyoutButton = function(workspace, targetWorkspace, json, isLabel) { /** * Mouse up event data. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.onMouseUpWrapper_ = null; diff --git a/core/gesture.js b/core/gesture.js index 2819ce5c9..40e8caa68 100644 --- a/core/gesture.js +++ b/core/gesture.js @@ -156,7 +156,7 @@ Blockly.Gesture = function(e, creatorWorkspace) { /** * A handle to use to unbind a mouse move listener at the end of a drag. * Opaque data returned from Blockly.bindEventWithChecks_. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @protected */ this.onMoveWrapper_ = null; @@ -164,7 +164,7 @@ Blockly.Gesture = function(e, creatorWorkspace) { /** * A handle to use to unbind a mouse up listener at the end of a drag. * Opaque data returned from Blockly.bindEventWithChecks_. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @protected */ this.onUpWrapper_ = null; diff --git a/core/menu.js b/core/menu.js index fa644b617..b0470efff 100644 --- a/core/menu.js +++ b/core/menu.js @@ -55,35 +55,35 @@ Blockly.Menu = function() { /** * Mouse over event data. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.mouseOverHandler_ = null; /** * Click event data. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.clickHandler_ = null; /** * Mouse enter event data. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.mouseEnterHandler_ = null; /** * Mouse leave event data. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.mouseLeaveHandler_ = null; /** * Key down event data. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.onKeyDownHandler_ = null; diff --git a/core/toolbox/toolbox.js b/core/toolbox/toolbox.js index 8dca3ce26..b9ec8b80f 100644 --- a/core/toolbox/toolbox.js +++ b/core/toolbox/toolbox.js @@ -148,7 +148,7 @@ Blockly.Toolbox = function(workspace) { * Array holding info needed to unbind event handlers. * Used for disposing. * Ex: [[node, name, func], [node, name, func]]. - * @type {!Array} + * @type {!Array} * @protected */ this.boundEvents_ = []; diff --git a/core/touch_gesture.js b/core/touch_gesture.js index 7924acf69..8f4919ec6 100644 --- a/core/touch_gesture.js +++ b/core/touch_gesture.js @@ -72,7 +72,7 @@ Blockly.TouchGesture = function(e, creatorWorkspace) { * A handle to use to unbind the second touch start or pointer down listener * at the end of a drag. * Opaque data returned from Blockly.bindEventWithChecks_. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.onStartWrapper_ = null; diff --git a/core/workspace_comment_svg.js b/core/workspace_comment_svg.js index 69e82fc50..fdba3ade5 100644 --- a/core/workspace_comment_svg.js +++ b/core/workspace_comment_svg.js @@ -48,14 +48,14 @@ Blockly.WorkspaceCommentSvg = function( workspace, content, height, width, opt_id) { /** * Mouse up event data. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.onMouseUpWrapper_ = null; /** * Mouse move event data. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.onMouseMoveWrapper_ = null; diff --git a/core/workspace_svg.js b/core/workspace_svg.js index 009d07c82..9d65802da 100644 --- a/core/workspace_svg.js +++ b/core/workspace_svg.js @@ -17,7 +17,7 @@ goog.require('Blockly.blockRendering'); goog.require('Blockly.ConnectionDB'); goog.require('Blockly.constants'); goog.require('Blockly.ContextMenuRegistry'); -goog.require('Blockly.eventHandling'); +goog.require('Blockly.browserEvents'); goog.require('Blockly.Events'); goog.require('Blockly.Events.BlockCreate'); goog.require('Blockly.Events.ThemeChange'); @@ -223,7 +223,7 @@ Blockly.utils.object.inherits(Blockly.WorkspaceSvg, Blockly.Workspace); /** * A wrapper function called when a resize event occurs. * You can pass the result to `eventHandling.unbind`. - * @type {?Blockly.eventHandling.Data} + * @type {?Blockly.browserEvents.Data} * @private */ Blockly.WorkspaceSvg.prototype.resizeHandlerWrapper_ = null; @@ -754,7 +754,7 @@ Blockly.WorkspaceSvg.prototype.getBlockCanvas = function() { /** * Save resize handler data so we can delete it later in dispose. - * @param {!Blockly.eventHandling.Data} handler Data that can be passed to + * @param {!Blockly.browserEvents.Data} handler Data that can be passed to * eventHandling.unbind. */ Blockly.WorkspaceSvg.prototype.setResizeHandlerWrapper = function(handler) { @@ -809,9 +809,9 @@ Blockly.WorkspaceSvg.prototype.createDom = function(opt_backgroundClass) { {'class': 'blocklyBubbleCanvas'}, this.svgGroup_); if (!this.isFlyout) { - Blockly.eventHandling.checkAndBind( + Blockly.browserEvents.checkAndBind( this.svgGroup_, 'mousedown', this, this.onMouseDown_, false, true); - Blockly.eventHandling.checkAndBind( + Blockly.browserEvents.checkAndBind( this.svgGroup_, 'wheel', this, this.onMouseWheel_); } @@ -919,7 +919,7 @@ Blockly.WorkspaceSvg.prototype.dispose = function() { } } if (this.resizeHandlerWrapper_) { - Blockly.eventHandling.unbind(this.resizeHandlerWrapper_); + Blockly.browserEvents.unbind(this.resizeHandlerWrapper_); this.resizeHandlerWrapper_ = null; } }; diff --git a/core/zoom_controls.js b/core/zoom_controls.js index 20c94e490..ae26380c9 100644 --- a/core/zoom_controls.js +++ b/core/zoom_controls.js @@ -36,7 +36,7 @@ Blockly.ZoomControls = function(workspace) { /** * A handle to use to unbind the mouse down event handler for zoom reset * button. Opaque data returned from Blockly.bindEventWithChecks_. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.onZoomResetWrapper_ = null; @@ -44,7 +44,7 @@ Blockly.ZoomControls = function(workspace) { /** * A handle to use to unbind the mouse down event handler for zoom in button. * Opaque data returned from Blockly.bindEventWithChecks_. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.onZoomInWrapper_ = null; @@ -52,7 +52,7 @@ Blockly.ZoomControls = function(workspace) { /** * A handle to use to unbind the mouse down event handler for zoom out button. * Opaque data returned from Blockly.bindEventWithChecks_. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.onZoomOutWrapper_ = null; diff --git a/demos/custom-fields/pitch/field_pitch.js b/demos/custom-fields/pitch/field_pitch.js index 5b8ef5e1a..df718c03e 100644 --- a/demos/custom-fields/pitch/field_pitch.js +++ b/demos/custom-fields/pitch/field_pitch.js @@ -31,14 +31,14 @@ CustomFields.FieldPitch = function(text) { /** * Click event data. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.clickWrapper_ = null; /** * Move event data. - * @type {?Blockly.EventData} + * @type {?Blockly.browserEvents.Data} * @private */ this.moveWrapper_ = null;