scratchfoundation / scratchfoundation/scratch-blocks
field_matrix does not use colors of the block containing it
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2.8k
- Forks
- 1.6k
- Avg merge
- 4h 51m
- Merged PRs (30d)
- 12
Description
Expected Behavior
field_matrix should follow the colors of the block containing it.
Actual Behavior
It keeps its own greenish color:

I've tried to solve the issue in the PR that references this issue, but my solution feels like a hack. Because the parentBlock property isn't set on field_matix's sourceBlock_ when the affected functions are initially called I've added guards to protect against 'undefined'. This solves the issue, but feels wrong.
In contrast field_angle also references sourceBlock_.parentBlock_ but does not need the guards against parentBlock being undefined. I'm guessing that is because it only references sourceBlock_.parentBlock_ in showEditor_ which is called at a later stage than init and setValue where field_matrix sets its colors.
So perhaps the issue is that setParent should be called earlier? But that change seems like it would be above my paygrade :)
Steps to Reproduce
Add a block containing a field_matrix to an extension and the the extensions colors.
Something along the lines of:
getInfo: function () {
return {
blocks: [
{
arguments: {
MATRIX: {
defaultValue: '0101011111111110111000100',
type: 'matrix'
}
},
blockType: 'command',
opcode: 'show',
text: 'Show [MATRIX]'
}
],
colour: '#3D7DD9',
colourSecondary: '#0D4E8E',
colourTertiary: '#033D6C',
id: 'myMatixTest',
name: 'Matrix test',
targetTypes: ['hub']
};
}
Operating System and Browser
Mac OS 10.13.6 (17G65) Chrome Version 70.0.3538.77 (Official Build) (64-bit)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.