mirror of
https://github.com/Azornes/Comfyui-LayerForge.git
synced 2026-03-25 06:22:14 -03:00
Enable keyboard interaction in layers panel
Added tabIndex to the panel container to allow keyboard focus and attached a keydown event listener to forward keyboard events to the main interaction handler. This improves accessibility and enables keyboard-based layer deletion from the panel.
This commit is contained in:
@@ -29,6 +29,7 @@ export class CanvasLayersPanel {
|
|||||||
// Główny kontener panelu
|
// Główny kontener panelu
|
||||||
this.container = document.createElement('div');
|
this.container = document.createElement('div');
|
||||||
this.container.className = 'layers-panel';
|
this.container.className = 'layers-panel';
|
||||||
|
this.container.tabIndex = 0; // Umożliwia fokus na panelu
|
||||||
this.container.innerHTML = `
|
this.container.innerHTML = `
|
||||||
<div class="layers-panel-header">
|
<div class="layers-panel-header">
|
||||||
<span class="layers-panel-title">Warstwy</span>
|
<span class="layers-panel-title">Warstwy</span>
|
||||||
@@ -50,6 +51,14 @@ export class CanvasLayersPanel {
|
|||||||
// Setup event listeners dla przycisków
|
// Setup event listeners dla przycisków
|
||||||
this.setupControlButtons();
|
this.setupControlButtons();
|
||||||
|
|
||||||
|
// Dodaj listener dla klawiatury, aby usuwanie działało z panelu
|
||||||
|
this.container.addEventListener('keydown', (e) => {
|
||||||
|
// Przekaż zdarzenie do głównego handlera interakcji
|
||||||
|
if (this.canvas.canvasInteractions) {
|
||||||
|
this.canvas.canvasInteractions.handleKeyDown(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
log.debug('Panel structure created');
|
log.debug('Panel structure created');
|
||||||
return this.container;
|
return this.container;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user