Skip to content

Commit 4d24e93

Browse files
committed
Rename rasterized => rasterizeNode, see scenerystack/scenerystack#43
1 parent fac3ee0 commit 4d24e93

9 files changed

+29
-29
lines changed

doc/implementation-notes.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ ModifiedNodalAnalysisCircuit.js for details.
8181
their dispose functions.
8282
* To attain reasonable performance on iPad2, some of the CircuitNode child node layers have been implemented in WebGL
8383
using `renderer:'webgl'`. This means all of the nodes must be rendered with solid-fill Rectangle (without rounded
84-
corners or gradients), and images. rasterized() is used throughout these view layers to rasterize as images.
84+
corners or gradients), and images. rasterizeNode() is used throughout these view layers to rasterize as images.
8585
* CircuitElementNumberControl (which appears at the bottom of the screen when a CircuitElement is selected) and
8686
ValueNode.js (which shows a text readout over an item when "values" is checked) use a similar pattern of containing
8787
logic for the different kinds of CircuitElements. Other ways to solve this may have been:

js/view/ACVoltageNode.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import PlusNode from '../../../scenery-phet/js/PlusNode.js';
1515
import Circle from '../../../scenery/js/nodes/Circle.js';
1616
import Node from '../../../scenery/js/nodes/Node.js';
1717
import Path from '../../../scenery/js/nodes/Path.js';
18-
import { rasterized } from '../../../scenery/js/util/rasterized.js';
18+
import { rasterizeNode } from '../../../scenery/js/util/rasterizeNode.js';
1919
import type Tandem from '../../../tandem/js/Tandem.js';
2020
import CCKCConstants from '../CCKCConstants.js';
2121
import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js';
@@ -78,8 +78,8 @@ const createNode = ( schematic: boolean ) => new Node( {
7878
} ) ]
7979
]
8080
} );
81-
const schematicNode = rasterized( createNode( true ), { wrap: false, resolution: 2 } );
82-
const lifelikeNode = rasterized( createNode( false ), { wrap: false, resolution: 2 } );
81+
const schematicNode = rasterizeNode( createNode( true ), { wrap: false, resolution: 2 } );
82+
const lifelikeNode = rasterizeNode( createNode( false ), { wrap: false, resolution: 2 } );
8383

8484
// Expand the pointer areas with a defensive copy, see https://github.com/phetsims/circuit-construction-kit-common/issues/310
8585
schematicNode.mouseArea = Shape.circle(

js/view/BatteryNode.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { combineOptions } from '../../../phet-core/js/optionize.js';
1313
import Image from '../../../scenery/js/nodes/Image.js';
1414
import Path from '../../../scenery/js/nodes/Path.js';
1515
import Color from '../../../scenery/js/util/Color.js';
16-
import { rasterized } from '../../../scenery/js/util/rasterized.js';
16+
import { rasterizeNode } from '../../../scenery/js/util/rasterizeNode.js';
1717
import type Tandem from '../../../tandem/js/Tandem.js';
1818
import battery_png from '../../images/battery_png.js';
1919
import batteryHigh_png from '../../images/batteryHigh_png.js';
@@ -51,7 +51,7 @@ const schematicScale = desiredWidth / schematicWidth;
5151

5252
// Scale to fit the correct width
5353
schematicShape = schematicShape.transformed( Matrix3.scale( schematicScale, schematicScale ) );
54-
const schematicNode = rasterized( new Path( schematicShape, {
54+
const schematicNode = rasterizeNode( new Path( schematicShape, {
5555
stroke: Color.BLACK,
5656
lineWidth: CCKCConstants.SCHEMATIC_LINE_WIDTH
5757
} ), { wrap: false } );

js/view/ChargeNode.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Utils from '../../../dot/js/Utils.js';
1313
import Shape from '../../../kite/js/Shape.js';
1414
import ElectronChargeNode from '../../../scenery-phet/js/ElectronChargeNode.js';
1515
import Node from '../../../scenery/js/nodes/Node.js';
16-
import { rasterized } from '../../../scenery/js/util/rasterized.js';
16+
import { rasterizeNode } from '../../../scenery/js/util/rasterizeNode.js';
1717
import Tandem from '../../../tandem/js/Tandem.js';
1818
import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js';
1919
import Capacitor from '../model/Capacitor.js';
@@ -25,7 +25,7 @@ import type CircuitNode from './CircuitNode.js';
2525
import ConventionalCurrentArrowNode from './ConventionalCurrentArrowNode.js';
2626

2727
// constants
28-
const ELECTRON_CHARGE_NODE = rasterized( new ElectronChargeNode( {
28+
const ELECTRON_CHARGE_NODE = rasterizeNode( new ElectronChargeNode( {
2929

3030
// Electrons are transparent to convey they are a representation rather than physical objects
3131
// Workaround for https://github.com/phetsims/circuit-construction-kit-dc/issues/160
@@ -36,13 +36,13 @@ const ELECTRON_CHARGE_NODE = rasterized( new ElectronChargeNode( {
3636
scale: 0.78
3737
} ), { wrap: false } );
3838

39-
const INITIAL_ARROW_NODE = rasterized( new ConventionalCurrentArrowNode( Tandem.OPT_OUT ), { wrap: false } );
39+
const INITIAL_ARROW_NODE = rasterizeNode( new ConventionalCurrentArrowNode( Tandem.OPT_OUT ), { wrap: false } );
4040

4141
const arrowNode = new Node( { children: [ INITIAL_ARROW_NODE ] } );
4242

4343
Multilink.multilink( [ CCKCColors.conventionalCurrentArrowFillProperty, CCKCColors.conventionalCurrentArrowStrokeProperty ],
4444
( arrowFill, arrowStroke ) => {
45-
arrowNode.children = [ rasterized( new ConventionalCurrentArrowNode( Tandem.OPT_OUT ), { wrap: false } ) ];
45+
arrowNode.children = [ rasterizeNode( new ConventionalCurrentArrowNode( Tandem.OPT_OUT ), { wrap: false } ) ];
4646
} );
4747

4848
// Below this amperage, no conventional current will be rendered.

js/view/SeriesAmmeterNode.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import MathSymbols from '../../../scenery-phet/js/MathSymbols.js';
1313
import Node from '../../../scenery/js/nodes/Node.js';
1414
import Rectangle, { type RectangleOptions } from '../../../scenery/js/nodes/Rectangle.js';
1515
import Text from '../../../scenery/js/nodes/Text.js';
16-
import { rasterized } from '../../../scenery/js/util/rasterized.js';
16+
import { rasterizeNode } from '../../../scenery/js/util/rasterizeNode.js';
1717
import Panel from '../../../sun/js/Panel.js';
1818
import type Tandem from '../../../tandem/js/Tandem.js';
1919
import CCKCConstants from '../CCKCConstants.js';
@@ -43,7 +43,7 @@ const CORNER_RADIUS = 4;
4343
* Rasterize so it can be rendered in WebGL, see https://github.com/phetsims/circuit-construction-kit-dc/issues/67
4444
* @param [providedOptions]
4545
*/
46-
const createPanel = ( providedOptions?: RectangleOptions ) => rasterized( new Rectangle( 0, 0, PANEL_WIDTH, PANEL_HEIGHT, providedOptions ), { wrap: false } );
46+
const createPanel = ( providedOptions?: RectangleOptions ) => rasterizeNode( new Rectangle( 0, 0, PANEL_WIDTH, PANEL_HEIGHT, providedOptions ), { wrap: false } );
4747

4848
const orangeBackgroundPanel = createPanel( { cornerRadius: CORNER_RADIUS, fill: ORANGE } );
4949
const blackBorder = createPanel( {

js/view/SolderNode.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import type Vector2 from '../../../dot/js/Vector2.js';
1010
import Circle from '../../../scenery/js/nodes/Circle.js';
1111
import Node from '../../../scenery/js/nodes/Node.js';
12-
import { rasterized } from '../../../scenery/js/util/rasterized.js';
12+
import { rasterizeNode } from '../../../scenery/js/util/rasterizeNode.js';
1313
import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js';
1414
import type Vertex from '../model/Vertex.js';
1515
import type CircuitNode from './CircuitNode.js';
@@ -21,7 +21,7 @@ const SOLDER_COLOR = '#ae9f9e';
2121
const SOLDER_RADIUS = 11.2;
2222

2323
// {Image} raster created by init() for WebGL usage
24-
const CIRCLE_NODE = rasterized( new Circle( SOLDER_RADIUS, { fill: SOLDER_COLOR } ), { wrap: false } );
24+
const CIRCLE_NODE = rasterizeNode( new Circle( SOLDER_RADIUS, { fill: SOLDER_COLOR } ), { wrap: false } );
2525

2626
export default class SolderNode extends Node {
2727
public readonly vertex: Vertex;

js/view/SwitchNode.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import Rectangle from '../../../scenery/js/nodes/Rectangle.js';
1717
import Color from '../../../scenery/js/util/Color.js';
1818
import type Gradient from '../../../scenery/js/util/Gradient.js';
1919
import LinearGradient from '../../../scenery/js/util/LinearGradient.js';
20-
import { rasterized } from '../../../scenery/js/util/rasterized.js';
20+
import { rasterizeNode } from '../../../scenery/js/util/rasterizeNode.js';
2121
import type Tandem from '../../../tandem/js/Tandem.js';
2222
import CCKCConstants from '../CCKCConstants.js';
2323
import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js';
@@ -138,18 +138,18 @@ const createNode = function( viewType: CircuitElementViewType, fill: Gradient |
138138
const lifelikeOpenNode = createNode(
139139
CircuitElementViewType.LIFELIKE, lifelikeGradient, LIFELIKE_DIAMETER, 6, false
140140
);
141-
const lifelikeOpenImage = rasterized( lifelikeOpenNode, { wrap: false } );
141+
const lifelikeOpenImage = rasterizeNode( lifelikeOpenNode, { wrap: false } );
142142

143143
const lifelikeClosedNode = createNode(
144144
CircuitElementViewType.LIFELIKE, lifelikeGradient, LIFELIKE_DIAMETER, 6, true
145145
);
146-
const lifelikeClosedImage = rasterized( lifelikeClosedNode, { wrap: false } );
146+
const lifelikeClosedImage = rasterizeNode( lifelikeClosedNode, { wrap: false } );
147147

148-
const schematicOpenImage = rasterized( createNode(
148+
const schematicOpenImage = rasterizeNode( createNode(
149149
CircuitElementViewType.SCHEMATIC, Color.BLACK, CCKCConstants.SCHEMATIC_LINE_WIDTH, 0, false
150150
), { wrap: false } );
151151

152-
const schematicClosedImage = rasterized( createNode(
152+
const schematicClosedImage = rasterizeNode( createNode(
153153
CircuitElementViewType.SCHEMATIC, Color.BLACK, CCKCConstants.SCHEMATIC_LINE_WIDTH, 0, true
154154
), { wrap: false } );
155155

js/view/VertexNode.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import Node from '../../../scenery/js/nodes/Node.js';
1717
import Text from '../../../scenery/js/nodes/Text.js';
1818
import SceneryConstants from '../../../scenery/js/SceneryConstants.js';
1919
import Color from '../../../scenery/js/util/Color.js';
20-
import { rasterized } from '../../../scenery/js/util/rasterized.js';
20+
import { rasterizeNode } from '../../../scenery/js/util/rasterizeNode.js';
2121
import type Tandem from '../../../tandem/js/Tandem.js';
2222
import CCKCConstants from '../CCKCConstants.js';
2323
import CCKCQueryParameters from '../CCKCQueryParameters.js';
@@ -38,10 +38,10 @@ const CIRCLE_OPTIONS = {
3838
lineWidth: 1.3,
3939
lineDash: [ 6, 4 ]
4040
};
41-
const RED_CIRCLE_NODE = rasterized( new Circle( VERTEX_RADIUS, combineOptions<CircleOptions>( {
41+
const RED_CIRCLE_NODE = rasterizeNode( new Circle( VERTEX_RADIUS, combineOptions<CircleOptions>( {
4242
stroke: Color.RED
4343
}, CIRCLE_OPTIONS ) ), { wrap: false } );
44-
const BLACK_CIRCLE_NODE = rasterized( new Circle( VERTEX_RADIUS, combineOptions<CircleOptions>( {
44+
const BLACK_CIRCLE_NODE = rasterizeNode( new Circle( VERTEX_RADIUS, combineOptions<CircleOptions>( {
4545
stroke: Color.BLACK
4646
}, CIRCLE_OPTIONS ) ), { wrap: false } );
4747

js/view/WireNode.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import Node from '../../../scenery/js/nodes/Node.js';
1818
import Path from '../../../scenery/js/nodes/Path.js';
1919
import Color from '../../../scenery/js/util/Color.js';
2020
import LinearGradient from '../../../scenery/js/util/LinearGradient.js';
21-
import { rasterized } from '../../../scenery/js/util/rasterized.js';
21+
import { rasterizeNode } from '../../../scenery/js/util/rasterizeNode.js';
2222
import type Tandem from '../../../tandem/js/Tandem.js';
2323
import CCKCConstants from '../CCKCConstants.js';
2424
import circuitConstructionKitCommon from '../circuitConstructionKitCommon.js';
@@ -40,13 +40,13 @@ const MATRIX = new Matrix3(); // The Matrix entries are mutable
4040
const WIRE_RASTER_LENGTH = 100;
4141

4242
// Node used to render the black line for schematic, rasterized so it can render with WebGL
43-
const BLACK_LINE_NODE = rasterized( new Line( 0, 0, WIRE_RASTER_LENGTH, 0, {
43+
const BLACK_LINE_NODE = rasterizeNode( new Line( 0, 0, WIRE_RASTER_LENGTH, 0, {
4444
lineWidth: SCHEMATIC_LINE_WIDTH,
4545
stroke: Color.BLACK
4646
} ), { wrap: false } );
4747

4848
// Not displayed, used to get accurate hit bounds for the schematic view.
49-
const SCHEMATIC_BACKGROUND = rasterized( new Line( 0, 0, WIRE_RASTER_LENGTH, 0, {
49+
const SCHEMATIC_BACKGROUND = rasterizeNode( new Line( 0, 0, WIRE_RASTER_LENGTH, 0, {
5050
lineWidth: LIFELIKE_LINE_WIDTH,
5151
stroke: Color.BLUE,
5252
opacity: 0.0
@@ -76,23 +76,23 @@ const colorStops = [
7676
const normalGradient = createGradient( colorStops, _.identity );
7777
const reverseGradient = createGradient( colorStops.reverse(), ( e: number ) => 1.0 - e );
7878

79-
const lifelikeNodeNormal = rasterized( new Line( 0, 0, WIRE_RASTER_LENGTH, 0, {
79+
const lifelikeNodeNormal = rasterizeNode( new Line( 0, 0, WIRE_RASTER_LENGTH, 0, {
8080
lineWidth: LIFELIKE_LINE_WIDTH,
8181
stroke: normalGradient
8282
} ), { wrap: false } );
8383

84-
const lifelikeNodeReversed = rasterized( new Line( 0, 0, WIRE_RASTER_LENGTH, 0, {
84+
const lifelikeNodeReversed = rasterizeNode( new Line( 0, 0, WIRE_RASTER_LENGTH, 0, {
8585
lineWidth: LIFELIKE_LINE_WIDTH,
8686
stroke: reverseGradient
8787
} ), { wrap: false } );
8888

8989
// Make sure the heights are the same as the wires so they will line up properly, see
9090
// https://github.com/phetsims/circuit-construction-kit-common/issues/390
91-
const lifelikeRoundedCapNormal = rasterized( new Circle( LIFELIKE_LINE_WIDTH / 2, {
91+
const lifelikeRoundedCapNormal = rasterizeNode( new Circle( LIFELIKE_LINE_WIDTH / 2, {
9292
fill: normalGradient
9393
} ), { wrap: false } );
9494

95-
const lifelikeRoundedCapReversed = rasterized( new Circle( LIFELIKE_LINE_WIDTH / 2, {
95+
const lifelikeRoundedCapReversed = rasterizeNode( new Circle( LIFELIKE_LINE_WIDTH / 2, {
9696
fill: reverseGradient
9797
} ), { wrap: false } );
9898

0 commit comments

Comments
 (0)