GDevelop icon indicating copy to clipboard operation
GDevelop copied to clipboard

Add CTRL+D shortcut to duplicate

Open Bouh opened this issue 1 year ago • 6 comments
trafficstars

Description

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

Bouh avatar Jan 15 '24 13:01 Bouh

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

Ceebox avatar Feb 15 '24 23:02 Ceebox

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

Bouh avatar Feb 16 '24 10:02 Bouh

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?

Ceebox avatar Feb 18 '24 15:02 Ceebox

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

osmaneTKT avatar Mar 18 '24 16:03 osmaneTKT

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

9Amit avatar Apr 24 '24 15:04 9Amit

hello @9Amit i am on this issue

osmaneTKT avatar Apr 24 '24 16:04 osmaneTKT