Skip to content

Commit

Permalink
adding additional type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
trodi committed Dec 1, 2015
1 parent e5dfdf4 commit 482c62d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions core/block_svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 7 additions & 2 deletions core/field_image.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
4 changes: 4 additions & 0 deletions core/workspace_svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,12 @@ Blockly.WorkspaceSvg.prototype.createDom = function(opt_backgroundClass) {
<g class="blocklyBubbleCanvas"></g>
[Scrollbars may go here]
</g>
@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_);
Expand All @@ -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;
Expand Down

0 comments on commit 482c62d

Please sign in to comment.