Commit cd36f2ca authored by Neil Fraser's avatar Neil Fraser

Merge pull request #214 from trodi/type-data

adding additional type annotations
parents 383ca825 482c62df
......@@ -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;
......
......@@ -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',
......
......@@ -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_);
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment