Movement of objects with the arrow keys in symbol editor

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@527 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-07-08 13:48:53 +00:00
parent b46d979f9e
commit b18dea0f69
9 changed files with 232 additions and 46 deletions
+12 -1
View File
@@ -387,7 +387,18 @@ void SymbolSelectEditor::onChar(wxKeyEvent& ev) {
resetActions();
control.Refresh(false);
} else {
ev.Skip();
// move selection using arrow keys
double step = 1.0 / settings.symbol_grid_size;
Vector2D delta;
if (ev.GetKeyCode() == WXK_LEFT) delta = Vector2D(-step, 0);
else if (ev.GetKeyCode() == WXK_RIGHT) delta = Vector2D( step, 0);
else if (ev.GetKeyCode() == WXK_UP) delta = Vector2D(0, -step);
else if (ev.GetKeyCode() == WXK_DOWN) delta = Vector2D(0, step);
else {
ev.Skip();
return;
}
getSymbol()->actions.add(new SymbolPartMoveAction(control.selected_parts, delta));
}
}