question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

field_matrix does not use colors of the block containing it

See original GitHub issue

Expected Behavior

field_matrix should follow the colors of the block containing it.

Actual Behavior

It keeps its own greenish color: image

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)

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
cwillisfcommented, Nov 29, 2018

@picklesrus I think it would make sense to generate the shadows in the VM. The main obstacle is that I’m not sure how to do that correctly 😉

In general I think it makes sense for the VM (and in particular the extension manager) to be as authoritative as possible when it builds block JSON and XML – I think that approach will decrease the chances that someone will need to troubleshoot in multiple locations when a block doesn’t look right or work correctly.

1reaction
picklesruscommented, Nov 7, 2018

That makes sense. Yes, I think you’re right about the vm during the conversion to scratch blocks. I think we’re going to need something similar to the menu building code you referenced for shadows in extensions. I’m curious to get @cwillisf 's opinion on this though.

@cwillisf: When making extension blocks that have shadows, (e.g. the shadow that contains the matrix field for the microbit extension), should we be generating the shadow’s definition in the vm (right now I think we just get it from the blocks) so we can set the color appropriately? Let me know if you need more context - not sure how easy this thread is to follow if you haven’t had your head in it already 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Matrix Fields | Craft CMS Documentation | 3.x
Matrix fields allow you to create multiple blocks of content within a single field. # Settings. Matrix fields have the following settings:.
Read more >
Plot single block of color in R - Stack Overflow
I am trying to visualize a region of a genome with color. I am starting with a matrix that has 1 row and...
Read more >
Attention to Color Sharpens Neural Population Tuning via ...
Here, we show with high-resolution magnetoencephalography in human observers (men and women) that sharpened selectivity for a particular color ...
Read more >
tetrinet-bot | Matt Mazur
With the help of hex editor, I changed the TetriNET executable so that I could skip blocks I didn't want to use. For...
Read more >
An octahedron can be obtained by gluing eight colored ...
This is a colored tetrahedron with faces colored 0, 1,. FIG. ... It can then be used as a building block (bubble) and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found