Fix more compiler warnings

This commit is contained in:
Rachel Fenichel
2018-03-14 17:37:32 -07:00
parent 90a3730424
commit d4c3835a5e
3 changed files with 21 additions and 10 deletions

View File

@@ -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);
};

View File

@@ -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()) {

View File

@@ -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);