mirror of https://github.com/cy384/ssheven.git
redraw selection only when mouse changes cells (less flicker)
This commit is contained in:
parent
84f096b65a
commit
d43f919a4f
|
@ -181,11 +181,32 @@ void damage_selection(void)
|
||||||
|
|
||||||
void update_selection_end(void)
|
void update_selection_end(void)
|
||||||
{
|
{
|
||||||
Point new_mouse;
|
static int last_mouse_cell_x = -1;
|
||||||
GetMouse(&new_mouse);
|
static int last_mouse_cell_y = -1;
|
||||||
point_to_cell(new_mouse, &con.select_end_x, &con.select_end_y);
|
|
||||||
|
|
||||||
|
int new_mouse_cell_x;
|
||||||
|
int new_mouse_cell_y;
|
||||||
|
|
||||||
|
Point new_mouse;
|
||||||
|
|
||||||
|
GetMouse(&new_mouse);
|
||||||
|
point_to_cell(new_mouse, &new_mouse_cell_x, &new_mouse_cell_y);
|
||||||
|
|
||||||
|
// only damage the selection if the mouse has moved outside of the last cell
|
||||||
|
if (last_mouse_cell_x != new_mouse_cell_x || last_mouse_cell_y != new_mouse_cell_y)
|
||||||
|
{
|
||||||
|
// damage the old selection
|
||||||
damage_selection();
|
damage_selection();
|
||||||
|
|
||||||
|
con.select_end_x = new_mouse_cell_x;
|
||||||
|
con.select_end_y = new_mouse_cell_y;
|
||||||
|
|
||||||
|
last_mouse_cell_x = new_mouse_cell_x;
|
||||||
|
last_mouse_cell_y = new_mouse_cell_y;
|
||||||
|
|
||||||
|
// damage the new selection
|
||||||
|
damage_selection();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// p is in window local coordinates
|
// p is in window local coordinates
|
||||||
|
|
Loading…
Reference in New Issue