This commit is contained in:
yumoqing 2024-11-10 09:11:15 +08:00
parent 6e8b47074f
commit e96c1786fb
2 changed files with 6 additions and 4 deletions

View File

@ -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;
if (this.is_currkeyselectable()){
this.keyselectable = false;
bricks.app.unbind('keydown', this.key_handler.bind(this));
if (this.is_currkeyselectable()){
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);
}

View File

@ -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';