mirror of
https://github.com/google/blockly.git
synced 2026-01-09 01:50:11 +01:00
Fix some more annotations and an accidental global use of this
This commit is contained in:
@@ -110,7 +110,7 @@ Blockly.Gesture = function(e, creatorWorkspace) {
|
||||
* workspaces on a page; this is more accurate than using
|
||||
* Blockly.getMainWorkspace().
|
||||
* @type {Blockly.WorkspaceSvg}
|
||||
* @private
|
||||
* @protected
|
||||
*/
|
||||
this.startWorkspace_ = null;
|
||||
|
||||
@@ -165,7 +165,7 @@ Blockly.Gesture = function(e, creatorWorkspace) {
|
||||
* A handle to use to unbind a mouse move listener at the end of a drag.
|
||||
* Opaque data returned from Blockly.bindEventWithChecks_.
|
||||
* @type {Array.<!Array>}
|
||||
* @private
|
||||
* @protected
|
||||
*/
|
||||
this.onMoveWrapper_ = null;
|
||||
|
||||
@@ -173,7 +173,7 @@ Blockly.Gesture = function(e, creatorWorkspace) {
|
||||
* A handle to use to unbind a mouse up listener at the end of a drag.
|
||||
* Opaque data returned from Blockly.bindEventWithChecks_.
|
||||
* @type {Array.<!Array>}
|
||||
* @private
|
||||
* @protected
|
||||
*/
|
||||
this.onUpWrapper_ = null;
|
||||
|
||||
@@ -223,7 +223,7 @@ Blockly.Gesture = function(e, creatorWorkspace) {
|
||||
/**
|
||||
* Boolean used internally to break a cycle in disposal.
|
||||
* @type {boolean}
|
||||
* @private
|
||||
* @protected
|
||||
*/
|
||||
this.isEnding_ = false;
|
||||
|
||||
|
||||
@@ -311,7 +311,7 @@ Blockly.WorkspaceSvg.prototype.inverseScreenCTM_ = null;
|
||||
|
||||
/**
|
||||
* Inverted screen CTM is dirty, recalculate it.
|
||||
* @type {Boolean}
|
||||
* @type {boolean}
|
||||
* @private
|
||||
*/
|
||||
Blockly.WorkspaceSvg.prototype.inverseScreenCTMDirty_ = true;
|
||||
@@ -1602,10 +1602,10 @@ Blockly.WorkspaceSvg.prototype.zoomToFit = function() {
|
||||
*/
|
||||
Blockly.WorkspaceSvg.prototype.beginCanvasTransition = function() {
|
||||
Blockly.utils.addClass(
|
||||
/** @type {!SVGElement} */ this.svgBlockCanvas_,
|
||||
/** @type {!SVGElement} */ (this.svgBlockCanvas_),
|
||||
'blocklyCanvasTransitioning');
|
||||
Blockly.utils.addClass(
|
||||
/** @type {!SVGElement} */ this.svgBubbleCanvas_,
|
||||
/** @type {!SVGElement} */ (this.svgBubbleCanvas_),
|
||||
'blocklyCanvasTransitioning');
|
||||
};
|
||||
|
||||
@@ -1615,10 +1615,10 @@ Blockly.WorkspaceSvg.prototype.beginCanvasTransition = function() {
|
||||
*/
|
||||
Blockly.WorkspaceSvg.prototype.endCanvasTransition = function() {
|
||||
Blockly.utils.removeClass(
|
||||
/** @type {!SVGElement} */ this.svgBlockCanvas_,
|
||||
/** @type {!SVGElement} */ (this.svgBlockCanvas_),
|
||||
'blocklyCanvasTransitioning');
|
||||
Blockly.utils.removeClass(
|
||||
/** @type {!SVGElement} */ this.svgBubbleCanvas_,
|
||||
/** @type {!SVGElement} */ (this.svgBubbleCanvas_),
|
||||
'blocklyCanvasTransitioning');
|
||||
};
|
||||
/**
|
||||
|
||||
@@ -215,26 +215,28 @@ Blockly.Events.CommentCreate.prototype.fromJson = function(json) {
|
||||
* @param {boolean} forward True if run forward, false if run backward (undo).
|
||||
*/
|
||||
Blockly.Events.CommentCreate.prototype.run = function(forward) {
|
||||
Blockly.Events.CommentCreateDeleteHelper(forward);
|
||||
Blockly.Events.CommentCreateDeleteHelper(this, forward);
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper function for Comment[Create|Delete]
|
||||
* @param {!Blockly.Events.CommentCreate|!Blockly.Events.CommentDelete} event
|
||||
* The event to run.
|
||||
* @param {boolean} create if True then Create, if False then Delete
|
||||
*/
|
||||
Blockly.Events.CommentCreateDeleteHelper = function(create) {
|
||||
var workspace = this.getEventWorkspace_();
|
||||
Blockly.Events.CommentCreateDeleteHelper = function(event, create) {
|
||||
var workspace = event.getEventWorkspace_();
|
||||
if (create) {
|
||||
var xml = goog.dom.createDom('xml');
|
||||
xml.appendChild(this.xml);
|
||||
xml.appendChild(event.xml);
|
||||
Blockly.Xml.domToWorkspace(xml, workspace);
|
||||
} else {
|
||||
var comment = workspace.getCommentById(this.commentId);
|
||||
var comment = workspace.getCommentById(event.commentId);
|
||||
if (comment) {
|
||||
comment.dispose(false, false);
|
||||
} else {
|
||||
// Only complain about root-level block.
|
||||
console.warn("Can't uncreate non-existent comment: " + this.commentId);
|
||||
console.warn("Can't uncreate non-existent comment: " + event.commentId);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -284,7 +286,7 @@ Blockly.Events.CommentDelete.prototype.fromJson = function(json) {
|
||||
* @param {boolean} forward True if run forward, false if run backward (undo).
|
||||
*/
|
||||
Blockly.Events.CommentDelete.prototype.run = function(forward) {
|
||||
Blockly.Events.CommentCreateDeleteHelper(!forward);
|
||||
Blockly.Events.CommentCreateDeleteHelper(this, !forward);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -133,7 +133,6 @@ Blockly.Xml.fieldToDomVariable_ = function(field) {
|
||||
/**
|
||||
* Encode a field as XML.
|
||||
* @param {!Blockly.Field} field The field to encode.
|
||||
* @param {!Blockly.Workspace} workspace The workspace that the field is in.
|
||||
* @return {?Element} XML element, or null if the field did not need to be
|
||||
* serialized.
|
||||
* @private
|
||||
|
||||
Reference in New Issue
Block a user