Untangle: fix redraws when dragging with cursor keys.

The recent addition of graph editor functionality to Untangle in
2ac951e broke redraws while dragging a point using the cursor keys. In
particular, the new ui->dragtype field was not being set by the cursor
dragging code path, causing redraws to erroneously exit early.

Generally, there is quite a bit of code duplication between the cursor
and mouse dragging code paths in interpret_move(). Some refactoring
could perhaps reduce the chances of this happening again.
This commit is contained in:
Franklin Wei
2025-01-01 18:49:13 -05:00
committed by Simon Tatham
parent 28e519b08f
commit abe1eed3ba

View File

@ -1542,6 +1542,7 @@ static char *interpret_move(const game_state *state, game_ui *ui,
} else if(button == CURSOR_SELECT) { } else if(button == CURSOR_SELECT) {
if(ui->dragpoint < 0 && ui->cursorpoint >= 0) { if(ui->dragpoint < 0 && ui->cursorpoint >= 0) {
/* begin drag */ /* begin drag */
ui->dragtype = DRAG_MOVE_POINT;
ui->dragpoint = ui->cursorpoint; ui->dragpoint = ui->cursorpoint;
ui->cursorpoint = -1; ui->cursorpoint = -1;
ui->newpoint.x = state->pts[ui->dragpoint].x * ds->tilesize / state->pts[ui->dragpoint].d; ui->newpoint.x = state->pts[ui->dragpoint].x * ds->tilesize / state->pts[ui->dragpoint].d;