From 482c62dfa26a6121c2d6d592e026e6f5aed20419 Mon Sep 17 00:00:00 2001 From: Troy McKinnon Date: Tue, 1 Dec 2015 14:04:54 -0600 Subject: [PATCH] adding additional type annotations --- core/block_svg.js | 4 ++++ core/field_image.js | 9 +++++++-- core/workspace_svg.js | 4 ++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/core/block_svg.js b/core/block_svg.js index 30d4fdfa..0ffdf93c 100644 --- a/core/block_svg.js +++ b/core/block_svg.js @@ -41,12 +41,16 @@ goog.require('goog.math.Coordinate'); */ Blockly.BlockSvg = function() { // Create core elements for the block. + /** @type {SVGElement} */ this.svgGroup_ = Blockly.createSvgElement('g', {}, null); + /** @type {SVGElement} */ this.svgPathDark_ = Blockly.createSvgElement('path', {'class': 'blocklyPathDark', 'transform': 'translate(1,1)'}, this.svgGroup_); + /** @type {SVGElement} */ this.svgPath_ = Blockly.createSvgElement('path', {'class': 'blocklyPath'}, this.svgGroup_); + /** @type {SVGElement} */ this.svgPathLight_ = Blockly.createSvgElement('path', {'class': 'blocklyPathLight'}, this.svgGroup_); this.svgPath_.tooltip = this; diff --git a/core/field_image.js b/core/field_image.js index 252d5fe5..b24e75c5 100644 --- a/core/field_image.js +++ b/core/field_image.js @@ -76,17 +76,22 @@ Blockly.FieldImage.prototype.init = function(block) { } this.sourceBlock_ = block; // Build the DOM. + /** @type {SVGElement} */ this.fieldGroup_ = Blockly.createSvgElement('g', {}, null); if (!this.visible_) { this.fieldGroup_.style.display = 'none'; } + /** @type {SVGElement} */ this.imageElement_ = Blockly.createSvgElement('image', {'height': this.height_ + 'px', 'width': this.width_ + 'px'}, this.fieldGroup_); this.setValue(this.src_); if (goog.userAgent.GECKO) { - // Due to a Firefox bug which eats mouse events on image elements, - // a transparent rectangle needs to be placed on top of the image. + /** + * Due to a Firefox bug which eats mouse events on image elements, + * a transparent rectangle needs to be placed on top of the image. + * @type {SVGElement} + */ this.rectElement_ = Blockly.createSvgElement('rect', {'height': this.height_ + 'px', 'width': this.width_ + 'px', diff --git a/core/workspace_svg.js b/core/workspace_svg.js index d9493a2b..6e299249 100644 --- a/core/workspace_svg.js +++ b/core/workspace_svg.js @@ -158,10 +158,12 @@ Blockly.WorkspaceSvg.prototype.createDom = function(opt_backgroundClass) { [Scrollbars may go here] + @type {SVGElement} */ this.svgGroup_ = Blockly.createSvgElement('g', {'class': 'blocklyWorkspace'}, null); if (opt_backgroundClass) { + /** @type {SVGElement} */ this.svgBackground_ = Blockly.createSvgElement('rect', {'height': '100%', 'width': '100%', 'class': opt_backgroundClass}, this.svgGroup_); @@ -170,8 +172,10 @@ Blockly.WorkspaceSvg.prototype.createDom = function(opt_backgroundClass) { 'url(#' + this.options.gridPattern.id + ')'; } } + /** @type {SVGElement} */ this.svgBlockCanvas_ = Blockly.createSvgElement('g', {'class': 'blocklyBlockCanvas'}, this.svgGroup_, this); + /** @type {SVGElement} */ this.svgBubbleCanvas_ = Blockly.createSvgElement('g', {'class': 'blocklyBubbleCanvas'}, this.svgGroup_, this); var bottom = Blockly.Scrollbar.scrollbarThickness;