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) {
|
if (index >= 0) {
|
||||||
int selRow = index % tableModel.briefRowsPerColumn;
|
int selRow = index % tableModel.briefRowsPerColumn;
|
||||||
int selCol = index / tableModel.briefRowsPerColumn;
|
int selCol = index / tableModel.briefRowsPerColumn;
|
||||||
briefCurrentColumn = selCol;
|
selectBriefItemWithoutAutoScroll(selRow, selCol);
|
||||||
// Focus and Select the item
|
|
||||||
fileTable.changeSelection(selRow, selCol, false, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
item = tableModel.getItem(row);
|
item = tableModel.getItem(row);
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
fileTable.changeSelection(row, col, false, false);
|
selectFullRowWithoutAutoScroll(row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -595,16 +593,13 @@ public class FilePanelTab extends JPanel {
|
|||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
int selRow = index % tableModel.briefRowsPerColumn;
|
int selRow = index % tableModel.briefRowsPerColumn;
|
||||||
int selCol = index / tableModel.briefRowsPerColumn;
|
int selCol = index / tableModel.briefRowsPerColumn;
|
||||||
briefCurrentColumn = selCol;
|
selectBriefItemWithoutAutoScroll(selRow, selCol);
|
||||||
fileTable.setRowSelectionInterval(selRow, selRow);
|
|
||||||
scrollBriefCellToColumnStart(selRow, selCol);
|
|
||||||
selected = true;
|
selected = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// FULL mode: rows map directly
|
// FULL mode: rows map directly
|
||||||
fileTable.setRowSelectionInterval(row, row);
|
selectFullRowWithoutAutoScroll(row);
|
||||||
fileTable.scrollRectToVisible(fileTable.getCellRect(row, 0, true));
|
|
||||||
selected = true;
|
selected = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1485,6 +1480,46 @@ public class FilePanelTab extends JPanel {
|
|||||||
updateStatus();
|
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) {
|
private void scrollBriefCellToColumnStart(int row, int column) {
|
||||||
if (fileTable == null || viewMode != ViewMode.BRIEF || row < 0 || column < 0
|
if (fileTable == null || viewMode != ViewMode.BRIEF || row < 0 || column < 0
|
||||||
|| column >= fileTable.getColumnModel().getColumnCount()) {
|
|| column >= fileTable.getColumnModel().getColumnCount()) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user