diff --git a/core/block_dragger.js b/core/block_dragger.js index d8238cb0a..051b2a6d8 100644 --- a/core/block_dragger.js +++ b/core/block_dragger.js @@ -36,7 +36,7 @@ goog.require('goog.asserts'); /** * Class for a block dragger. It moves blocks around the workspace when they * are being dragged by a mouse or touch. - * @param {!Blockly.Block} block The block to drag. + * @param {!Blockly.BlockSvg} block The block to drag. * @param {!Blockly.WorkspaceSvg} workspace The workspace to drag on. * @constructor */ @@ -168,10 +168,11 @@ Blockly.BlockDragger.prototype.startBlockDrag = function(currentDragDeltaXY) { // surface. this.draggingBlock_.moveToDragSurface_(); - if (this.workspace_.toolbox_) { + var toolbox = this.workspace_.getToolbox(); + if (toolbox) { var style = this.draggingBlock_.isDeletable() ? 'blocklyToolboxDelete' : 'blocklyToolboxGrab'; - this.workspace_.toolbox_.addStyle(style); + toolbox.addStyle(style); } }; @@ -226,10 +227,11 @@ Blockly.BlockDragger.prototype.endBlockDrag = function(e, currentDragDeltaXY) { } this.workspace_.setResizesEnabled(true); - if (this.workspace_.toolbox_) { + var toolbox = this.workspace_.getToolbox(); + if (toolbox) { var style = this.draggingBlock_.isDeletable() ? 'blocklyToolboxDelete' : 'blocklyToolboxGrab'; - this.workspace_.toolbox_.removeStyle(style); + toolbox.removeStyle(style); } Blockly.Events.setGroup(false); }; diff --git a/core/block_render_svg.js b/core/block_render_svg.js index 2166860b0..355f1dc64 100644 --- a/core/block_render_svg.js +++ b/core/block_render_svg.js @@ -608,8 +608,8 @@ Blockly.BlockSvg.prototype.renderMoveConnections_ = function() { /** * Render the top edge of the block. - * @param {!Array.} steps Path of block outline. - * @param {!Array.} highlightSteps Path of block highlights. + * @param {!Array.} steps Path of block outline. + * @param {!Array.} highlightSteps Path of block highlights. * @param {number} rightEdge Minimum width of block. * @private */ @@ -653,10 +653,10 @@ Blockly.BlockSvg.prototype.renderDrawTop_ = function(steps, /** * Render the right edge of the block. - * @param {!Array.} steps Path of block outline. - * @param {!Array.} highlightSteps Path of block highlights. - * @param {!Array.} inlineSteps Inline block outlines. - * @param {!Array.} highlightInlineSteps Inline block highlights. + * @param {!Array.} steps Path of block outline. + * @param {!Array.} highlightSteps Path of block highlights. + * @param {!Array.} inlineSteps Inline block outlines. + * @param {!Array.} highlightInlineSteps Inline block highlights. * @param {!Array.>} inputRows 2D array of objects, each * containing position information. * @param {number} iconWidth Offset of first row due to icons. @@ -909,8 +909,8 @@ Blockly.BlockSvg.prototype.renderDrawRight_ = function(steps, highlightSteps, /** * Render the bottom edge of the block. - * @param {!Array.} steps Path of block outline. - * @param {!Array.} highlightSteps Path of block highlights. + * @param {!Array.} steps Path of block outline. + * @param {!Array.} highlightSteps Path of block highlights. * @param {number} cursorY Height of block. * @private */ @@ -955,8 +955,8 @@ Blockly.BlockSvg.prototype.renderDrawBottom_ = function(steps, /** * Render the left edge of the block. - * @param {!Array.} steps Path of block outline. - * @param {!Array.} highlightSteps Path of block highlights. + * @param {!Array.} steps Path of block outline. + * @param {!Array.} highlightSteps Path of block highlights. * @private */ Blockly.BlockSvg.prototype.renderDrawLeft_ = function(steps, highlightSteps) { diff --git a/core/icon.js b/core/icon.js index 88b7fb689..b51d90efd 100644 --- a/core/icon.js +++ b/core/icon.js @@ -52,14 +52,14 @@ Blockly.Icon.prototype.SIZE = 17; /** * Bubble UI (if visible). * @type {Blockly.Bubble} - * @private + * @protected */ Blockly.Icon.prototype.bubble_ = null; /** * Absolute coordinate of icon's center. * @type {goog.math.Coordinate} - * @private + * @protected */ Blockly.Icon.prototype.iconXY_ = null; @@ -119,7 +119,7 @@ Blockly.Icon.prototype.isVisible = function() { /** * Clicking on the icon toggles if the bubble is visible. * @param {!Event} e Mouse click event. - * @private + * @protected */ Blockly.Icon.prototype.iconClick_ = function(e) { if (this.block_.workspace.isDragging()) { diff --git a/core/utils.js b/core/utils.js index 030079e9b..54b5d8abf 100644 --- a/core/utils.js +++ b/core/utils.js @@ -122,7 +122,7 @@ Blockly.utils.removeClass = function(element, className) { * @param {!Element} element DOM element to check. * @param {string} className Name of class to check. * @return {boolean} True if class exists, false otherwise. - * @private + * @package */ Blockly.utils.hasClass = function(element, className) { var classes = element.getAttribute('class'); diff --git a/core/workspace_svg.js b/core/workspace_svg.js index 901ed4ca2..4a3adb510 100644 --- a/core/workspace_svg.js +++ b/core/workspace_svg.js @@ -581,6 +581,15 @@ Blockly.WorkspaceSvg.prototype.getFlyout_ = function() { return null; }; +/** + * Getter for the toolbox associated with this workspace, if one exists. + * @return {Blockly.Toolbox} The toolbox on this workspace. + * @package + */ +Blockly.WorkspaceSvg.prototype.getToolbox = function() { + return this.toolbox_; +}; + /** * Update items that use screen coordinate calculations * because something has changed (e.g. scroll position, window size). @@ -755,8 +764,8 @@ Blockly.WorkspaceSvg.prototype.setupDragSurface = function() { // Figure out where we want to put the canvas back. The order // in the is important because things are layered. var previousElement = this.svgBlockCanvas_.previousSibling; - var width = this.getParentSvg().getAttribute('width'); - var height = this.getParentSvg().getAttribute('height'); + var width = parseInt(this.getParentSvg().getAttribute('width'), 10); + var height = parseInt(this.getParentSvg().getAttribute('height'), 10); var coord = Blockly.utils.getRelativeXY(this.svgBlockCanvas_); this.workspaceDragSurface_.setContentsAndShow(this.svgBlockCanvas_, this.svgBubbleCanvas_, previousElement, width, height, this.scale);