Skip to content

Conversation

@pmalacho-mit
Copy link

Resolves

What Github issue does this resolve (please include link)?

Proposed Changes

Describe what this Pull Request does

Reason for Changes

Explain why these changes should be made

Test Coverage

Please show how you have added tests to cover your changes

@pmalacho-mit pmalacho-mit marked this pull request as draft June 13, 2025 17:42
import "./blocks/sensing";
import "./blocks/sound";
import * as scratchBlocksUtils from "./scratch_blocks_utils";
/* BEGIN RG ADDITION */
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is necessary because the scratch-gui code wants to overwrite the compareStrings method:

https://github.com/scratchfoundation/scratch-gui/blob/develop/src/lib/blocks.js#L344

*/

/* BEGIN RG ADDITION */
export * from "./colours";
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is necessary as there's lots of places ScratchBlocks.Colours is referenced:

(one example)
https://github.com/scratchfoundation/scratch-gui/blob/develop/src/lib/blocks.js#L70

import * as Blockly from "blockly/core";

const Colours = {
/* PBEGIN RG ADDITIONS */
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is necessary as scratch-gui expects this properties to exist on ScratchBlocks.Colours

one example:
https://github.com/scratchfoundation/scratch-gui/blob/develop/src/lib/blocks.js#L70


/* BEGIN RG ADDITION */
import { StatusIndicatorLabel } from "./status_indicator_label";
export { StatusIndicatorLabel as FlyoutExtensionCategoryHeader };
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is necessary as scratch-gui expects for FlyoutExtensionCategoryHeader to be defined on ScratchBlocks. However, I don't know if the StatusIndicatorLabel actually corresponds to the FlyoutExtensionCategoryHeader.. they just both have a getExtensionState method, which is what the scratch-gui wants to interact with.

https://github.com/scratchfoundation/scratch-gui/blob/develop/src/lib/blocks.js#L326

const style = {
colourPrimary:
"colourQuaternary" in colour
"colourQuaternary" in colour && Boolean(colour.colourQuaternary)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without these checks, I'd get lots of Invalid colour: "undefined" errors. But is this code correct, @gonfunko ? As it just seems a little odd to be defining Primary Secondary and Tertiary always first trying to use the Quaternary setting..

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.

1 participant