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

Add CTRL+D shortcut to duplicate #6194

Open
Bouh opened this issue Jan 15, 2024 · 6 comments · May be fixed by #6273
Open

Add CTRL+D shortcut to duplicate #6194

Bouh opened this issue Jan 15, 2024 · 6 comments · May be fixed by #6273
Labels
✨ enhancement 👌good first issue Good issue if you want to start contributing to GDevelop

Comments

@Bouh
Copy link
Collaborator

Bouh commented Jan 15, 2024

Description

Please add the CTRL+D duplicate on the object list.
image

@Bouh Bouh added ✨ enhancement 👌good first issue Good issue if you want to start contributing to GDevelop labels Jan 15, 2024
@Bouh Bouh linked a pull request Jan 25, 2024 that will close this issue
@Ceebox
Copy link

Ceebox commented Feb 15, 2024

Is this a great idea? I got this to work and found out that CTRL+D is also the key that bookmarks pages.

@Bouh
Copy link
Collaborator Author

Bouh commented Feb 16, 2024

This default browser behavior can be prevent by a Javascript code like:

document.querySelector('html').addEventListener('keydown', handleKeyDown);
    function handleKeyDown( e ) {
      if ( e.ctrlKey && e.keyCode === 68 ) {  // ctrl + d
          console.log('Ctrl+D');
      }
      e.preventDefault();
    }

source

@Ceebox
Copy link

Ceebox commented Feb 18, 2024

I was more suggesting that we don't do that anywhere else in the codebase (to my knowledge), would it perhaps be better to change the keybind?

@osmaneTKT
Copy link

Hi @Bouh, I'm going to take your advice and tackle this issue to pass my course

@9Amit
Copy link

9Amit commented Apr 24, 2024

document.addEventListener('keydown', (e) => {
const { key, ctrlKey } = e;
if (ctrlKey && key.toLowerCase() === 'd') {
console.log('Ctrl+D');
e.preventDefault();
}
});

@osmaneTKT
Copy link

hello @9Amit i am on this issue

osmaneTKT added a commit to osmaneTKT/GDevelop that referenced this issue May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement 👌good first issue Good issue if you want to start contributing to GDevelop
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants