Add platform override support for hotkeys and unhardcode editor hotkeys
This commit is contained in:
committed by
Paul Chote
parent
1cf4838b08
commit
6a1a6b6397
@@ -39,15 +39,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var copypasteButton = widget.GetOrNull<ButtonWidget>("COPYPASTE_BUTTON");
|
||||
if (copypasteButton != null)
|
||||
{
|
||||
// HACK: Replace Ctrl with Cmd on macOS
|
||||
// TODO: Add platform-specific override support to HotkeyManager
|
||||
// and then port the editor hotkeys to this system.
|
||||
var copyPasteKey = copypasteButton.Key.GetValue();
|
||||
if (Platform.CurrentPlatform == PlatformType.OSX && copyPasteKey.Modifiers.HasModifier(Modifiers.Ctrl))
|
||||
{
|
||||
var modified = new Hotkey(copyPasteKey.Key, copyPasteKey.Modifiers & ~Modifiers.Ctrl | Modifiers.Meta);
|
||||
copypasteButton.Key = FieldLoader.GetValue<HotkeyReference>("Key", modified.ToString());
|
||||
}
|
||||
|
||||
copypasteButton.OnClick = () => editorViewport.SetBrush(new EditorCopyPasteBrush(editorViewport, worldRenderer, () => copyFilters));
|
||||
copypasteButton.IsHighlighted = () => editorViewport.CurrentBrush is EditorCopyPasteBrush;
|
||||
|
||||
Reference in New Issue
Block a user