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
|
// Enable horizontal scrollbar when needed so BRIEF mode can scroll left-right
|
||||||
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
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() {
|
fileTable.addMouseWheelListener(new java.awt.event.MouseWheelListener() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseWheelMoved(java.awt.event.MouseWheelEvent e) {
|
public void mouseWheelMoved(java.awt.event.MouseWheelEvent e) {
|
||||||
|
int rotation = e.getWheelRotation();
|
||||||
|
if (rotation == 0) return;
|
||||||
|
|
||||||
if (viewMode == ViewMode.BRIEF) {
|
if (viewMode == ViewMode.BRIEF) {
|
||||||
int rotation = e.getWheelRotation();
|
// Navigate by one full column per wheel step
|
||||||
if (rotation != 0) {
|
handleBriefNavigation(rotation > 0, tableModel.briefRowsPerColumn);
|
||||||
// Navigate by one full column per wheel step
|
e.consume();
|
||||||
handleBriefNavigation(rotation > 0, tableModel.briefRowsPerColumn);
|
} else if (viewMode == ViewMode.FULL) {
|
||||||
e.consume();
|
// 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) {
|
if (autoSelectFirst && fileTable.getRowCount() > 0) {
|
||||||
int startIndex = 0;
|
int startIndex = 0;
|
||||||
fileTable.setRowSelectionInterval(startIndex, startIndex);
|
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) {
|
if (requestFocus) {
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
try { fileTable.requestFocusInWindow(); } catch (Exception ignore) {}
|
try {
|
||||||
|
fileTable.requestFocusInWindow();
|
||||||
|
} catch (Exception ignore) {
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user