mirror of
https://github.com/google/blockly.git
synced 2026-01-13 20:07:08 +01:00
Split at higher level for multiline function calls
This commit is contained in:
@@ -182,8 +182,8 @@ Blockly.Blocks['procedures_defnoreturn'] = {
|
||||
|
||||
// Check/uncheck the allow statement box.
|
||||
if (this.getInput('RETURN')) {
|
||||
containerBlock.setFieldValue(this.hasStatements_ ? 'TRUE' : 'FALSE',
|
||||
'STATEMENTS');
|
||||
containerBlock.setFieldValue(
|
||||
this.hasStatements_ ? 'TRUE' : 'FALSE', 'STATEMENTS');
|
||||
} else {
|
||||
containerBlock.getInput('STATEMENT_INPUT').setVisible(false);
|
||||
}
|
||||
|
||||
@@ -113,8 +113,8 @@ Blockly.BlockDragSurfaceSvg.prototype.createDom = function() {
|
||||
* surface.
|
||||
*/
|
||||
Blockly.BlockDragSurfaceSvg.prototype.setBlocksAndShow = function(blocks) {
|
||||
goog.asserts.assert(this.dragGroup_.childNodes.length == 0,
|
||||
'Already dragging a block.');
|
||||
goog.asserts.assert(
|
||||
this.dragGroup_.childNodes.length == 0, 'Already dragging a block.');
|
||||
// appendChild removes the blocks from the previous parent
|
||||
this.dragGroup_.appendChild(blocks);
|
||||
this.SVG_.style.display = 'block';
|
||||
@@ -214,7 +214,7 @@ Blockly.BlockDragSurfaceSvg.prototype.clearAndHide = function(opt_newSurface) {
|
||||
this.dragGroup_.removeChild(this.getCurrentBlock());
|
||||
}
|
||||
this.SVG_.style.display = 'none';
|
||||
goog.asserts.assert(this.dragGroup_.childNodes.length == 0,
|
||||
'Drag group was not cleared.');
|
||||
goog.asserts.assert(
|
||||
this.dragGroup_.childNodes.length == 0, 'Drag group was not cleared.');
|
||||
this.surfaceXY_ = null;
|
||||
};
|
||||
|
||||
@@ -149,8 +149,8 @@ Blockly.BlockSvg.prototype.initSvg = function() {
|
||||
this.updateColour();
|
||||
this.updateMovable();
|
||||
if (!this.workspace.options.readOnly && !this.eventsInit_) {
|
||||
Blockly.bindEventWithChecks_(this.getSvgRoot(), 'mousedown', this,
|
||||
this.onMouseDown_);
|
||||
Blockly.bindEventWithChecks_(
|
||||
this.getSvgRoot(), 'mousedown', this, this.onMouseDown_);
|
||||
}
|
||||
this.eventsInit_ = true;
|
||||
|
||||
@@ -708,12 +708,12 @@ Blockly.BlockSvg.prototype.setDragging = function(adding) {
|
||||
group.skew_ = '';
|
||||
Blockly.draggingConnections_ =
|
||||
Blockly.draggingConnections_.concat(this.getConnections_(true));
|
||||
Blockly.utils.addClass(/** @type {!Element} */ (this.svgGroup_),
|
||||
'blocklyDragging');
|
||||
Blockly.utils.addClass(
|
||||
/** @type {!Element} */ (this.svgGroup_), 'blocklyDragging');
|
||||
} else {
|
||||
Blockly.draggingConnections_ = [];
|
||||
Blockly.utils.removeClass(/** @type {!Element} */ (this.svgGroup_),
|
||||
'blocklyDragging');
|
||||
Blockly.utils.removeClass(
|
||||
/** @type {!Element} */ (this.svgGroup_), 'blocklyDragging');
|
||||
}
|
||||
// Recurse through all blocks attached under this one.
|
||||
for (var i = 0; i < this.childBlocks_.length; i++) {
|
||||
@@ -726,11 +726,11 @@ Blockly.BlockSvg.prototype.setDragging = function(adding) {
|
||||
*/
|
||||
Blockly.BlockSvg.prototype.updateMovable = function() {
|
||||
if (this.isMovable()) {
|
||||
Blockly.utils.addClass(/** @type {!Element} */ (this.svgGroup_),
|
||||
'blocklyDraggable');
|
||||
Blockly.utils.addClass(
|
||||
/** @type {!Element} */ (this.svgGroup_), 'blocklyDraggable');
|
||||
} else {
|
||||
Blockly.utils.removeClass(/** @type {!Element} */ (this.svgGroup_),
|
||||
'blocklyDraggable');
|
||||
Blockly.utils.removeClass(
|
||||
/** @type {!Element} */ (this.svgGroup_), 'blocklyDraggable');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -877,8 +877,8 @@ Blockly.BlockSvg.disposeUiStep_ = function(clone, rtl, start, workspaceScale) {
|
||||
var scale = (1 - percent) * workspaceScale;
|
||||
clone.setAttribute('transform', 'translate(' + x + ',' + y + ')' +
|
||||
' scale(' + scale + ')');
|
||||
setTimeout(Blockly.BlockSvg.disposeUiStep_, 10, clone, rtl, start,
|
||||
workspaceScale);
|
||||
setTimeout(
|
||||
Blockly.BlockSvg.disposeUiStep_, 10, clone, rtl, start, workspaceScale);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -971,13 +971,13 @@ Blockly.BlockSvg.disconnectUiStep_ = function(group, magnitude, start) {
|
||||
if (percent > 1) {
|
||||
group.skew_ = '';
|
||||
} else {
|
||||
var skew = Math.round(Math.sin(percent * Math.PI * WIGGLES) *
|
||||
(1 - percent) * magnitude);
|
||||
var skew = Math.round(
|
||||
Math.sin(percent * Math.PI * WIGGLES) * (1 - percent) * magnitude);
|
||||
group.skew_ = 'skewX(' + skew + ')';
|
||||
Blockly.BlockSvg.disconnectUiStop_.group = group;
|
||||
Blockly.BlockSvg.disconnectUiStop_.pid =
|
||||
setTimeout(Blockly.BlockSvg.disconnectUiStep_, 10, group, magnitude,
|
||||
start);
|
||||
setTimeout(
|
||||
Blockly.BlockSvg.disconnectUiStep_, 10, group, magnitude, start);
|
||||
}
|
||||
group.setAttribute('transform', group.translate_ + group.skew_);
|
||||
};
|
||||
@@ -1241,16 +1241,16 @@ Blockly.BlockSvg.prototype.setHighlighted = function(highlighted) {
|
||||
* Select this block. Highlight it visually.
|
||||
*/
|
||||
Blockly.BlockSvg.prototype.addSelect = function() {
|
||||
Blockly.utils.addClass(/** @type {!Element} */ (this.svgGroup_),
|
||||
'blocklySelected');
|
||||
Blockly.utils.addClass(
|
||||
/** @type {!Element} */ (this.svgGroup_), 'blocklySelected');
|
||||
};
|
||||
|
||||
/**
|
||||
* Unselect this block. Remove its highlighting.
|
||||
*/
|
||||
Blockly.BlockSvg.prototype.removeSelect = function() {
|
||||
Blockly.utils.removeClass(/** @type {!Element} */ (this.svgGroup_),
|
||||
'blocklySelected');
|
||||
Blockly.utils.removeClass(
|
||||
/** @type {!Element} */ (this.svgGroup_), 'blocklySelected');
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -308,7 +308,8 @@ Blockly.hideChaff = function(opt_allowToolbox) {
|
||||
*/
|
||||
Blockly.addChangeListener = function(func) {
|
||||
// Backwards compatibility from before there could be multiple workspaces.
|
||||
console.warn('Deprecated call to Blockly.addChangeListener, ' +
|
||||
console.warn(
|
||||
'Deprecated call to Blockly.addChangeListener, ' +
|
||||
'use workspace.addChangeListener instead.');
|
||||
return Blockly.getMainWorkspace().addChangeListener(func);
|
||||
};
|
||||
@@ -382,12 +383,14 @@ Blockly.defineBlocksWithJsonArray = function(jsonArray) {
|
||||
for (var i = 0, elem; elem = jsonArray[i]; i++) {
|
||||
var typename = elem.type;
|
||||
if (typename == null || typename === '') {
|
||||
console.warn('Block definition #' + i +
|
||||
console.warn(
|
||||
'Block definition #' + i +
|
||||
' in JSON array is missing a type attribute. Skipping.');
|
||||
} else {
|
||||
if (Blockly.Blocks[typename]) {
|
||||
console.warn('Block definition #' + i +
|
||||
' in JSON array overwrites prior definition of "' + typename + '".');
|
||||
console.warn(
|
||||
'Block definition #' + i + ' in JSON array' +
|
||||
' overwrites prior definition of "' + typename + '".');
|
||||
}
|
||||
Blockly.Blocks[typename] = {
|
||||
init: Blockly.jsonInitFactory_(elem)
|
||||
|
||||
@@ -75,11 +75,11 @@ Blockly.Bubble = function(workspace, content, shape, anchorXY,
|
||||
this.rendered_ = true;
|
||||
|
||||
if (!workspace.options.readOnly) {
|
||||
Blockly.bindEventWithChecks_(this.bubbleBack_, 'mousedown', this,
|
||||
this.bubbleMouseDown_);
|
||||
Blockly.bindEventWithChecks_(
|
||||
this.bubbleBack_, 'mousedown', this, this.bubbleMouseDown_);
|
||||
if (this.resizeGroup_) {
|
||||
Blockly.bindEventWithChecks_(this.resizeGroup_, 'mousedown', this,
|
||||
this.resizeMouseDown_);
|
||||
Blockly.bindEventWithChecks_(
|
||||
this.resizeGroup_, 'mousedown', this, this.resizeMouseDown_);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -67,8 +67,8 @@ Blockly.ContextMenu.show = function(e, options, rtl) {
|
||||
}
|
||||
var menu = Blockly.ContextMenu.populate_(options, rtl);
|
||||
|
||||
goog.events.listen(menu, goog.ui.Component.EventType.ACTION,
|
||||
Blockly.ContextMenu.hide);
|
||||
goog.events.listen(
|
||||
menu, goog.ui.Component.EventType.ACTION, Blockly.ContextMenu.hide);
|
||||
|
||||
Blockly.ContextMenu.position_(menu, e, rtl);
|
||||
// 1ms delay is required for focusing on context menus because some other
|
||||
@@ -98,8 +98,8 @@ Blockly.ContextMenu.populate_ = function(options, rtl) {
|
||||
menu.addChild(menuItem, true);
|
||||
menuItem.setEnabled(option.enabled);
|
||||
if (option.enabled) {
|
||||
goog.events.listen(menuItem, goog.ui.Component.EventType.ACTION,
|
||||
option.callback);
|
||||
goog.events.listen(
|
||||
menuItem, goog.ui.Component.EventType.ACTION, option.callback);
|
||||
menuItem.handleContextMenu = function(/* e */) {
|
||||
// Right-clicking on menu option should count as a click.
|
||||
goog.events.dispatchEvent(this, goog.ui.Component.EventType.ACTION);
|
||||
@@ -154,8 +154,8 @@ Blockly.ContextMenu.createWidget_ = function(menu) {
|
||||
var menuDom = menu.getElement();
|
||||
Blockly.utils.addClass(menuDom, 'blocklyContextMenu');
|
||||
// Prevent system context menu when right-clicking a Blockly context menu.
|
||||
Blockly.bindEventWithChecks_(menuDom, 'contextmenu', null,
|
||||
Blockly.utils.noEvent);
|
||||
Blockly.bindEventWithChecks_(
|
||||
menuDom, 'contextmenu', null, Blockly.utils.noEvent);
|
||||
// Enable autofocus after the initial render to avoid issue #1329.
|
||||
menu.setAllowAutoFocus(true);
|
||||
};
|
||||
|
||||
@@ -100,10 +100,10 @@ Blockly.Extensions.registerMutator = function(name, mixinObj, opt_helperFn,
|
||||
var errorPrefix = 'Error when registering mutator "' + name + '": ';
|
||||
|
||||
// Sanity check the mixin object before registering it.
|
||||
Blockly.Extensions.checkHasFunction_(errorPrefix, mixinObj.domToMutation,
|
||||
'domToMutation');
|
||||
Blockly.Extensions.checkHasFunction_(errorPrefix, mixinObj.mutationToDom,
|
||||
'mutationToDom');
|
||||
Blockly.Extensions.checkHasFunction_(
|
||||
errorPrefix, mixinObj.domToMutation, 'domToMutation');
|
||||
Blockly.Extensions.checkHasFunction_(
|
||||
errorPrefix, mixinObj.mutationToDom, 'mutationToDom');
|
||||
|
||||
var hasMutatorDialog =
|
||||
Blockly.Extensions.checkMutatorDialog_(mixinObj, errorPrefix);
|
||||
|
||||
@@ -157,8 +157,8 @@ Blockly.Field.prototype.init = function() {
|
||||
this.updateEditable();
|
||||
this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_);
|
||||
this.mouseDownWrapper_ =
|
||||
Blockly.bindEventWithChecks_(this.fieldGroup_, 'mousedown', this,
|
||||
this.onMouseDown_);
|
||||
Blockly.bindEventWithChecks_(
|
||||
this.fieldGroup_, 'mousedown', this, this.onMouseDown_);
|
||||
// Force a render.
|
||||
this.render_();
|
||||
};
|
||||
|
||||
@@ -180,8 +180,8 @@ Blockly.FieldDropdown.prototype.addTouchStartListener_ = function(menu) {
|
||||
// Highlight the menu item.
|
||||
control.handleMouseDown(e);
|
||||
}
|
||||
menu.getHandler().listen(menu.getElement(), goog.events.EventType.TOUCHSTART,
|
||||
callback);
|
||||
menu.getHandler().listen(
|
||||
menu.getElement(), goog.events.EventType.TOUCHSTART, callback);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -196,8 +196,8 @@ Blockly.FieldDropdown.prototype.addTouchEndListener_ = function(menu) {
|
||||
// Activate the menu item.
|
||||
control.performActionInternal(e);
|
||||
}
|
||||
menu.getHandler().listen(menu.getElement(), goog.events.EventType.TOUCHEND,
|
||||
callbackTouchEnd);
|
||||
menu.getHandler().listen(
|
||||
menu.getElement(), goog.events.EventType.TOUCHEND, callbackTouchEnd);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -490,8 +490,8 @@ Blockly.FieldDropdown.prototype.renderSelectedImage_ = function() {
|
||||
'height': this.imageJson_.height + 'px',
|
||||
'width': this.imageJson_.width + 'px'
|
||||
}, this.fieldGroup_);
|
||||
this.imageElement_.setAttributeNS('http://www.w3.org/1999/xlink',
|
||||
'xlink:href', this.imageJson_.src);
|
||||
this.imageElement_.setAttributeNS(
|
||||
'http://www.w3.org/1999/xlink', 'xlink:href', this.imageJson_.src);
|
||||
// Insert dropdown arrow.
|
||||
this.textElement_.appendChild(this.arrow_);
|
||||
var arrowWidth = Blockly.Field.getCachedWidth(this.arrow_);
|
||||
|
||||
@@ -114,8 +114,8 @@ Blockly.FieldImage.prototype.dispose = function() {
|
||||
Blockly.FieldImage.prototype.maybeAddClickHandler_ = function() {
|
||||
if (this.clickHandler_) {
|
||||
this.mouseDownWrapper_ =
|
||||
Blockly.bindEventWithChecks_(this.fieldGroup_, 'mousedown', this,
|
||||
this.onMouseDown_);
|
||||
Blockly.bindEventWithChecks_(
|
||||
this.fieldGroup_, 'mousedown', this, this.onMouseDown_);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -206,16 +206,16 @@ Blockly.FieldTextInput.prototype.showInlineEditor_ = function(quietInput) {
|
||||
Blockly.FieldTextInput.prototype.bindEvents_ = function(htmlInput) {
|
||||
// Bind to keydown -- trap Enter without IME and Esc to hide.
|
||||
htmlInput.onKeyDownWrapper_ =
|
||||
Blockly.bindEventWithChecks_(htmlInput, 'keydown', this,
|
||||
this.onHtmlInputKeyDown_);
|
||||
Blockly.bindEventWithChecks_(
|
||||
htmlInput, 'keydown', this, this.onHtmlInputKeyDown_);
|
||||
// Bind to keyup -- trap Enter; resize after every keystroke.
|
||||
htmlInput.onKeyUpWrapper_ =
|
||||
Blockly.bindEventWithChecks_(htmlInput, 'keyup', this,
|
||||
this.onHtmlInputChange_);
|
||||
Blockly.bindEventWithChecks_(
|
||||
htmlInput, 'keyup', this, this.onHtmlInputChange_);
|
||||
// Bind to keyPress -- repeatedly resize when holding down a key.
|
||||
htmlInput.onKeyPressWrapper_ =
|
||||
Blockly.bindEventWithChecks_(htmlInput, 'keypress', this,
|
||||
this.onHtmlInputChange_);
|
||||
Blockly.bindEventWithChecks_(
|
||||
htmlInput, 'keypress', this, this.onHtmlInputChange_);
|
||||
htmlInput.onWorkspaceChangeWrapper_ = this.resizeEditor_.bind(this);
|
||||
this.workspace_.addChangeListener(htmlInput.onWorkspaceChangeWrapper_);
|
||||
};
|
||||
|
||||
@@ -241,8 +241,8 @@ Blockly.Flyout.prototype.init = function(targetWorkspace) {
|
||||
|
||||
// Dragging the flyout up and down.
|
||||
Array.prototype.push.apply(this.eventWrappers_,
|
||||
Blockly.bindEventWithChecks_(this.svgBackground_, 'mousedown', this,
|
||||
this.onMouseDown_));
|
||||
Blockly.bindEventWithChecks_(
|
||||
this.svgBackground_, 'mousedown', this, this.onMouseDown_));
|
||||
|
||||
// A flyout connected to a workspace doesn't have its own current gesture.
|
||||
this.workspace_.getGesture =
|
||||
@@ -636,8 +636,9 @@ Blockly.Flyout.prototype.initFlyoutButton_ = function(button, x, y) {
|
||||
button.show();
|
||||
// Clicking on a flyout button or label is a lot like clicking on the
|
||||
// flyout background.
|
||||
this.listeners_.push(Blockly.bindEventWithChecks_(buttonSvg, 'mousedown',
|
||||
this, this.onMouseDown_));
|
||||
this.listeners_.push(
|
||||
Blockly.bindEventWithChecks_(
|
||||
buttonSvg, 'mousedown', this, this.onMouseDown_));
|
||||
|
||||
this.buttons_.push(button);
|
||||
};
|
||||
|
||||
@@ -79,14 +79,14 @@ Blockly.Icon.prototype.createIcon = function() {
|
||||
this.iconGroup_ = Blockly.utils.createSvgElement('g',
|
||||
{'class': 'blocklyIconGroup'}, null);
|
||||
if (this.block_.isInFlyout) {
|
||||
Blockly.utils.addClass(/** @type {!Element} */ (this.iconGroup_),
|
||||
'blocklyIconGroupReadonly');
|
||||
Blockly.utils.addClass(
|
||||
/** @type {!Element} */ (this.iconGroup_), 'blocklyIconGroupReadonly');
|
||||
}
|
||||
this.drawIcon_(this.iconGroup_);
|
||||
|
||||
this.block_.getSvgRoot().appendChild(this.iconGroup_);
|
||||
Blockly.bindEventWithChecks_(this.iconGroup_, 'mouseup', this,
|
||||
this.iconClick_);
|
||||
Blockly.bindEventWithChecks_(
|
||||
this.iconGroup_, 'mouseup', this, this.iconClick_);
|
||||
this.updateEditable();
|
||||
};
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ Blockly.Mutator.prototype.resizeBubble_ = function() {
|
||||
this.workspaceHeight_ = height;
|
||||
// Resize the bubble.
|
||||
this.bubble_.setBubbleSize(width + doubleBorderWidth,
|
||||
height + doubleBorderWidth);
|
||||
width + doubleBorderWidth, height + doubleBorderWidth);
|
||||
this.svgDialog_.setAttribute('width', this.workspaceWidth_);
|
||||
this.svgDialog_.setAttribute('height', this.workspaceHeight_);
|
||||
}
|
||||
|
||||
@@ -189,8 +189,8 @@ Blockly.Toolbox.prototype.init = function() {
|
||||
} else {
|
||||
this.flyout_ = new Blockly.VerticalFlyout(workspaceOptions);
|
||||
}
|
||||
goog.dom.insertSiblingAfter(this.flyout_.createDom('svg'),
|
||||
this.workspace_.getParentSvg());
|
||||
goog.dom.insertSiblingAfter(
|
||||
this.flyout_.createDom('svg'), this.workspace_.getParentSvg());
|
||||
this.flyout_.init(workspace);
|
||||
|
||||
this.config_['cleardotPath'] = workspace.options.pathToMedia + '1x1.gif';
|
||||
@@ -427,8 +427,7 @@ Blockly.Toolbox.prototype.clearSelection = function() {
|
||||
* @package
|
||||
*/
|
||||
Blockly.Toolbox.prototype.addStyle = function(style) {
|
||||
Blockly.utils.addClass(/** @type {!Element} */ (this.HtmlDiv),
|
||||
style);
|
||||
Blockly.utils.addClass(/** @type {!Element} */ (this.HtmlDiv), style);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -437,8 +436,7 @@ Blockly.Toolbox.prototype.addStyle = function(style) {
|
||||
* @package
|
||||
*/
|
||||
Blockly.Toolbox.prototype.removeStyle = function(style) {
|
||||
Blockly.utils.removeClass(/** @type {!Element} */ (this.HtmlDiv),
|
||||
style);
|
||||
Blockly.utils.removeClass(/** @type {!Element} */ (this.HtmlDiv), style);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -115,8 +115,8 @@ Blockly.WorkspaceDragSurfaceSvg.prototype.translateSurface = function(x, y) {
|
||||
y = y.toFixed(0);
|
||||
|
||||
this.SVG_.style.display = 'block';
|
||||
Blockly.utils.setCssTransform(this.SVG_,
|
||||
'translate3d(' + x + 'px, ' + y + 'px, 0px)');
|
||||
Blockly.utils.setCssTransform(
|
||||
this.SVG_, 'translate3d(' + x + 'px, ' + y + 'px, 0px)');
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -157,8 +157,8 @@ Blockly.WorkspaceDragSurfaceSvg.prototype.clearAndHide = function(newSurface) {
|
||||
Blockly.utils.insertAfter_(bubbleCanvas, blockCanvas);
|
||||
// Hide the drag surface.
|
||||
this.SVG_.style.display = 'none';
|
||||
goog.asserts.assert(this.SVG_.childNodes.length == 0,
|
||||
'Drag surface was not cleared.');
|
||||
goog.asserts.assert(
|
||||
this.SVG_.childNodes.length == 0, 'Drag surface was not cleared.');
|
||||
Blockly.utils.setCssTransform(this.SVG_, '');
|
||||
this.previousSibling_ = null;
|
||||
};
|
||||
@@ -177,13 +177,13 @@ Blockly.WorkspaceDragSurfaceSvg.prototype.clearAndHide = function(newSurface) {
|
||||
*/
|
||||
Blockly.WorkspaceDragSurfaceSvg.prototype.setContentsAndShow = function(
|
||||
blockCanvas, bubbleCanvas, previousSibling, width, height, scale) {
|
||||
goog.asserts.assert(this.SVG_.childNodes.length == 0,
|
||||
'Already dragging a block.');
|
||||
goog.asserts.assert(
|
||||
this.SVG_.childNodes.length == 0, 'Already dragging a block.');
|
||||
this.previousSibling_ = previousSibling;
|
||||
// Make sure the blocks and bubble canvas are scaled appropriately.
|
||||
blockCanvas.setAttribute('transform', 'translate(0, 0) scale(' + scale + ')');
|
||||
bubbleCanvas.setAttribute('transform',
|
||||
'translate(0, 0) scale(' + scale + ')');
|
||||
bubbleCanvas.setAttribute(
|
||||
'transform', 'translate(0, 0) scale(' + scale + ')');
|
||||
this.SVG_.setAttribute('width', width);
|
||||
this.SVG_.setAttribute('height', height);
|
||||
this.SVG_.appendChild(blockCanvas);
|
||||
|
||||
@@ -61,8 +61,8 @@ Blockly.WorkspaceDragger = function(workspace) {
|
||||
* @type {!goog.math.Coordinate}
|
||||
* @private
|
||||
*/
|
||||
this.startScrollXY_ = new goog.math.Coordinate(workspace.scrollX,
|
||||
workspace.scrollY);
|
||||
this.startScrollXY_ = new goog.math.Coordinate(
|
||||
workspace.scrollX, workspace.scrollY);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -965,8 +965,8 @@ Blockly.WorkspaceSvg.prototype.deleteVariableById = function(id) {
|
||||
* @package
|
||||
*/
|
||||
Blockly.WorkspaceSvg.prototype.createVariable = function(name, opt_type, opt_id) {
|
||||
var newVar = Blockly.WorkspaceSvg.superClass_.createVariable.call(this, name,
|
||||
opt_type, opt_id);
|
||||
var newVar = Blockly.WorkspaceSvg.superClass_.createVariable.call(
|
||||
this, name, opt_type, opt_id);
|
||||
this.refreshToolboxSelection_();
|
||||
return newVar;
|
||||
};
|
||||
|
||||
@@ -584,8 +584,8 @@ Blockly.Xml.domToVariables = function(xmlVariables, workspace) {
|
||||
Blockly.Xml.domToBlockHeadless_ = function(xmlBlock, workspace) {
|
||||
var block = null;
|
||||
var prototypeName = xmlBlock.getAttribute('type');
|
||||
goog.asserts.assert(prototypeName, 'Block type unspecified: %s',
|
||||
xmlBlock.outerHTML);
|
||||
goog.asserts.assert(
|
||||
prototypeName, 'Block type unspecified: %s', xmlBlock.outerHTML);
|
||||
var id = xmlBlock.getAttribute('id');
|
||||
block = workspace.newBlock(prototypeName, id);
|
||||
|
||||
@@ -729,8 +729,8 @@ Blockly.Xml.domToBlockHeadless_ = function(xmlBlock, workspace) {
|
||||
// Ensure all children are also shadows.
|
||||
var children = block.getChildren();
|
||||
for (var i = 0, child; child = children[i]; i++) {
|
||||
goog.asserts.assert(child.isShadow(),
|
||||
'Shadow block not allowed non-shadow child.');
|
||||
goog.asserts.assert(
|
||||
child.isShadow(), 'Shadow block not allowed non-shadow child.');
|
||||
}
|
||||
// Ensure this block doesn't have any variable inputs.
|
||||
goog.asserts.assert(block.getVarModels().length == 0,
|
||||
|
||||
Reference in New Issue
Block a user