mouse click doesnt change viewport
This commit is contained in:
parent
6395e3a94c
commit
caac494639
@ -542,15 +542,13 @@ public class FilePanelTab extends JPanel {
|
||||
if (index >= 0) {
|
||||
int selRow = index % tableModel.briefRowsPerColumn;
|
||||
int selCol = index / tableModel.briefRowsPerColumn;
|
||||
briefCurrentColumn = selCol;
|
||||
// Focus and Select the item
|
||||
fileTable.changeSelection(selRow, selCol, false, false);
|
||||
selectBriefItemWithoutAutoScroll(selRow, selCol);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
item = tableModel.getItem(row);
|
||||
if (item != null) {
|
||||
fileTable.changeSelection(row, col, false, false);
|
||||
selectFullRowWithoutAutoScroll(row);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -595,16 +593,13 @@ public class FilePanelTab extends JPanel {
|
||||
if (index >= 0) {
|
||||
int selRow = index % tableModel.briefRowsPerColumn;
|
||||
int selCol = index / tableModel.briefRowsPerColumn;
|
||||
briefCurrentColumn = selCol;
|
||||
fileTable.setRowSelectionInterval(selRow, selRow);
|
||||
scrollBriefCellToColumnStart(selRow, selCol);
|
||||
selectBriefItemWithoutAutoScroll(selRow, selCol);
|
||||
selected = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// FULL mode: rows map directly
|
||||
fileTable.setRowSelectionInterval(row, row);
|
||||
fileTable.scrollRectToVisible(fileTable.getCellRect(row, 0, true));
|
||||
selectFullRowWithoutAutoScroll(row);
|
||||
selected = true;
|
||||
}
|
||||
}
|
||||
@ -1485,6 +1480,46 @@ public class FilePanelTab extends JPanel {
|
||||
updateStatus();
|
||||
}
|
||||
|
||||
private void selectBriefItemWithoutAutoScroll(int row, int column) {
|
||||
if (fileTable == null || row < 0 || column < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Point preservedPosition = null;
|
||||
Container parent = fileTable.getParent();
|
||||
if (parent instanceof JViewport viewport) {
|
||||
preservedPosition = viewport.getViewPosition();
|
||||
}
|
||||
|
||||
briefCurrentColumn = column;
|
||||
fileTable.getSelectionModel().setSelectionInterval(row, row);
|
||||
if (column < fileTable.getColumnModel().getColumnCount()) {
|
||||
fileTable.getColumnModel().getSelectionModel().setSelectionInterval(column, column);
|
||||
}
|
||||
|
||||
if (preservedPosition != null && parent instanceof JViewport viewport) {
|
||||
viewport.setViewPosition(preservedPosition);
|
||||
}
|
||||
}
|
||||
|
||||
private void selectFullRowWithoutAutoScroll(int row) {
|
||||
if (fileTable == null || row < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Point preservedPosition = null;
|
||||
Container parent = fileTable.getParent();
|
||||
if (parent instanceof JViewport viewport) {
|
||||
preservedPosition = viewport.getViewPosition();
|
||||
}
|
||||
|
||||
fileTable.getSelectionModel().setSelectionInterval(row, row);
|
||||
|
||||
if (preservedPosition != null && parent instanceof JViewport viewport) {
|
||||
viewport.setViewPosition(preservedPosition);
|
||||
}
|
||||
}
|
||||
|
||||
private void scrollBriefCellToColumnStart(int row, int column) {
|
||||
if (fileTable == null || viewMode != ViewMode.BRIEF || row < 0 || column < 0
|
||||
|| column >= fileTable.getColumnModel().getColumnCount()) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user