4ian / GDevelop

:video_game: Open-source, cross-platform game engine designed to be used by everyone.
https://gdevelop.io
Other
6.57k stars 722 forks source link

Add CTRL+D shortcut to duplicate #6194

Open Bouh opened 5 months ago

Bouh commented 5 months ago

Description

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

Ceebox commented 4 months ago

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

Bouh commented 3 months ago

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 commented 3 months ago

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 commented 2 months ago

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

9Amit commented 1 month ago

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

osmaneTKT commented 1 month ago

hello @9Amit i am on this issue