Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InputModifier should include SHORTCUT(Ctrl on Win, Command on Mac) modifier? #1204

Open
AlmasB opened this issue Aug 29, 2022 Discussed in #1203 · 1 comment
Open

InputModifier should include SHORTCUT(Ctrl on Win, Command on Mac) modifier? #1204

AlmasB opened this issue Aug 29, 2022 Discussed in #1203 · 1 comment
Assignees
Labels
codefest23-24 difficulty:easy Simple, few changes required

Comments

@AlmasB
Copy link
Owner

AlmasB commented Aug 29, 2022

Discussed in #1203

Originally posted by chengenzhao August 27, 2022
HI:

We just read the source code of FXGL
and in the Triggers.kt
there are some modifiers for the input modifier
and when statement will match Keycode of modifiers to the input modifier
but it only matches KeyCode.Ctrl to InputModifier.Ctrl
I think it would be nice to have ShortCut in that clause also
like:

//KeyTrigger
        return when (event.code) {
            KeyCode.CONTROL, KeyCode.SHORTCUT -> modifier == InputModifier.CTRL
            KeyCode.SHIFT -> modifier == InputModifier.SHIFT
            KeyCode.ALT -> modifier == InputModifier.ALT
            else -> event.code == key
        }

//MouseTrigger
    override fun isReleased(event: InputEvent): Boolean {
        if (event is KeyEvent) {
            return when (event.code) {
                KeyCode.CONTROL, KeyCode.SHORTCUT -> modifier == InputModifier.CTRL
                KeyCode.SHIFT -> modifier == InputModifier.SHIFT
                KeyCode.ALT -> modifier == InputModifier.ALT
                else -> false
            }
        }

Because when people use Mac, they tend to use Meta(Command) key rather than Ctrl
so it would be nice to have Short Cut in that clause also

Thanks

@AlmasB AlmasB added difficulty:easy Simple, few changes required codefest23-24 labels Feb 18, 2024
@iammarvin7
Copy link

/assign

this is my first open source contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codefest23-24 difficulty:easy Simple, few changes required
Projects
None yet
Development

No branches or pull requests

2 participants