Closed pixelzoom closed 2 years ago
Reproduced locally with ?brand=phet&ea&debugger&initialScreen=1&fuzz
.
Uncaught TypeError: Cannot read properties of null (reading 'transformMatrix')
at CanvasSelfDrawable.paintCanvas (RectangleCanvasDrawable.js? [sm]:102:14)
at Rectangle.canvasPaintSelf (Rectangle.ts:725:39)
at Rectangle.renderToCanvasSelf (Node.ts:5276:12)
at Rectangle.renderToCanvasSubtree (Node.ts:5291:10)
at Node.renderToCanvasSubtree (Node.ts:5342:17)
at AlignBox.renderToCanvasSubtree (Node.ts:5342:17)
at RectangularRadioButton.renderToCanvasSubtree (Node.ts:5342:17)
at LightModeRadioButtonGroup.renderToCanvasSubtree (Node.ts:5342:17)
at Node.renderToCanvasSubtree (Node.ts:5342:17)
at SpectraScreenView.renderToCanvasSubtree (Node.ts:5342:17)
LightModeRadioButtonGroup.ts creates this radio-button group:
The icons for these radio buttons have a derived stroke for the beam (to adapt to the default vs projector color profile), like this:
// If the beam color is the same as the radio button fill, stroke the beam.
const strokeProperty = new DerivedProperty( [ MOTHAColors.lightModeRadioButtonFillProperty ],
lightModeRadioButtonFill => ( lightModeRadioButtonFill.equals( beamColor ) ) ? 'black' : null
);
const beamNode = new Rectangle( 0, 0, 5, 10, {
fill: beamColor,
stroke: strokeProperty,
...
} );
I don't know why this should be a problem. But I suspect that in RectangleCanvasDrawable.js, the call to node.hasPaintableStroke()
(line 99) doesn't know that it's stroke has changed to null
. @jonathanolson can you confirm/explain?
In the meantime, I've changed null
to 'transparent'
in my implementation.
Definite bug. hasFill()
/hasStroke()
should not be returning true if it's a Property with a null value. Seeing if the fix breaks anything.
I haven't seen any problems in the sim or in CT. @jonathanolson can this issue be closed?
Yes, thanks!