-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Re-implement cat block rendering in Blockly v12 terms #3426
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
base: spork
Are you sure you want to change the base?
Conversation
feat: support cat-blocks as a configurable theme
# [1.3.0](v1.2.5...v1.3.0) (2025-11-26) ### Bug Fixes * some silly issues and a rename ([acfb3e6](acfb3e6)) * use getters to dynamically update svg block constants ([4bd9618](4bd9618)) ### Features * abstract away some of the cat-blocks implementation logic ([c44cb57](c44cb57)) * add comment ([c88ca72](c88ca72)) * make cat-blocks code configurable behind a flag ([45a93bb](45a93bb))
…p-node-6.x chore(deps): update actions/setup-node action to v6
chore(deps): update node.js to v20
…kout-6.x chore(deps): update actions/checkout action to v6
…p-java-5.x chore(deps): update actions/setup-java action to v5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR re-implements the cat block rendering feature to work with Blockly v12 APIs, refactoring the renderer architecture to support multiple rendering themes. The changes merge the latest from develop and introduce a theme-based system for selecting between classic Scratch blocks and animated cat blocks.
Key Changes
- Introduced a theme-based renderer selection system with
ScratchBlocksThemeenum supportingCLASSICandCAT_BLOCKSthemes - Refactored renderer architecture to use overridable
makeReplacementTop_()andmakeBowlerHat()methods for better extensibility - Implemented cat block renderer with interactive animations including blinking eyes and flickable ears
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/renderer/renderer.ts | Added getClassName() method and renamed renderer registration from "scratch" to "scratch_classic" |
| src/renderer/render_info.ts | Extracted bowler hat creation into overridable makeBowlerHat() method for subclass customization |
| src/renderer/drawer.ts | Refactored hat path replacement logic into makeReplacementTop_() method to support subclass overrides |
| src/renderer/constants.ts | Added BOWLER_HAT_HEIGHT constant and makeBowlerHatPath() method; fixed unnecessary semicolon |
| src/renderer/bowler_hat.ts | Updated to use BOWLER_HAT_HEIGHT from constants instead of hardcoded value |
| src/renderer/cat/renderer.ts | New cat renderer that extends ScratchRenderer and registers as "scratch_catblocks" |
| src/renderer/cat/drawer.ts | New drawer with face rendering and interactive animations for cat blocks |
| src/renderer/cat/constants.ts | Cat-specific constants including face geometry paths and dynamic cat path generation |
| src/renderer/cat/cat_block_svg.ts | Interface extending BlockSvg with hasFace flag to track face creation state |
| src/index.ts | Added theme-based renderer selection with ScratchBlocksOptions interface |
| src/constants.ts | Added ScratchBlocksTheme enum defining available block themes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I'm not positive, but I think it might work a bit better to create a |
I'm just now getting back to this work, and tried to move the face into a new |
|
Well shoot, right you are...I wonder if |
|
I got bogged down in tracing who calls what, and decided to zoom out. Here's what I'm thinking:
One thing I'll admit up front: I don't have a good handle on what the Given item 3, it seems appropriate for each face to be owned by its associated By "face" here, I mean the eyes and mouth, which are "extra" items that don't affect the block's outline. The eyes react to The ears are tricky: their insides are like face parts (strong, independent Based on all of this, I'm leaning toward moving as much of the face logic as possible into a new, separate object. That object can be created, owned, and partially hooked up by the The one thing that isn't covered is the method I called Thoughts? |
|
Update: I'm now thinking that the |
|
That broadly sounds reasonable; this is an area of the code I tend to avoid, but I ran it by Rachel and she suggested looking at how |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 10 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Proposed Changes
developintosporkReason for Changes
@gonfunko, I'm very interested in any refactorings you think might make future Blockly upgrades smoother, or if there's a better or more official mechanism for any of this. I'm not thrilled with
CatBlockSvg, for example.