Skip to content

Conversation

@GarboMuffin
Copy link
Member

@GarboMuffin GarboMuffin commented Sep 21, 2021

Alt+click is already used by editor-devtools, so that can't be used here

Alt+ctrl+drag (cmd+option+drag on macOS) will duplicate only the current block, like block-cherry-picking

@WorldLanguages
Copy link
Member

WorldLanguages commented Sep 26, 2021

Should this addon also have a "flip controls" setting, similar to "grab single block with Ctrl key"? It would require you to hold Ctrl as well as Shift to duplicate the whole stack, and would duplicate a single script by default.
What do users do more often? Duplicate a whole stack, or a single block?
Edit: according to griffpatch, both.

@WorldLanguages
Copy link
Member

Okay, I'm talking with griffpatch and we might actually want to use Alt instead of Shift, which makes way more sense. But we'd first need to fix the hotkey madness. So I'm not really rushed to merge this.

Currently, devtools uses Alt+Click for everything middle click, that is:

  • Alt+Click variable: open in search bar
  • Alt+Click custom block: go to definition
  • Alt+Click in workspace: type block name

The first one is probably not widely used, and the last one could be kept.
We could also consider having this new addon duplicate blocks when being dragged with mouse middle click. But we'd need to remove the "middle click to go to custom block definition" feature of devtools.

Suffering from success, folks.

@GarboMuffin
Copy link
Member Author

GarboMuffin commented Sep 27, 2021

Should this addon also have a "flip controls" setting, similar to "grab single block with Ctrl key"?

Sure

we might actually want to use Alt instead of Shift

What's the proposed replacement for the alt+click devtools shortcuts? Currently those shortcuts are the easiest or only way use those features on some systems (any system without a middle mouse button, which is a bunch of laptops including every MacBook) I guess we can keep those shortcuts with minimal changes

We could also consider having this new addon duplicate blocks when being dragged with mouse middle click. But we'd need to remove the "middle click to go to custom block definition" feature of devtools.

I don't think removing devtools features is a good idea. It could be possible for this addon to use middle click without completely breaking that feature because dragging and clicking are different actions (in theory).

On that topic, if this addon can be bound to middle mouse, then surely block-cherry-picking should be able to too. Maybe these addons can get merged together into a "Better dragging" addon and have a bunch of settings for "middle mouse", "control+click", etc. so people can configure it however they want

@cobaltt7
Copy link
Contributor

cobaltt7 commented Sep 27, 2021 via email

@lisa-wolfgang
Copy link
Member

If we want to keep middle-click/alt-click, we could change all of the Devtools usages to only occur when the keybind is released in order to differentiate between a click and a drag.

@lisa-wolfgang
Copy link
Member

lisa-wolfgang commented Sep 27, 2021

On a separate note, it would probably be a good idea to provide an API to handle keybinds and key presses. What if someone has missing/dead keys on their keyboard or has disabilities that make it harder to or prevent them from using certain key combinations? It would make sense to have a "Scratch Addons keybinds" section in the settings page, or even somewhere in the editor. This would also serve as a nice reminder that certain features are enabled by Scratch Addons.

@WorldLanguages
Copy link
Member

If we want to keep middle-click/alt-click, we could change all of the Devtools usages to only occur when the keybind is released in order to differentiate between a click and a drag.

I like this idea. Devtools could wait until Alt+Click is released (keyup), so both addons could use the Alt hotkey at the same time.

@GarboMuffin GarboMuffin marked this pull request as draft September 27, 2021 22:48
@GarboMuffin
Copy link
Member Author

It will be looked into

@WorldLanguages
Copy link
Member

Thanks!
We need to keep in mind some users use DevtoolsExtension, so an older version of devtools that doesn't use keyup could in theory run at the same time as this addon. So we probably want to ship a new devtools extension version that uses keyup a few days earlier to make sure that doesn't happen.

@CST1229
Copy link
Member

CST1229 commented Sep 28, 2021

Thanks! We need to keep in mind some users use DevtoolsExtension, so an older version of devtools that doesn't use keyup could in theory run at the same time as this addon. So we probably want to ship a new devtools extension version that uses keyup a few days earlier to make sure that doesn't happen.

Or maybe set a global variable in keyup-using devtools versions and don't run this addon if the devtools elements are still present without the variable being set.

@lisa-wolfgang
Copy link
Member

I still don't understand why we continue to update the Devtools extension. It seems to be doing more harm than good.

@WorldLanguages
Copy link
Member

I still don't understand why we continue to update the Devtools extension. It seems to be doing more harm than good.

I don't think whether we update it would change the user count. It has looked pretty much the same yet it still grew. If we update it, at least we can make it compatible with other addons.

@WorldLanguages
Copy link
Member

WorldLanguages commented Sep 28, 2021

Griffpatch is unsure about having Alt+Click and Alt+drag use the same key.

I suggested and he agreed:

  1. Devtools has had middle-click features for a while, and editor-devtools: add Alt + Click as middle-click alternative #3171 added Alt+Click as an alternative for users that don't have middle click, not too far back. It's not ideal, but we could change that to Shift+Click, which is currently unused.
  2. Make this addon use Alt+drag to duplicate the whole stack, and Alt+Ctrl+drag to duplicate a single block. This is consistent with vector editors, which use Alt for duplicating.

The only real pain is number 1, and we could hint users that it changed to Shift if devtools sees them Alt+Clicking blocks without dragging them.
In the future, we'll probably discontinue the devtools extension and hope most users migrate to Scratch Addons.

The final list of all addons and hotkeys would be:

  1. Devtools uses middle click and Shift+Click for "go to custom block definition" and others.
  2. Ctrl+Click to run scripts only runs scripts if Ctrl is held (no changes)
  3. Grab single block with Ctrl key (no changes)
  4. Duplicate block with Alt key (duplicates whole stack by default, unless Ctrl is held)

Edit: devtools also owns Ctrl+Space in the workspace, where it is equivalent to Alt+Click and mouse middle click. Ugh...

@GarboMuffin GarboMuffin changed the title New addon: Shift+click drag to duplicate block New addon: Alt+click drag to duplicate block Sep 29, 2021
@GarboMuffin GarboMuffin marked this pull request as ready for review October 2, 2021 18:09
@GarboMuffin GarboMuffin requested a review from apple502j as a code owner October 2, 2021 18:09
@WorldLanguages WorldLanguages merged commit 98458ce into ScratchAddons:master Oct 3, 2021
@WorldLanguages
Copy link
Member

We need to keep in mind some users use DevtoolsExtension, so an older version of devtools that doesn't use keyup could in theory run at the same time as this addon. So we probably want to ship a new devtools extension version that uses keyup a few days earlier to make sure that doesn't happen.

I'll be releasing a new version of DevtoolsExtension in the next few days, to avoid any problems, since theoretically a user could run an old DevtoolsExtension version that listens to Alt+Click at the same time as this new addon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants