mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
relocate the tooltip when a new cell is hovered over, even if it contains the same text
This commit is contained in:
@@ -177,6 +177,25 @@ public final class EditorTableView<T extends InventoryItem> {
|
||||
|
||||
return _getCellTooltip(getCellRenderer(row, col), row, col, val);
|
||||
}
|
||||
|
||||
private int lastTooltipRow = -1;
|
||||
private int lastTooltipCol = -1;
|
||||
private Point lastTooltipPt;
|
||||
|
||||
@Override
|
||||
public Point getToolTipLocation(MouseEvent e) {
|
||||
Point p = e.getPoint();
|
||||
final int row = rowAtPoint(p);
|
||||
final int col = columnAtPoint(p);
|
||||
if (row == lastTooltipRow && col == lastTooltipCol) {
|
||||
p = lastTooltipPt;
|
||||
} else {
|
||||
lastTooltipRow = row;
|
||||
lastTooltipCol = col;
|
||||
lastTooltipPt = p;
|
||||
}
|
||||
return new Point(p.x + 10, p.y + 20);
|
||||
}
|
||||
};
|
||||
|
||||
table.addFocusListener(new FocusListener() {
|
||||
|
||||
Reference in New Issue
Block a user