{{ message }}
Add Matrix Support#573
Open
LuYifei2011 wants to merge 2 commits into
Open
Conversation
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.

Closes #509
This pull request adds support for matrix inputs to the block rendering and model logic for both Scratch 2 and Scratch 3 styles. It introduces a new
Matrixclass for representing matrix inputs, updates the rendering logic to visually display matrices in blocks, and refines the stringification and alignment logic to handle multi-line matrix values. The changes are grouped into model/data layer improvements and rendering/UI enhancements.Model/Data Layer Improvements:
Matrixclass tosyntax/model.jsto represent matrix inputs, with automatic row padding and custom stringification for alignment.Inputclass insyntax/model.jsto recognize and handle matrix inputs, including logic for label handling, stringification with alignment, and translation. [1] [2] [3]Blockclass stringification insyntax/model.jsto pass line prefixes for proper matrix alignment in block text output.displayWidthutility to calculate correct alignment for mixed-language matrix input rows.Rendering/UI Enhancements:
MatrixViewrendering classes to bothscratch2/blocks.jsandscratch3/blocks.jsfor visual display of matrix inputs, including cell sizing, layout, and color logic. [1] [2]InputViewin bothscratch2/blocks.jsandscratch3/blocks.jsto detect matrix inputs and render them using the newMatrixView, with proper sizing, padding, and integration with other input types. [1] [2] [3] [4] [5] [6] [7] [8]Integration and Syntax Support:
Matrixclass in the syntax module and updated block definitions to use matrix input types. [1] [2] [3]See #509 for further information.