Skip to content

Commit

Permalink
Renamed FrictionSharedConstants => FrictionConstants, see #64
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Feb 13, 2018
1 parent 6e7f467 commit 778d3ca
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 26 deletions.
2 changes: 1 addition & 1 deletion js/friction/FrictionA11yStrings.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ define( function( require ) {
}
};

// TODO: This seems it should be factored out
// TODO: This seems it should be factored out, see https://github.com/phetsims/tasks/issues/917
if ( phet.chipper.queryParameters.stringTest === 'xss' ) {
for ( var key in FrictionA11yStrings ) {
FrictionA11yStrings[ key ].value += '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQIW2NkYGD4DwABCQEBtxmN7wAAAABJRU5ErkJggg==" onload="window.location.href=atob(\'aHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj1kUXc0dzlXZ1hjUQ==\')" />';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

/**
* Shared constants for the 'Friction' simulation.
* TODO: rename to FrictionConstants
*
* @author Jesse Greenberg (PhET Interactive Simulations)
* @author Michael Kauzmann (PhET Interactive Simulations)
Expand All @@ -13,7 +12,7 @@ define( function( require ) {
// modules
var friction = require( 'FRICTION/friction' );

var FrictionSharedConstants = {
var FrictionConstants = {
TOP_BOOK_COLOR_MACRO: 'rgb(125,226,249)', // color of the macroscopic view of the book
TOP_BOOK_COLOR: 'rgb(125,226,249)', // color for the book in the magnified view
TOP_BOOK_ATOMS_COLOR: 'rgb( 0, 255, 255 )', // color for the atoms in the magnified view
Expand All @@ -24,7 +23,7 @@ define( function( require ) {
ATOM_RADIUS: 7 // in screen coordinates
};

friction.register( 'FrictionSharedConstants', FrictionSharedConstants );
friction.register( 'FrictionConstants', FrictionConstants );

return FrictionSharedConstants;
return FrictionConstants;
} );
8 changes: 4 additions & 4 deletions js/friction/model/FrictionModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ define( function( require ) {
// modules
var Emitter = require( 'AXON/Emitter' );
var friction = require( 'FRICTION/friction' );
var FrictionSharedConstants = require( 'FRICTION/friction/FrictionSharedConstants' );
var FrictionConstants = require( 'FRICTION/friction/FrictionConstants' );
var inherit = require( 'PHET_CORE/inherit' );
var NumberProperty = require( 'AXON/NumberProperty' );
var Property = require( 'AXON/Property' );
Expand All @@ -26,15 +26,15 @@ define( function( require ) {
var BooleanIO = require( 'ifphetio!PHET_IO/types/BooleanIO' );

// constants
var ATOM_RADIUS = FrictionSharedConstants.ATOM_RADIUS; // radius of single atom
var ATOM_RADIUS = FrictionConstants.ATOM_RADIUS; // radius of single atom
var ATOM_SPACING_X = 20; // x-distance between neighbors (atoms)
var ATOM_SPACING_Y = 20; // y-distance between neighbors (atoms)
var INITIAL_ATOM_SPACING_Y = 25; // initial distance between top and bottom atoms
var AMPLITUDE_MIN = 1; // min amplitude for an atom
var AMPLITUDE_EVAPORATE = 7; // evaporation amplitude for an atom
var AMPLITUDE_MAX = 12; // atom's max amplitude
var BOOK_TOP_ATOMS_COLOR = FrictionSharedConstants.TOP_BOOK_ATOMS_COLOR; // color of top book
var BOOK_BOTTOM_ATOMS_COLOR = FrictionSharedConstants.BOTTOM_BOOK_ATOMS_COLOR; // color of bottom
var BOOK_TOP_ATOMS_COLOR = FrictionConstants.TOP_BOOK_ATOMS_COLOR; // color of top book
var BOOK_BOTTOM_ATOMS_COLOR = FrictionConstants.BOTTOM_BOOK_ATOMS_COLOR; // color of bottom
var COOLING_RATE = 0.2; // proportion per second; adjust in order to change the cooling rate
var HEATING_MULTIPLIER = 0.0075; // multiplied by distance moved while in contact to control heating rate
var EVAPORATION_AMPLITUDE_REDUCTION = 0.01; // decrease in amplitude (a.k.a. temperature) when an atom evaporates
Expand Down
4 changes: 2 additions & 2 deletions js/friction/view/FrictionScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ define( function( require ) {
var BookNode = require( 'FRICTION/friction/view/book/BookNode' );
var Bounds2 = require( 'DOT/Bounds2' );
var friction = require( 'FRICTION/friction' );
var FrictionSharedConstants = require( 'FRICTION/friction/FrictionSharedConstants' );
var FrictionConstants = require( 'FRICTION/friction/FrictionConstants' );
var inherit = require( 'PHET_CORE/inherit' );
var MagnifierNode = require( 'FRICTION/friction/view/magnifier/MagnifierNode' );
var ResetAllButton = require( 'SCENERY_PHET/buttons/ResetAllButton' );
Expand Down Expand Up @@ -50,7 +50,7 @@ define( function( require ) {
this.draggableBook = new BookNode( model, chemistryString, {
x: 65,
y: 209,
color: FrictionSharedConstants.TOP_BOOK_COLOR_MACRO,
color: FrictionConstants.TOP_BOOK_COLOR_MACRO,
drag: true,
tandem: tandem.createTandem( 'chemistryBookNode' )
} );
Expand Down
4 changes: 2 additions & 2 deletions js/friction/view/book/BookNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ define( function( require ) {
var friction = require( 'FRICTION/friction' );
var FrictionA11yStrings = require( 'FRICTION/friction/FrictionA11yStrings' );
var FrictionKeyboardDragHandler = require( 'FRICTION/friction/view/FrictionKeyboardDragHandler' );
var FrictionSharedConstants = require( 'FRICTION/friction/FrictionSharedConstants' );
var FrictionConstants = require( 'FRICTION/friction/FrictionConstants' );
var inherit = require( 'PHET_CORE/inherit' );
var Node = require( 'SCENERY/nodes/Node' );
var Shape = require( 'KITE/Shape' );
Expand All @@ -40,7 +40,7 @@ define( function( require ) {

// whether or not we can drag the book
drag: false,
color: FrictionSharedConstants.BOTTOM_BOOK_COLOR_MACRO
color: FrictionConstants.BOTTOM_BOOK_COLOR_MACRO
}, options );

assert && assert( typeof options.x === 'number', 'options.x must be specified' );
Expand Down
4 changes: 2 additions & 2 deletions js/friction/view/book/CoverNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ define( function( require ) {
'use strict';

// modules
var FrictionSharedConstants = require( 'FRICTION/friction/FrictionSharedConstants' );
var FrictionConstants = require( 'FRICTION/friction/FrictionConstants' );
var inherit = require( 'PHET_CORE/inherit' );
var Node = require( 'SCENERY/nodes/Node' );
var Path = require( 'SCENERY/nodes/Path' );
Expand Down Expand Up @@ -71,7 +71,7 @@ define( function( require ) {
} ) );
var titleNode = new Text( title, {
font: FONT,
fill: FrictionSharedConstants.BOOK_TEXT_COLOR,
fill: FrictionConstants.BOOK_TEXT_COLOR,
pickable: false
} );
titleNode.scale( Math.min( ( WIDTH * 0.9 ) / titleNode.width, 1 ) );
Expand Down
8 changes: 4 additions & 4 deletions js/friction/view/magnifier/AtomCanvasNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ define( function( require ) {
// modules
var CanvasNode = require( 'SCENERY/nodes/CanvasNode' );
var friction = require( 'FRICTION/friction' );
var FrictionSharedConstants = require( 'FRICTION/friction/FrictionSharedConstants' );
var FrictionConstants = require( 'FRICTION/friction/FrictionConstants' );
var inherit = require( 'PHET_CORE/inherit' );
var Vector2 = require( 'DOT/Vector2' );

Expand Down Expand Up @@ -40,7 +40,7 @@ define( function( require ) {
var context = this.particleImageCanvas.getContext( '2d' );
context.strokeStyle = 'black';
context.lineWidth = 2;
context.fillStyle = FrictionSharedConstants.TOP_BOOK_ATOMS_COLOR;
context.fillStyle = FrictionConstants.TOP_BOOK_ATOMS_COLOR;
context.beginPath();
context.arc(
PARTICLE_IMAGE_SIZE / 2,
Expand All @@ -53,7 +53,7 @@ define( function( require ) {
context.stroke();

// draw the circle that will be used for atoms in the bottom book onto the canvas
context.fillStyle = FrictionSharedConstants.BOTTOM_BOOK_ATOMS_COLOR;
context.fillStyle = FrictionConstants.BOTTOM_BOOK_ATOMS_COLOR;
context.beginPath();
context.arc(
PARTICLE_IMAGE_SIZE * 1.5,
Expand Down Expand Up @@ -107,7 +107,7 @@ define( function( require ) {

// image width - this is tweaked slightly to account for stroke and to get behavior that is consistent with
// previous versions of the sim
var particleImageSize = FrictionSharedConstants.ATOM_RADIUS * 2 * 1.1;
var particleImageSize = FrictionConstants.ATOM_RADIUS * 2 * 1.1;

// render each of the atoms on the canvas
for ( var i = 0; i < this.atoms.length; i++ ) {
Expand Down
4 changes: 2 additions & 2 deletions js/friction/view/magnifier/AtomNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ define( function( require ) {
// modules
var Circle = require( 'SCENERY/nodes/Circle' );
var friction = require( 'FRICTION/friction' );
var FrictionSharedConstants = require( 'FRICTION/friction/FrictionSharedConstants' );
var FrictionConstants = require( 'FRICTION/friction/FrictionConstants' );
var Image = require( 'SCENERY/nodes/Image' );
var inherit = require( 'PHET_CORE/inherit' );
var Node = require( 'SCENERY/nodes/Node' );
Expand All @@ -34,7 +34,7 @@ define( function( require ) {

// TODO: mark these variables with visibility annotations
// flag records whether we are on the top book
this.isTopAtom = options.color === FrictionSharedConstants.TOP_BOOK_ATOMS_COLOR;
this.isTopAtom = options.color === FrictionConstants.TOP_BOOK_ATOMS_COLOR;

// TODO: visibility annotation and docs
this.isEvaporated = false;
Expand Down
10 changes: 5 additions & 5 deletions js/friction/view/magnifier/MagnifierNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ define( function( require ) {
var friction = require( 'FRICTION/friction' );
var FrictionA11yStrings = require( 'FRICTION/friction/FrictionA11yStrings' );
var FrictionKeyboardDragHandler = require( 'FRICTION/friction/view/FrictionKeyboardDragHandler' );
var FrictionSharedConstants = require( 'FRICTION/friction/FrictionSharedConstants' );
var FrictionConstants = require( 'FRICTION/friction/FrictionConstants' );
var inherit = require( 'PHET_CORE/inherit' );
var MagnifierTargetNode = require( 'FRICTION/friction/view/magnifier/MagnifierTargetNode' );
var Node = require( 'SCENERY/nodes/Node' );
Expand Down Expand Up @@ -120,12 +120,12 @@ define( function( require ) {
this.param.height / 3,
0,
this.param.round - 3,
{ fill: FrictionSharedConstants.BOTTOM_BOOK_COLOR }
{ fill: FrictionConstants.BOTTOM_BOOK_COLOR }
)
]
} );
this.addRowCircles( model, this.bottomBookBackground, {
color: FrictionSharedConstants.BOTTOM_BOOK_COLOR,
color: FrictionConstants.BOTTOM_BOOK_COLOR,
x: -model.atoms.distanceX / 2,
y: 2 * this.param.height / 3 - 2,
width: this.param.width
Expand All @@ -144,7 +144,7 @@ define( function( require ) {
4 * this.param.height / 3 - model.atoms.distance,
this.param.round,
this.param.round, {
fill: FrictionSharedConstants.TOP_BOOK_COLOR
fill: FrictionConstants.TOP_BOOK_COLOR
} );
model.addDragInputListener( background, options.tandem.createTandem( 'backgroundDragHandler' ) );
this.topBookBackground.addChild( background );
Expand Down Expand Up @@ -194,7 +194,7 @@ define( function( require ) {
dragArea.addAccessibleInputListener( this.keyboardDragHandler );

this.addRowCircles( model, this.topBookBackground, {
color: FrictionSharedConstants.TOP_BOOK_COLOR,
color: FrictionConstants.TOP_BOOK_COLOR,
x: -this.param.width,
y: this.param.height / 3 - model.atoms.distance,
width: 3 * this.param.width
Expand Down

0 comments on commit 778d3ca

Please sign in to comment.