Fixed clicks in the mod lists's empty space that toggled last selected row's checkbox ( kartoFlane/Slipstream-Mod-Manager@1333914 )

This commit is contained in:
Vhati 2013-11-07 07:32:39 -05:00
parent 80ff1f447c
commit ccff62d261

View file

@ -330,24 +330,24 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
// Reset on first click and when no longer on that row. // Reset on first click and when no longer on that row.
if ( e.getClickCount() == 1 ) prevRow = -1; if ( e.getClickCount() == 1 ) prevRow = -1;
if ( thisRow != prevRow ) { if ( thisRow != prevRow || thisRow == -1 ) {
streak = 1; streak = 1;
prevRow = thisRow; prevRow = thisRow;
return; return;
} else { } else {
streak++; streak++;
} }
if ( streak % 2 != 0 ) return; // Respond to click pairs. if ( streak % 2 != 0 ) return; // Respond only to click pairs.
// Don't further toggle a multi-clicked checkbox. // Don't further toggle a multi-clicked checkbox.
int viewCol = localModsTable.columnAtPoint( e.getPoint() ); int viewCol = localModsTable.columnAtPoint( e.getPoint() );
int modelCol = localModsTable.getColumnModel().getColumn(viewCol).getModelIndex(); int modelCol = localModsTable.getColumnModel().getColumn(viewCol).getModelIndex();
if ( modelCol == 0 ) return; if ( modelCol == 0 ) return;
int row = localModsTable.getSelectedRow(); int selRow = localModsTable.getSelectedRow();
if ( row != -1 ) { if ( selRow != -1 ) {
boolean selected = localModsTableModel.isSelected( row ); boolean selected = localModsTableModel.isSelected( selRow );
localModsTableModel.setSelected( row, !selected ); localModsTableModel.setSelected( selRow, !selected );
} }
} }
}); });