mirror of
https://github.com/google/blockly.git
synced 2026-01-10 02:17:09 +01:00
Merge pull request #597 from svbatalov/toolbox-hscroll-patch-event
Fix toolbox scrolling in horizontal layout
This commit is contained in:
@@ -565,7 +565,6 @@ Blockly.Toolbox.TreeControl.prototype.setSelectedItem = function(node) {
|
||||
Blockly.Toolbox.TreeNode = function(toolbox, html, opt_config, opt_domHelper) {
|
||||
goog.ui.tree.TreeNode.call(this, html, opt_config, opt_domHelper);
|
||||
if (toolbox) {
|
||||
this.horizontalLayout_ = toolbox.horizontalLayout_;
|
||||
var resize = function() {
|
||||
// Even though the div hasn't changed size, the visible workspace
|
||||
// surface of the workspace has, so we may need to reposition everything.
|
||||
@@ -626,10 +625,12 @@ Blockly.Toolbox.TreeNode.prototype.onDoubleClick_ = function(e) {
|
||||
* @private
|
||||
*/
|
||||
Blockly.Toolbox.TreeNode.prototype.onKeyDown = function(e) {
|
||||
if (this.horizontalLayout_) {
|
||||
if (this.tree.toolbox_.horizontalLayout_) {
|
||||
var map = {};
|
||||
map[goog.events.KeyCodes.RIGHT] = goog.events.KeyCodes.DOWN;
|
||||
map[goog.events.KeyCodes.LEFT] = goog.events.KeyCodes.UP;
|
||||
var next = goog.events.KeyCodes.DOWN
|
||||
var prev = goog.events.KeyCodes.UP
|
||||
map[goog.events.KeyCodes.RIGHT] = this.rightToLeft_ ? prev : next;
|
||||
map[goog.events.KeyCodes.LEFT] = this.rightToLeft_ ? next : prev;
|
||||
map[goog.events.KeyCodes.UP] = goog.events.KeyCodes.LEFT;
|
||||
map[goog.events.KeyCodes.DOWN] = goog.events.KeyCodes.RIGHT;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user