From e96c1786fb259894a371db8cc1f4f7d1649b6cb1 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Sun, 10 Nov 2024 09:11:15 +0800 Subject: [PATCH] bugfix --- bricks/layout.js | 9 +++++---- bricks/toolbar.js | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bricks/layout.js b/bricks/layout.js index 51d1cdf..d7d5307 100755 --- a/bricks/layout.js +++ b/bricks/layout.js @@ -12,7 +12,7 @@ bricks.Layout = class extends bricks.JsWidget { this.key_select_items = this.children; } enable_key_select(){ - if (!this.keyselectable) return; + this.keyselectable = true; this.set_key_select_items(); this.selected_children = null; bricks.app.bind('keydown', this.key_handler.bind(this)); @@ -25,9 +25,9 @@ bricks.Layout = class extends bricks.JsWidget { return bricks.key_selectable_stack[p] == this; } disable_key_select(){ - if (!this.keyselectable) return; + this.keyselectable = false; + bricks.app.unbind('keydown', this.key_handler.bind(this)); if (this.is_currkeyselectable()){ - bricks.app.unbind('keydown', this.key_handler.bind(this)); this.select_item.selected(false); this.select_item = null; bricks.key_selectable_stack.pop(); @@ -35,7 +35,8 @@ bricks.Layout = class extends bricks.JsWidget { return; } select_item(w){ - if (!this.keyselectable) return; + if (!w) return; + // if (!this.keyselectable) return; if (this.selected_item){ this.selected_item.selected(false); } diff --git a/bricks/toolbar.js b/bricks/toolbar.js index 03a8abc..d8e1e70 100755 --- a/bricks/toolbar.js +++ b/bricks/toolbar.js @@ -26,6 +26,7 @@ bricks.Toolbar = class extends bricks.Layout { this.bar = new bricks.HScrollPanel(options); this.dom_element.classList.add('htoolbar') } + this.bar.enable_key_select() this.add_widget(this.bar); this.clicked_btn = null; this.preffix_css = this.opts.css || 'toolbar';