fix(scratch-vm): 拡張機能の HAT/EVENT ブロックを modern Blockly で帽子型に描画#748
Open
takaokouji wants to merge 1 commit into
Open
fix(scratch-vm): 拡張機能の HAT/EVENT ブロックを modern Blockly で帽子型に描画#748takaokouji wants to merge 1 commit into
takaokouji wants to merge 1 commit into
Conversation
…Blockly Extension hat blocks (koshien connect_game, micro:bit / face-sensing / boost / ev3 "when ..." blocks, etc.) rendered with a flat top instead of the cap-hat shape. In modern Blockly (scratch-blocks v2) the cap hat is only drawn when a block carries the `shape_hat` extension (which sets block.hat = 'cap'); a missing previousConnection alone is no longer enough because ADD_START_HATS defaults to false. The built-in event blocks declare extensions: ['colours_event', 'shape_hat'], so _convertBlockForScratchBlocks now adds 'shape_hat' to extension HAT/EVENT blocks the same way. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
🚀 Preview deployed: https://smalruby.jp/smalruby3-editor/fix/extension-hat-shape-modern-blockly/ |
Author
|
upstream の https://scratch.mit.edu/projects/editor/ で確認。 あらためて、 upstream との違いを確認して、修正方針が正しいかどうかを検証してください。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
拡張機能の HAT / EVENT ブロックが modern Blockly (scratch-blocks v2) で帽子型に描画されない不具合の修正。スモウルビー甲子園の「プレイヤー名を () にして、ゲームサーバーへ接続する」(
koshien_connectGame) が平らな上端で表示されていた。micro:bit / 顔認識 / boost / ev3 などのwhen ...拡張 HAT ブロックも同様に影響する一般的な不具合。原因
modern Blockly はキャップ帽子型を
block.hat === 'cap'(=shape_hatextension) のときだけ描画する。previousConnectionが無いだけでは不十分(ADD_START_HATSは既定 false)。標準のイベントブロックはextensions: ['colours_event', 'shape_hat']を宣言して帽子型になっているが、scratch-vm の拡張ブロック変換 (_convertBlockForScratchBlocks) は HAT/EVENT にshape_hatを付与していなかった。Changes Made
src/engine/runtime.js: HAT/EVENT ブロックの blockJSON にshape_hatextension を付与(Smalruby マーカー付き)。アイコン付きブロックはscratch_extensionと併存.claude/rules/scratch-vm/development.md) を更新Test Coverage
test/unit/runtime_extension_hat_shape.jsを追加:HAT/EVENT はshape_hatを持ち、COMMAND は持たない(= 帽子化しない)こと、アイコン付き HAT は両 extension を持つことを検証Notes
upstream の modern-Blockly 移行に伴う一般的な不具合の修正のため、甲子園の各 PR とは独立。