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

Conflict with Scratch Tools (in general) and Scratch Addons: "insert blocks by name" #964

Open
ksdavidc opened this issue Sep 10, 2024 · 4 comments
Labels
status: needs review Waiting for further review. type: bug Something isn't working

Comments

@ksdavidc
Copy link

Describe the bug. What is going wrong?

[ this is being crossposted to Scratch Tools.)
(I know compatibility is not supported, but am reporting since this indicates existence of a possible bug in SA as well)

It appears that something in scratchtools is in conflict with the scratchaddons “insert block by name” plugin, causing the mouse to be “locked”, i.e. moving the mouse moves the content of the block editor pane, but one can't click or otherwise get out.

  1. With both installed,
  2. if I activate the block suggestion popup (via either middle click or space click),
  3. sometimes (usually the 2nd time) it gets locked into a "keep moving all the code blocks with the mouse, but don't let me get out" loop.
  4. If i turn off scratchtools, it works again.
  5. Turning it on again, it works a little, but reverts.

What is causing the bug?

https://discord.com/channels/945340853189247016/1259626053601853460

Screen_Recording_2024-07-08_at_6.41.40_AM.mov

at the start of video, mouse is locked when attempting block insertion, and editor content is moving with mouse. restarting goes back to normal, allowing block suggestion popup, but subsequently locking again.
json:

my ST.json
my sa.json

from another user with same problem:
scratchtools-settings (2).json
scratch-addons-settings (2).json

version: SA 1.39.1 and ST .3.9
Chrome 128.0.6613.120 (Official Build) (x86_64)
Mac Sonoma

Anything else?

this has been crossposted to SA and discord.

@ksdavidc ksdavidc added status: needs review Waiting for further review. type: bug Something isn't working labels Sep 10, 2024
@ksdavidc
Copy link
Author

@ksdavidc
Copy link
Author

ksdavidc commented Sep 10, 2024

BlockTypeInfo.js:509 Uncaught TypeError: Cannot read properties of undefined (reading 'getAllVariableNamesInScopeByType')
    at BlockTypeInfo._createBlocks (BlockTypeInfo.js:509:48)
    at BlockTypeInfo.getBlocks (BlockTypeInfo.js:387:26)
    at openPopup (userscript.js:114:32)
    at Blockly.Gesture.doWorkspaceClick_ (userscript.js:448:79)
    at Blockly.Gesture.handleUp (projects.bundle.js:2:11379414)
    at HTMLDocument.s (projects.bundle.js:2:11997165)
_createBlocks @ BlockTypeInfo.js:509
getBlocks @ BlockTypeInfo.js:387
openPopup @ userscript.js:114
Blockly.Gesture.doWorkspaceClick_ @ userscript.js:448
Blockly.Gesture.handleUp @ projects.bundle.js:2
s @ projects.bundle.js:2
projects.bundle.js:2 Trying to cancel a gesture recursively.
projects.bundle.js:2 Trying to cancel a gesture recursively.

@ksdavidc
Copy link
Author

ScratchAddons/ScratchAddons#7794 (comment)

The "Select Self" plugin seems to be the culprit. Please see the above discussion for a fuller explanation and the possible routes to a solution.

@ksdavidc
Copy link
Author

ksdavidc commented Sep 13, 2024

More data: "Select self", https://github.com/STForScratch/ScratchTools/blob/main/features/select-self/script.js, it seems, is adding menu items to certain blocks (that seem unrelated to adding self?!), for example, _mouse_ and _random_ to the of block, even though its code (below) appears to be attempting to only add "Stage" to the sensing block. (pure conjecture, I have no clue)

let ORIGINAL_DATA = {
    motion_glideto_menu: [
      ["random position", "_random_"],
      ["mouse-pointer", "_mouse_"],
    ],
    motion_goto_menu: [
      ["random position", "_random_"],
      ["mouse-pointer", "_mouse_"],
    ],
    motion_pointtowards_menu: [["random position", "_random_"]],
    sensing_touchingobjectmenu: [
      ["mouse-pointer", "_mouse_"],
      ["edge", "_edge_"],
    ],
    sensing_of_object_menu: [["Stage", "_stage_"]],
    sensing_distancetomenu: [["mouse-pointer", "_mouse_"]],
  };

I have tested these blocks in a project, https://scratch.mit.edu/projects/1067296787/editor/, and I notice that:

  1. they only appear when "select self" plugin is active.
  2. things like x position of random or y position of mouse appear to be inoperative https://scratch.mit.edu/projects/1067296787/ at least as far as what my naive expectation of their function would be if intentional. I suspect these are not actually intended to be implemented? Or maybe they are, and somehow got replaced with Stage?
  3. In a project, starting with the default ~ of Stage and changing it to another value (sprite) makes the Stage value itself disappear and inaccessible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs review Waiting for further review. type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant