From 9004346f7d1d4f2238a590c563c0de8d10951a06 Mon Sep 17 00:00:00 2001 From: alschmiedt Date: Tue, 17 Sep 2019 10:58:34 -0700 Subject: [PATCH] Remove moving on the workspace (#3029) * Remove moving on the workspace --- core/keyboard_nav/ast_node.js | 27 ++------------------------- tests/mocha/astnode_test.js | 16 ---------------- 2 files changed, 2 insertions(+), 41 deletions(-) diff --git a/core/keyboard_nav/ast_node.js b/core/keyboard_nav/ast_node.js index 9fa49cb42..9112ec893 100644 --- a/core/keyboard_nav/ast_node.js +++ b/core/keyboard_nav/ast_node.js @@ -83,14 +83,6 @@ Blockly.ASTNode.types = { WORKSPACE: 'workspace' }; -/** - * The amount to move the workspace coordinate to the left or right. - * This occurs when we get the next or previous node from a workspace node. - * @type {number} - * @private - */ -Blockly.ASTNode.wsMove_ = 10; - /** * The default y offset to use when moving the cursor from a stack to the * workspace. @@ -468,7 +460,7 @@ Blockly.ASTNode.prototype.getOutAstNodeForBlock_ = function(block) { return Blockly.ASTNode.createInputNode( topConnection.targetConnection.getParentInput()); } else { - //Go to stack level if you are not underneath an input + // Go to stack level if you are not underneath an input. return Blockly.ASTNode.createStackNode(topBlock); } }; @@ -523,15 +515,6 @@ Blockly.ASTNode.prototype.findTopOfSubStack_ = function(sourceBlock) { */ Blockly.ASTNode.prototype.next = function() { switch (this.type_) { - case Blockly.ASTNode.types.WORKSPACE: - //TODO: Need to limit this. The view is bounded to half a screen beyond - //the furthest block. - var newX = this.wsCoordinate_.x + Blockly.ASTNode.wsMove_; - var newWsCoordinate = new Blockly.utils.Coordinate(newX, this.wsCoordinate_.y); - var workspace = /** @type {Blockly.Workspace} */ (this.location_); - return Blockly.ASTNode.createWorkspaceNode(workspace, - newWsCoordinate); - case Blockly.ASTNode.types.STACK: return this.navigateBetweenStacks_(true); @@ -606,12 +589,6 @@ Blockly.ASTNode.prototype.in = function() { */ Blockly.ASTNode.prototype.prev = function() { switch (this.type_) { - case Blockly.ASTNode.types.WORKSPACE: - var newX = this.wsCoordinate_.x - Blockly.ASTNode.wsMove_; - var newCoord = new Blockly.utils.Coordinate(newX, this.wsCoordinate_.y); - var ws = /** @type {Blockly.Workspace} */ (this.location_); - return Blockly.ASTNode.createWorkspaceNode(ws, newCoord); - case Blockly.ASTNode.types.STACK: return this.navigateBetweenStacks_(false); @@ -657,7 +634,7 @@ Blockly.ASTNode.prototype.out = function() { switch (this.type_) { case Blockly.ASTNode.types.STACK: var blockPos = this.location_.getRelativeToSurfaceXY(); - //TODO: Make sure this is in the bounds of the workspace + // TODO: Make sure this is in the bounds of the workspace. var wsCoordinate = new Blockly.utils.Coordinate( blockPos.x, blockPos.y + Blockly.ASTNode.DEFAULT_OFFSET_Y); return Blockly.ASTNode.createWorkspaceNode( diff --git a/tests/mocha/astnode_test.js b/tests/mocha/astnode_test.js index d1492f2c7..1f0756212 100644 --- a/tests/mocha/astnode_test.js +++ b/tests/mocha/astnode_test.js @@ -388,14 +388,6 @@ suite('ASTNode', function() { var nextNode = node.next(); assertEquals(nextNode, null); }); - test('moveCursorToRight', function() { - var coordinate = new Blockly.utils.Coordinate(100, 100); - var node = Blockly.ASTNode.createWorkspaceNode(this.workspace, coordinate); - var nextNode = node.next(); - assertEquals(nextNode.wsCoordinate_.x, 110); - assertEquals(nextNode.getLocation(), this.workspace); - assertEquals(nextNode.getType(), Blockly.ASTNode.types.WORKSPACE); - }); }); suite('Previous', function() { @@ -575,14 +567,6 @@ suite('ASTNode', function() { assertEquals(prevNode.getLocation(), this.blocks.statementInput1); assertEquals(prevNode.getType(), Blockly.ASTNode.types.STACK); }); - test('moveCursorToLeft', function() { - var coordinate = new Blockly.utils.Coordinate(100, 100); - var node = Blockly.ASTNode.createWorkspaceNode(this.workspace, coordinate); - var nextNode = node.prev(); - assertEquals(nextNode.wsCoordinate_.x, 90); - assertEquals(nextNode.getLocation(), this.workspace); - assertEquals(nextNode.getType(), Blockly.ASTNode.types.WORKSPACE); - }); }); suite('In', function() {