Skip to content

Commit

Permalink
Rename from simColorProfileProperty to SimColors.js, see phetsims/sce…
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Jul 28, 2021
1 parent a7d5ca0 commit 4e7f362
Show file tree
Hide file tree
Showing 16 changed files with 90 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const WHITE = new Color( 255, 255, 255 );
const RED = new Color( 255, 0, 0 );
const BLUE = new Color( 0, 0, 255 );

const chargesAndFieldsColorProfile = {
const ChargesAndFieldsColors = {
backgroundProperty: new ProfileColorProperty( 'background', {
default: BLACK,
projector: WHITE
Expand Down Expand Up @@ -157,6 +157,6 @@ const chargesAndFieldsColorProfile = {
} )
};

chargesAndFields.register( 'chargesAndFieldsColorProfile', chargesAndFieldsColorProfile );
chargesAndFields.register( 'ChargesAndFieldsColors', ChargesAndFieldsColors );

export default chargesAndFieldsColorProfile;
export default ChargesAndFieldsColors;
4 changes: 2 additions & 2 deletions js/charges-and-fields/ChargesAndFieldsScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import Screen from '../../../joist/js/Screen.js';
import chargesAndFields from '../chargesAndFields.js';
import chargesAndFieldsColorProfile from './chargesAndFieldsColorProfile.js';
import ChargesAndFieldsColors from './ChargesAndFieldsColors.js';
import ChargesAndFieldsModel from './model/ChargesAndFieldsModel.js';
import ChargesAndFieldsScreenView from './view/ChargesAndFieldsScreenView.js';

Expand All @@ -17,7 +17,7 @@ class ChargesAndFieldsScreen extends Screen {
*/
constructor( tandem ) {
const options = {
backgroundColorProperty: chargesAndFieldsColorProfile.backgroundProperty,
backgroundColorProperty: ChargesAndFieldsColors.backgroundProperty,
tandem: tandem
};

Expand Down
12 changes: 6 additions & 6 deletions js/charges-and-fields/view/ChargesAndFieldsControlPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Checkbox from '../../../../sun/js/Checkbox.js';
import Panel from '../../../../sun/js/Panel.js';
import chargesAndFieldsStrings from '../../chargesAndFieldsStrings.js';
import chargesAndFields from '../../chargesAndFields.js';
import chargesAndFieldsColorProfile from '../chargesAndFieldsColorProfile.js';
import ChargesAndFieldsColors from '../ChargesAndFieldsColors.js';
import ChargesAndFieldsConstants from '../ChargesAndFieldsConstants.js';

const directionOnlyString = chargesAndFieldsStrings.directionOnly;
Expand Down Expand Up @@ -42,16 +42,16 @@ class ChargesAndFieldsControlPanel extends Panel {
function createCheckbox( tandemId, string, property ) {
const text = new Text( string, {
font: ChargesAndFieldsConstants.CHECKBOX_FONT,
fill: chargesAndFieldsColorProfile.controlPanelTextProperty,
fill: ChargesAndFieldsColors.controlPanelTextProperty,
maxWidth: 250
} );

return new Checkbox( text, property, {
tandem: tandem.createTandem( tandemId ),
boxWidth: 25,
spacing: 7,
checkboxColor: chargesAndFieldsColorProfile.checkboxProperty,
checkboxColorBackground: chargesAndFieldsColorProfile.checkboxBackgroundProperty
checkboxColor: ChargesAndFieldsColors.checkboxProperty,
checkboxColorBackground: ChargesAndFieldsColors.checkboxBackgroundProperty
} );
}

Expand Down Expand Up @@ -102,8 +102,8 @@ class ChargesAndFieldsControlPanel extends Panel {
lineWidth: ChargesAndFieldsConstants.PANEL_LINE_WIDTH,
xMargin: 12,
yMargin: 10,
fill: chargesAndFieldsColorProfile.controlPanelFillProperty,
stroke: chargesAndFieldsColorProfile.controlPanelBorderProperty,
fill: ChargesAndFieldsColors.controlPanelFillProperty,
stroke: ChargesAndFieldsColors.controlPanelBorderProperty,
tandem: tandem
} );

Expand Down
20 changes: 10 additions & 10 deletions js/charges-and-fields/view/ChargesAndFieldsScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import Utils from '../../../../scenery/js/util/Utils.js';
import RectangularPushButton from '../../../../sun/js/buttons/RectangularPushButton.js';
import PhetioGroup from '../../../../tandem/js/PhetioGroup.js';
import chargesAndFields from '../../chargesAndFields.js';
import chargesAndFieldsColorProfile from '../chargesAndFieldsColorProfile.js';
import ChargesAndFieldsColors from '../ChargesAndFieldsColors.js';
import ChargesAndFieldsConstants from '../ChargesAndFieldsConstants.js';
import ChargedParticleNode from './ChargedParticleNode.js';
import ChargesAndFieldsControlPanel from './ChargesAndFieldsControlPanel.js';
Expand Down Expand Up @@ -183,7 +183,7 @@ class ChargesAndFieldsScreenView extends ScreenView {
tandem.createTandem( 'measuringTapeNode' ) );

// The color of measurement text of the measuring tape updates itself when the projector/default color scheme changes
chargesAndFieldsColorProfile.measuringTapeTextProperty.linkAttribute( measuringTapeNode, 'textColor' );
ChargesAndFieldsColors.measuringTapeTextProperty.linkAttribute( measuringTapeNode, 'textColor' );

// Create the toolboxPanel with the measuring tape and the electric potential sensor icons
const toolboxPanel = new ChargesAndFieldsToolboxPanel(
Expand Down Expand Up @@ -434,9 +434,9 @@ class ChargesAndFieldsScreenView extends ScreenView {
distance = ELECTRIC_POTENTIAL_POSITIVE_LINEAR_FUNCTION( electricPotential );
finalColor = this.interpolateRGBA(
// {Color} color that corresponds to the Electric Potential being zero
chargesAndFieldsColorProfile.electricPotentialGridZeroProperty.get(),
ChargesAndFieldsColors.electricPotentialGridZeroProperty.get(),
// {Color} color of Max Electric Potential
chargesAndFieldsColorProfile.electricPotentialGridSaturationPositiveProperty.get(),
ChargesAndFieldsColors.electricPotentialGridSaturationPositiveProperty.get(),
distance, // {number} distance must be between 0 and 1
options );
}
Expand All @@ -447,9 +447,9 @@ class ChargesAndFieldsScreenView extends ScreenView {
distance = ELECTRIC_POTENTIAL_NEGATIVE_LINEAR_FUNCTION( electricPotential );
finalColor = this.interpolateRGBA(
// {Color} color that corresponds to the lowest (i.e. negative) Electric Potential
chargesAndFieldsColorProfile.electricPotentialGridSaturationNegativeProperty.get(),
ChargesAndFieldsColors.electricPotentialGridSaturationNegativeProperty.get(),
// {Color} color that corresponds to the Electric Potential being zero zero
chargesAndFieldsColorProfile.electricPotentialGridZeroProperty.get(),
ChargesAndFieldsColors.electricPotentialGridZeroProperty.get(),
distance, // {number} distance must be between 0 and 1
options );
}
Expand All @@ -458,8 +458,8 @@ class ChargesAndFieldsScreenView extends ScreenView {

/**
* Function that returns a color that is proportional to the magnitude of the electric Field.
* The color interpolates between chargesAndFieldsColorProfile.electricFieldGridZero (for an
* electric field value of zero) and chargesAndFieldsColorProfile.electricFieldGridSaturation (which corresponds to an
* The color interpolates between ChargesAndFieldsColors.electricFieldGridZero (for an
* electric field value of zero) and ChargesAndFieldsColors.electricFieldGridSaturation (which corresponds to an
* electric field value of EFIELD_COLOR_SAT_MAGNITUDE).
* @private
* @param {number} electricFieldMagnitude - a non negative number
Expand All @@ -473,8 +473,8 @@ class ChargesAndFieldsScreenView extends ScreenView {
const distance = ELECTRIC_FIELD_LINEAR_FUNCTION( electricFieldMagnitude ); // a value between 0 and 1

return this.interpolateRGBA(
chargesAndFieldsColorProfile.electricFieldGridZeroProperty.get(), // {Color} color that corresponds to zero electric Field
chargesAndFieldsColorProfile.electricFieldGridSaturationProperty.get(), // {Color} color that corresponds to the largest electric field
ChargesAndFieldsColors.electricFieldGridZeroProperty.get(), // {Color} color that corresponds to zero electric Field
ChargesAndFieldsColors.electricFieldGridSaturationProperty.get(), // {Color} color that corresponds to the largest electric field
distance, // {number} distance must be between 0 and 1
options );
}
Expand Down
14 changes: 7 additions & 7 deletions js/charges-and-fields/view/ChargesAndFieldsToolboxPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import Panel from '../../../../sun/js/Panel.js';
import electricPotentialPanelOutlineImage from '../../../mipmaps/electricPotentialPanelOutline_png.js';
import chargesAndFieldsStrings from '../../chargesAndFieldsStrings.js';
import chargesAndFields from '../../chargesAndFields.js';
import chargesAndFieldsColorProfile from '../chargesAndFieldsColorProfile.js';
import ChargesAndFieldsColors from '../ChargesAndFieldsColors.js';
import ChargesAndFieldsConstants from '../ChargesAndFieldsConstants.js';

// constants
Expand Down Expand Up @@ -69,8 +69,8 @@ class ChargesAndFieldsToolboxPanel extends Panel {
lineWidth: ChargesAndFieldsConstants.PANEL_LINE_WIDTH,
xMargin: 12,
yMargin: 10,
fill: chargesAndFieldsColorProfile.controlPanelFillProperty,
stroke: chargesAndFieldsColorProfile.controlPanelBorderProperty,
fill: ChargesAndFieldsColors.controlPanelFillProperty,
stroke: ChargesAndFieldsColors.controlPanelBorderProperty,
tandem: tandem
};

Expand Down Expand Up @@ -149,7 +149,7 @@ class ChargesAndFieldsToolboxPanel extends Panel {
lineWidth: 2,
centerX: 0,
centerY: 0,
stroke: chargesAndFieldsColorProfile.electricPotentialSensorCrosshairStrokeProperty
stroke: ChargesAndFieldsColors.electricPotentialSensorCrosshairStrokeProperty
} );

// Create the crosshair
Expand All @@ -160,14 +160,14 @@ class ChargesAndFieldsToolboxPanel extends Panel {
const crosshair = new Path( crosshairShape, {
centerX: 0,
centerY: 0,
stroke: chargesAndFieldsColorProfile.electricPotentialSensorCrosshairStrokeProperty
stroke: ChargesAndFieldsColors.electricPotentialSensorCrosshairStrokeProperty
} );

// Create the base of the crosshair
// TODO: why is the fill the same as the stroke?
const crosshairMount = new Rectangle( 0, 0, 0.4 * CIRCLE_RADIUS, 0.4 * CIRCLE_RADIUS, {
fill: chargesAndFieldsColorProfile.electricPotentialSensorCrosshairStrokeProperty,
stroke: chargesAndFieldsColorProfile.electricPotentialSensorCrosshairStrokeProperty,
fill: ChargesAndFieldsColors.electricPotentialSensorCrosshairStrokeProperty,
stroke: ChargesAndFieldsColors.electricPotentialSensorCrosshairStrokeProperty,
tandem: tandem.createTandem( 'crosshairMount' )
} );

Expand Down
8 changes: 4 additions & 4 deletions js/charges-and-fields/view/ChargesAndSensorsPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Text from '../../../../scenery/js/nodes/Text.js';
import Panel from '../../../../sun/js/Panel.js';
import chargesAndFieldsStrings from '../../chargesAndFieldsStrings.js';
import chargesAndFields from '../../chargesAndFields.js';
import chargesAndFieldsColorProfile from '../chargesAndFieldsColorProfile.js';
import ChargesAndFieldsColors from '../ChargesAndFieldsColors.js';
import ChargesAndFieldsConstants from '../ChargesAndFieldsConstants.js';
import ChargedParticleRepresentationNode from './ChargedParticleRepresentationNode.js';
import ElectricFieldSensorRepresentationNode from './ElectricFieldSensorRepresentationNode.js';
Expand Down Expand Up @@ -61,7 +61,7 @@ class ChargesAndSensorsPanel extends Panel {
function createDraggableItem( itemTandem, label, createModelElement, previewNode, isVisibleProperty ) {
const labelText = new Text( label, {
font: ChargesAndFieldsConstants.ENCLOSURE_LABEL_FONT,
fill: chargesAndFieldsColorProfile.enclosureTextProperty,
fill: ChargesAndFieldsColors.enclosureTextProperty,
centerX: 0,
maxWidth: 200
} );
Expand Down Expand Up @@ -151,8 +151,8 @@ class ChargesAndSensorsPanel extends Panel {
super( hboxContent, {
lineWidth: ChargesAndFieldsConstants.PANEL_LINE_WIDTH,
cornerRadius: 5,
stroke: chargesAndFieldsColorProfile.enclosureBorderProperty,
fill: chargesAndFieldsColorProfile.enclosureFillProperty,
stroke: ChargesAndFieldsColors.enclosureBorderProperty,
fill: ChargesAndFieldsColors.enclosureFillProperty,
xMargin: HORIZONTAL_SPACING / 2,
yMargin: Y_MARGIN,
tandem: tandem
Expand Down
10 changes: 5 additions & 5 deletions js/charges-and-fields/view/ElectricFieldArrowCanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import Emitter from '../../../../axon/js/Emitter.js';
import Bounds2 from '../../../../dot/js/Bounds2.js';
import chargesAndFields from '../../chargesAndFields.js';
import chargesAndFieldsColorProfile from '../chargesAndFieldsColorProfile.js';
import ChargesAndFieldsColors from '../ChargesAndFieldsColors.js';
import ElectricFieldArrowShape from './ElectricFieldArrowShape.js';

// Our shape that we'll use to draw (origin is where it will rotate)
Expand Down Expand Up @@ -46,11 +46,11 @@ function draw() {

context.beginPath();
arrowShape.writeToContext( context );
context.fillStyle = chargesAndFieldsColorProfile.electricFieldGridSaturationProperty.get().toCSS();
context.fillStyle = ChargesAndFieldsColors.electricFieldGridSaturationProperty.get().toCSS();
context.fill();

context.lineWidth = 0.5;
context.strokeStyle = chargesAndFieldsColorProfile.electricFieldGridSaturationStrokeProperty.get().toCSS();
context.strokeStyle = ChargesAndFieldsColors.electricFieldGridSaturationStrokeProperty.get().toCSS();
context.stroke();

context.restore();
Expand All @@ -60,8 +60,8 @@ function draw() {

// Draw immediately, and update on any color profile changes
draw();
chargesAndFieldsColorProfile.electricFieldGridSaturationProperty.link( draw );
chargesAndFieldsColorProfile.electricFieldGridSaturationStrokeProperty.link( draw );
ChargesAndFieldsColors.electricFieldGridSaturationProperty.link( draw );
ChargesAndFieldsColors.electricFieldGridSaturationStrokeProperty.link( draw );

const ElectricFieldArrowCanvas = {
// @public {number} - Scale that was applied to the ArrowShape. Presumably un-scale by this amount.
Expand Down
4 changes: 2 additions & 2 deletions js/charges-and-fields/view/ElectricFieldCanvasNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Utils from '../../../../dot/js/Utils.js';
import Vector2 from '../../../../dot/js/Vector2.js';
import CanvasNode from '../../../../scenery/js/nodes/CanvasNode.js';
import chargesAndFields from '../../chargesAndFields.js';
import chargesAndFieldsColorProfile from '../chargesAndFieldsColorProfile.js';
import ChargesAndFieldsColors from '../ChargesAndFieldsColors.js';
import ChargesAndFieldsConstants from '../ChargesAndFieldsConstants.js';
import ChargeTracker from './ChargeTracker.js';
import ElectricFieldArrowCanvas from './ElectricFieldArrowCanvas.js';
Expand Down Expand Up @@ -52,7 +52,7 @@ class ElectricFieldCanvasNode extends CanvasNode {
// Invalidate paint on a bunch of changes
const invalidateSelfListener = this.invalidatePaint.bind( this );

chargesAndFieldsColorProfile.electricFieldGridSaturationProperty.link( invalidateSelfListener ); // color change
ChargesAndFieldsColors.electricFieldGridSaturationProperty.link( invalidateSelfListener ); // color change

isVisibleProperty.link( invalidateSelfListener ); // visibility change

Expand Down
10 changes: 5 additions & 5 deletions js/charges-and-fields/view/ElectricFieldSensorNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import Node from '../../../../scenery/js/nodes/Node.js';
import Text from '../../../../scenery/js/nodes/Text.js';
import chargesAndFields from '../../chargesAndFields.js';
import chargesAndFieldsStrings from '../../chargesAndFieldsStrings.js';
import chargesAndFieldsColorProfile from '../chargesAndFieldsColorProfile.js';
import ChargesAndFieldsColors from '../ChargesAndFieldsColors.js';
import ChargesAndFieldsConstants from '../ChargesAndFieldsConstants.js';
import ElectricFieldSensorRepresentationNode from './ElectricFieldSensorRepresentationNode.js';

Expand Down Expand Up @@ -68,22 +68,22 @@ class ElectricFieldSensorNode extends ElectricFieldSensorRepresentationNode {
// TODO: why is the fill and stroke set to the same value?
const arrowNode = new ArrowNode( 0, 0, 1, 0, {
pickable: false,
stroke: chargesAndFieldsColorProfile.electricFieldSensorArrowProperty,
fill: chargesAndFieldsColorProfile.electricFieldSensorArrowProperty,
stroke: ChargesAndFieldsColors.electricFieldSensorArrowProperty,
fill: ChargesAndFieldsColors.electricFieldSensorArrowProperty,
tandem: tandem.createTandem( 'arrowNode' )
} );

// Create two numerical readouts for the strength and direction of the electric field.
const fieldStrengthLabel = new Text( '', {
font: LABEL_FONT,
pickable: false,
fill: chargesAndFieldsColorProfile.electricFieldSensorLabelProperty,
fill: ChargesAndFieldsColors.electricFieldSensorLabelProperty,
tandem: tandem.createTandem( 'fieldStrengthLabel' )
} );
const directionLabel = new Text( '', {
font: LABEL_FONT,
pickable: false,
fill: chargesAndFieldsColorProfile.electricFieldSensorLabelProperty,
fill: ChargesAndFieldsColors.electricFieldSensorLabelProperty,
tandem: tandem.createTandem( 'directionLabel' )
} );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Circle from '../../../../scenery/js/nodes/Circle.js';
import Node from '../../../../scenery/js/nodes/Node.js';
import chargesAndFields from '../../chargesAndFields.js';
import chargesAndFieldsColorProfile from '../chargesAndFieldsColorProfile.js';
import ChargesAndFieldsColors from '../ChargesAndFieldsColors.js';
import ChargesAndFieldsConstants from '../ChargesAndFieldsConstants.js';

// constants
Expand All @@ -30,8 +30,8 @@ class ElectricFieldSensorRepresentationNode extends Node {
const circle = new Circle( CIRCLE_RADIUS, {
centerX: 0,
centerY: 0,
fill: chargesAndFieldsColorProfile.electricFieldSensorCircleFillProperty,
stroke: chargesAndFieldsColorProfile.electricFieldSensorCircleStrokeProperty
fill: ChargesAndFieldsColors.electricFieldSensorCircleFillProperty,
stroke: ChargesAndFieldsColors.electricFieldSensorCircleStrokeProperty
} );

// add circle
Expand Down
14 changes: 7 additions & 7 deletions js/charges-and-fields/view/ElectricPotentialCanvasNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Vector2 from '../../../../dot/js/Vector2.js';
import CanvasNode from '../../../../scenery/js/nodes/CanvasNode.js';
import chargesAndFields from '../../chargesAndFields.js';
import chargesAndFieldsColorProfile from '../chargesAndFieldsColorProfile.js';
import ChargesAndFieldsColors from '../ChargesAndFieldsColors.js';
import ChargesAndFieldsConstants from '../ChargesAndFieldsConstants.js';
import ChargeTracker from './ChargeTracker.js';

Expand Down Expand Up @@ -42,9 +42,9 @@ class ElectricPotentialCanvasNode extends CanvasNode {

// Invalidate paint on a bunch of changes
const invalidateSelfListener = this.forceRepaint.bind( this );
chargesAndFieldsColorProfile.electricPotentialGridZeroProperty.link( invalidateSelfListener );
chargesAndFieldsColorProfile.electricPotentialGridSaturationPositiveProperty.link( invalidateSelfListener );
chargesAndFieldsColorProfile.electricPotentialGridSaturationNegativeProperty.link( invalidateSelfListener );
ChargesAndFieldsColors.electricPotentialGridZeroProperty.link( invalidateSelfListener );
ChargesAndFieldsColors.electricPotentialGridSaturationPositiveProperty.link( invalidateSelfListener );
ChargesAndFieldsColors.electricPotentialGridSaturationNegativeProperty.link( invalidateSelfListener );
isVisibleProperty.link( invalidateSelfListener ); // visibility change

// particle added
Expand Down Expand Up @@ -137,9 +137,9 @@ class ElectricPotentialCanvasNode extends CanvasNode {

// Update our direct canvas if necessary
if ( numChanges || this.directCanvasDirty ) {
const zeroColor = chargesAndFieldsColorProfile.electricPotentialGridZeroProperty.get();
const positiveColor = chargesAndFieldsColorProfile.electricPotentialGridSaturationPositiveProperty.get();
const negativeColor = chargesAndFieldsColorProfile.electricPotentialGridSaturationNegativeProperty.get();
const zeroColor = ChargesAndFieldsColors.electricPotentialGridZeroProperty.get();
const positiveColor = ChargesAndFieldsColors.electricPotentialGridSaturationPositiveProperty.get();
const negativeColor = ChargesAndFieldsColors.electricPotentialGridSaturationNegativeProperty.get();
const data = this.imageData.data;

for ( let k = 0; k < this.electricPotentials.length; k++ ) {
Expand Down
Loading

0 comments on commit 4e7f362

Please sign in to comment.