fixes in full mode
This commit is contained in:
parent
7cbff72d38
commit
e585341b69
@ -553,17 +553,28 @@ public class FilePanelTab extends JPanel {
|
||||
// Enable horizontal scrollbar when needed so BRIEF mode can scroll left-right
|
||||
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
|
||||
// Implement mouse wheel navigation in BRIEF mode to match arrow key behavior
|
||||
// Implement mouse wheel navigation in BRIEF and FULL mode to match arrow key behavior
|
||||
fileTable.addMouseWheelListener(new java.awt.event.MouseWheelListener() {
|
||||
@Override
|
||||
public void mouseWheelMoved(java.awt.event.MouseWheelEvent e) {
|
||||
int rotation = e.getWheelRotation();
|
||||
if (rotation == 0) return;
|
||||
|
||||
if (viewMode == ViewMode.BRIEF) {
|
||||
int rotation = e.getWheelRotation();
|
||||
if (rotation != 0) {
|
||||
// Navigate by one full column per wheel step
|
||||
handleBriefNavigation(rotation > 0, tableModel.briefRowsPerColumn);
|
||||
e.consume();
|
||||
// Navigate by one full column per wheel step
|
||||
handleBriefNavigation(rotation > 0, tableModel.briefRowsPerColumn);
|
||||
e.consume();
|
||||
} else if (viewMode == ViewMode.FULL) {
|
||||
// Navigate by one item at a time in FULL mode
|
||||
int currentRow = fileTable.getSelectedRow();
|
||||
int newRow = currentRow + (rotation > 0 ? 1 : -1);
|
||||
|
||||
if (newRow >= 0 && newRow < fileTable.getRowCount()) {
|
||||
fileTable.setRowSelectionInterval(newRow, newRow);
|
||||
fileTable.scrollRectToVisible(fileTable.getCellRect(newRow, 0, true));
|
||||
updateStatus();
|
||||
}
|
||||
e.consume();
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -904,10 +915,17 @@ public class FilePanelTab extends JPanel {
|
||||
if (autoSelectFirst && fileTable.getRowCount() > 0) {
|
||||
int startIndex = 0;
|
||||
fileTable.setRowSelectionInterval(startIndex, startIndex);
|
||||
// Ensure the first row (usually "..") is visible at the very top
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
fileTable.scrollRectToVisible(fileTable.getCellRect(0, 0, true));
|
||||
});
|
||||
}
|
||||
if (requestFocus) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
try { fileTable.requestFocusInWindow(); } catch (Exception ignore) {}
|
||||
try {
|
||||
fileTable.requestFocusInWindow();
|
||||
} catch (Exception ignore) {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user