Commit 4dffad0d authored by Neil Fraser's avatar Neil Fraser

Improve 'clean up' spacing.

parent 879cacbb
...@@ -66,8 +66,8 @@ Blockly.Toolbox.prototype.width = 0; ...@@ -66,8 +66,8 @@ Blockly.Toolbox.prototype.width = 0;
Blockly.Toolbox.prototype.selectedOption_ = null; Blockly.Toolbox.prototype.selectedOption_ = null;
/** /**
* The SVG group currently selected. * The tree node most recently selected.
* @type {*} * @type {goog.ui.tree.BaseNode}
* @private * @private
*/ */
Blockly.Toolbox.prototype.lastCategory_ = null; Blockly.Toolbox.prototype.lastCategory_ = null;
...@@ -99,7 +99,7 @@ Blockly.Toolbox.prototype.init = function() { ...@@ -99,7 +99,7 @@ Blockly.Toolbox.prototype.init = function() {
// Create an HTML container for the Toolbox menu. // Create an HTML container for the Toolbox menu.
this.HtmlDiv = goog.dom.createDom('div', 'blocklyToolboxDiv'); this.HtmlDiv = goog.dom.createDom('div', 'blocklyToolboxDiv');
this.HtmlDiv.setAttribute('dir', this.workspace_.RTL ? 'RTL' : 'LTR'); this.HtmlDiv.setAttribute('dir', workspace.RTL ? 'RTL' : 'LTR');
document.body.appendChild(this.HtmlDiv); document.body.appendChild(this.HtmlDiv);
// Clicking on toolbar closes popups. // Clicking on toolbar closes popups.
...@@ -128,7 +128,7 @@ Blockly.Toolbox.prototype.init = function() { ...@@ -128,7 +128,7 @@ Blockly.Toolbox.prototype.init = function() {
this.CONFIG_['cleardotPath'] = workspace.options.pathToMedia + '1x1.gif'; this.CONFIG_['cleardotPath'] = workspace.options.pathToMedia + '1x1.gif';
this.CONFIG_['cssCollapsedFolderIcon'] = this.CONFIG_['cssCollapsedFolderIcon'] =
'blocklyTreeIconClosed' + (this.workspace_.RTL ? 'Rtl' : 'Ltr'); 'blocklyTreeIconClosed' + (workspace.RTL ? 'Rtl' : 'Ltr');
var tree = new Blockly.Toolbox.TreeControl(this, this.CONFIG_); var tree = new Blockly.Toolbox.TreeControl(this, this.CONFIG_);
this.tree_ = tree; this.tree_ = tree;
tree.setShowRootNode(false); tree.setShowRootNode(false);
...@@ -148,6 +148,7 @@ Blockly.Toolbox.prototype.dispose = function() { ...@@ -148,6 +148,7 @@ Blockly.Toolbox.prototype.dispose = function() {
this.tree_.dispose(); this.tree_.dispose();
goog.dom.removeNode(this.HtmlDiv); goog.dom.removeNode(this.HtmlDiv);
this.workspace_ = null; this.workspace_ = null;
this.lastCategory_ = null;
}; };
/** /**
...@@ -332,9 +333,9 @@ Blockly.Toolbox.TreeControl.prototype.setSelectedItem = function(node) { ...@@ -332,9 +333,9 @@ Blockly.Toolbox.TreeControl.prototype.setSelectedItem = function(node) {
if (node && node.blocks && node.blocks.length) { if (node && node.blocks && node.blocks.length) {
toolbox.flyout_.show(node.blocks); toolbox.flyout_.show(node.blocks);
// Scroll the flyout to the top if the category has changed. // Scroll the flyout to the top if the category has changed.
if (toolbox.lastCategory_ != node.blocks) { if (toolbox.lastCategory_ != node) {
toolbox.flyout_.scrollToTop(); toolbox.flyout_.scrollToTop();
toolbox.lastCategory_ = node.blocks; toolbox.lastCategory_ = node;
} }
} else { } else {
// Hide the flyout. // Hide the flyout.
......
...@@ -658,9 +658,9 @@ Blockly.WorkspaceSvg.prototype.cleanUp_ = function() { ...@@ -658,9 +658,9 @@ Blockly.WorkspaceSvg.prototype.cleanUp_ = function() {
for (var i = 0, block; block = topBlocks[i]; i++) { for (var i = 0, block; block = topBlocks[i]; i++) {
var xy = block.getRelativeToSurfaceXY(); var xy = block.getRelativeToSurfaceXY();
block.moveBy(-xy.x, cursorY - xy.y); block.moveBy(-xy.x, cursorY - xy.y);
cursorY += block.getHeightWidth().height;
cursorY += Blockly.BlockSvg.MIN_BLOCK_Y;
block.snapToGrid(); block.snapToGrid();
cursorY = block.getRelativeToSurfaceXY().y +
block.getHeightWidth().height + Blockly.BlockSvg.MIN_BLOCK_Y;
} }
// Fire an event to allow scrollbars to resize. // Fire an event to allow scrollbars to resize.
Blockly.fireUiEvent(window, 'resize'); Blockly.fireUiEvent(window, 'resize');
......
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