Running "find-duplicates" task info: Preprocessors running time: durationMs=29472 info: Scanning 3813 files for duplicates... info: Scanning for duplicates time: durationMs=57223 info: Scanning... done! info: Start report generation... info: Found 475 exact clones with 9125 duplicated lines in 434 files - ..\acid-base-solutions\js\mysolution\view\ConcentrationSlider.js: 5-21 ..\acid-base-solutions\js\mysolution\view\StrengthSlider.js: 5-21 5 │ 5 │ * 6 │ 6 │ * @author Andrey Zelenkov (Mlearner) 7 │ 7 │ * @author Chris Malley (PixelZoom, Inc.) 8 │ 8 │ */ 9 │ 9 │ define( function( require ) { 10 │ 10 │ 'use strict'; 11 │ 11 │ 12 │ 12 │ // modules 13 │ 13 │ var acidBaseSolutions = require( 'ACID_BASE_SOLUTIONS/acidBaseSolutions' ); 14 │ 14 │ var Dimension2 = require( 'DOT/Dimension2' ); 15 │ 15 │ var HSlider = require( 'SUN/HSlider' ); 16 │ 16 │ var inherit = require( 'PHET_CORE/inherit' ); 17 │ 17 │ var PhetFont = require( 'SCENERY_PHET/PhetFont' ); 18 │ 18 │ var Property = require( 'AXON/Property' ); 19 │ 19 │ var RangeWithValue = require( 'DOT/RangeWithValue' ); 20 │ 20 │ var Text = require( 'SCENERY/nodes/Text' ); 21 │ 21 │ var Util = require( 'DOT/Util' ); - ..\area-builder\js\game\model\AreaBuilderChallengeFactory.js: 138-156 ..\area-builder\js\game\model\AreaBuilderChallengeFactory.js: 163-181 138 │ 163 │ new Color( AreaBuilderSharedConstants.DARK_GREEN_COLOR ) 139 │ 164 │ ] ), 140 │ 165 │ index: 0, 141 │ 166 │ nextColor: function() { 142 │ 167 │ if ( this.index >= this.colorList.length ) { 143 │ 168 │ // Time to shuffle the color list. Make sure that when we do, the color that was at the end of the previous 144 │ 169 │ // list isn't at the beginning of this one, or we'll get two of the same colors in a row. 145 │ 170 │ var lastColor = this.colorList[ this.colorList.length - 1 ]; 146 │ 171 │ do { 147 │ 172 │ this.colorList = random.shuffle( this.colorList ); 148 │ 173 │ } while ( this.colorList[ 0 ] === lastColor ); 149 │ 174 │ 150 │ 175 │ // Reset the index. 151 │ 176 │ this.index = 0; 152 │ 177 │ } 153 │ 178 │ return this.colorList[ this.index++ ]; 154 │ 179 │ } 155 │ 180 │ }; 156 │ 181 │ - ..\area-builder\js\game\model\AreaBuilderChallengeFactory.js: 686-696 ..\area-builder\js\game\model\AreaBuilderChallengeFactory.js: 762-772 686 │ 762 │ var holeXOffset = random.nextIntBetween( 1, width - holeWidth - 1 ); 687 │ 763 │ var holeYOffset = random.nextIntBetween( 1, height - holeHeight - 1 ); 688 │ 764 │ var perimeterShape = createPerimeterShapeWithHole( 0, 0, width * UNIT_SQUARE_LENGTH, height * UNIT_SQUARE_LENGTH, 689 │ 765 │ holeWidth * UNIT_SQUARE_LENGTH, holeHeight * UNIT_SQUARE_LENGTH, holeXOffset * UNIT_SQUARE_LENGTH, 690 │ 766 │ holeYOffset * UNIT_SQUARE_LENGTH, FIND_THE_AREA_COLOR_CHOOSER.nextColor() ); 691 │ 767 │ 692 │ 768 │ return AreaBuilderGameChallenge.createFindAreaChallenge( perimeterShape, BASIC_RECTANGLES_SHAPE_KIT ); 693 │ 769 │ } 694 │ 770 │ 695 │ 771 │ function generateIsoscelesRightTriangleSlantedHypotenuseFindAreaChallenge() { 696 │ 772 │ var cornerPosition = randomElement( [ 'leftTop', 'rightTop', 'rightBottom', 'leftBottom' ] ); - ..\area-builder\js\game\view\GameIconFactory.js: 81-95 ..\area-builder\js\game\view\GameIconFactory.js: 123-137 81 │ 123 │ new Vector2( 5, 3 ), 82 │ 124 │ new Vector2( 3, 4 ), 83 │ 125 │ new Vector2( 4, 4 ), 84 │ 126 │ new Vector2( 5, 4 ), 85 │ 127 │ new Vector2( 5, 5 ), 86 │ 128 │ new Vector2( 5, 6 ), 87 │ 129 │ new Vector2( 2, 7 ), 88 │ 130 │ new Vector2( 3, 7 ), 89 │ 131 │ new Vector2( 4, 7 ), 90 │ 132 │ new Vector2( 5, 7 ) 91 │ 133 │ ]; 92 │ 134 │ break; 93 │ 135 │ 94 │ 136 │ case 4: 95 │ 137 │ color = AreaBuilderSharedConstants.DARK_GREEN_COLOR; - ..\area-builder\js\game\view\GameIconFactory.js: 115-128 ..\area-builder\js\game\view\GameIconFactory.js: 137-150 115 │ 137 │ color = AreaBuilderSharedConstants.PURPLISH_COLOR; 116 │ 138 │ occupiedCells = [ 117 │ 139 │ new Vector2( 2, 1 ), 118 │ 140 │ new Vector2( 3, 1 ), 119 │ 141 │ new Vector2( 4, 1 ), 120 │ 142 │ new Vector2( 5, 1 ), 121 │ 143 │ new Vector2( 2, 2 ), 122 │ 144 │ new Vector2( 2, 3 ), 123 │ 145 │ new Vector2( 2, 4 ), 124 │ 146 │ new Vector2( 3, 4 ), 125 │ 147 │ new Vector2( 4, 4 ), 126 │ 148 │ new Vector2( 5, 4 ), 127 │ 149 │ new Vector2( 5, 5 ), 128 │ 150 │ new Vector2( 5, 6 ), - ..\area-builder\js\area-builder-config.js: 10-43 ..\arithmetic\js\arithmetic-config.js: 11-44 10 │ 11 │ deps: [ 'area-builder-main' ], 11 │ 12 │ 12 │ 13 │ paths: { 13 │ 14 │ 14 │ 15 │ // third-party libs 15 │ 16 │ text: '../../sherpa/lib/text-2.0.12', 16 │ 17 │ 17 │ 18 │ // PhET plugins 18 │ 19 │ audio: '../../chipper/js/requirejs-plugins/audio', 19 │ 20 │ image: '../../chipper/js/requirejs-plugins/image', 20 │ 21 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 21 │ 22 │ string: '../../chipper/js/requirejs-plugins/string', 22 │ 23 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 23 │ 24 │ 24 │ 25 │ // PhET libs, uppercase names to identify them in require.js imports 25 │ 26 │ AXON: '../../axon/js', 26 │ 27 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 27 │ 28 │ DOT: '../../dot/js', 28 │ 29 │ JOIST: '../../joist/js', 29 │ 30 │ KITE: '../../kite/js', 30 │ 31 │ PHET_CORE: '../../phet-core/js', 31 │ 32 │ PHET_IO: '../../phet-io/js', 32 │ 33 │ PHETCOMMON: '../../phetcommon/js', 33 │ 34 │ REPOSITORY: '..', 34 │ 35 │ SCENERY: '../../scenery/js', 35 │ 36 │ SCENERY_PHET: '../../scenery-phet/js', 36 │ 37 │ SHERPA: '../../sherpa', 37 │ 38 │ SUN: '../../sun/js', 38 │ 39 │ TANDEM: '../../tandem/js', 39 │ 40 │ VIBE: '../../vibe/js', 40 │ 41 │ VEGAS: '../../vegas/js', 41 │ 42 │ 42 │ 43 │ // this sim 43 │ 44 │ AREA_BUILDER: '.' - ..\arithmetic\js\divide\model\DivideModel.js: 105-117 ..\arithmetic\js\multiply\model\MultiplyModel.js: 84-96 105 │ 84 │ self.activeLevelModel.currentScore += self.problemModel.possiblePoints; 106 │ 85 │ self.activeLevelModel.displayScore = self.activeLevelModel.currentScore; 107 │ 86 │ self.activeLevelModel.markCellAsUsed( self.problemModel.multiplicand, self.problemModel.multiplier ); 108 │ 87 │ self.state = GameState.DISPLAYING_CORRECT_ANSWER_FEEDBACK; 109 │ 88 │ self.nextProblem(); 110 │ 89 │ } ); 111 │ 90 │ 112 │ 91 │ // restore the original sound state 113 │ 92 │ ArithmeticGlobals.soundEnabledProperty.value = soundState; 114 │ 93 │ } 115 │ 94 │ } ); 116 │ 95 │ 117 │ 96 │ } ); - ..\axon\js\Events.js: 251-270 ..\axon\js\Events.js: 289-308 251 │ 289 │ assert && assert( arguments.length === 1 ); 252 │ 290 │ assert && assert( typeof eventName === 'string', 'eventName should be a string' ); 253 │ 291 │ 254 │ 292 │ var listeners = this._eventListeners[ eventName ]; 255 │ 293 │ var staticListeners = this._staticEventListeners[ eventName ]; 256 │ 294 │ 257 │ 295 │ // listener quantities for normal and static 258 │ 296 │ var count = listeners ? listeners.length : 0; 259 │ 297 │ var staticCount = staticListeners ? staticListeners.length : 0; 260 │ 298 │ 261 │ 299 │ // make a copy of non-static listeners, in case callback removes listener 262 │ 300 │ if ( count > 0 ) { 263 │ 301 │ listeners = listeners.slice(); 264 │ 302 │ } 265 │ 303 │ 266 │ 304 │ var i; 267 │ 305 │ 268 │ 306 │ for ( i = 0; i < count; i++ ) { 269 │ 307 │ listeners[ i ](); 270 │ 308 │ - ..\axon\js\Events.js: 251-270 ..\axon\js\Events.js: 328-347 251 │ 328 │ assert && assert( arguments.length === 1 ); 252 │ 329 │ assert && assert( typeof eventName === 'string', 'eventName should be a string' ); 253 │ 330 │ 254 │ 331 │ var listeners = this._eventListeners[ eventName ]; 255 │ 332 │ var staticListeners = this._staticEventListeners[ eventName ]; 256 │ 333 │ 257 │ 334 │ // listener quantities for normal and static 258 │ 335 │ var count = listeners ? listeners.length : 0; 259 │ 336 │ var staticCount = staticListeners ? staticListeners.length : 0; 260 │ 337 │ 261 │ 338 │ // make a copy of non-static listeners, in case callback removes listener 262 │ 339 │ if ( count > 0 ) { 263 │ 340 │ listeners = listeners.slice(); 264 │ 341 │ } 265 │ 342 │ 266 │ 343 │ var i; 267 │ 344 │ 268 │ 345 │ for ( i = 0; i < count; i++ ) { 269 │ 346 │ listeners[ i ](); 270 │ 347 │ - ..\balancing-act\js\balancelab\view\GirlCreatorNode.js: 14-33 ..\balancing-act\js\balancelab\view\ManCreatorNode.js: 14-33 14 │ 14 │ var Girl = require( 'BALANCING_ACT/common/model/masses/Girl' ); 15 │ 15 │ var inherit = require( 'PHET_CORE/inherit' ); 16 │ 16 │ var ImageMassCreatorNode = require( 'BALANCING_ACT/balancelab/view/ImageMassCreatorNode' ); 17 │ 17 │ var ImageMassNode = require( 'BALANCING_ACT/common/view/ImageMassNode' ); 18 │ 18 │ var ModelViewTransform2 = require( 'PHETCOMMON/view/ModelViewTransform2' ); 19 │ 19 │ var Property = require( 'AXON/Property' ); 20 │ 20 │ var Vector2 = require( 'DOT/Vector2' ); 21 │ 21 │ 22 │ 22 │ // Model-view transform for scaling the node used in the tool box. This 23 │ 23 │ // may scale the node differently than what is used in the model so that 24 │ 24 │ // items in the tool box can be sized differently (generally smaller). 25 │ 25 │ var SCALING_MVT = ModelViewTransform2.createOffsetScaleMapping( Vector2.ZERO, 80 ); 26 │ 26 │ 27 │ 27 │ /** 28 │ 28 │ * @param {BalanceLabModel} model 29 │ 29 │ * @param {ModelViewTransform2} modelViewTransform 30 │ 30 │ * @constructor 31 │ 31 │ */ 32 │ 32 │ function GirlCreatorNode( model, modelViewTransform ) { 33 │ 33 │ ImageMassCreatorNode.call( this, model, modelViewTransform, new Girl(), true ); - ..\balancing-act\js\balancelab\view\GirlCreatorNode.js: 14-33 ..\balancing-act\js\balancelab\view\WomanCreatorNode.js: 14-33 14 │ 14 │ var Girl = require( 'BALANCING_ACT/common/model/masses/Girl' ); 15 │ 15 │ var inherit = require( 'PHET_CORE/inherit' ); 16 │ 16 │ var ImageMassCreatorNode = require( 'BALANCING_ACT/balancelab/view/ImageMassCreatorNode' ); 17 │ 17 │ var ImageMassNode = require( 'BALANCING_ACT/common/view/ImageMassNode' ); 18 │ 18 │ var ModelViewTransform2 = require( 'PHETCOMMON/view/ModelViewTransform2' ); 19 │ 19 │ var Property = require( 'AXON/Property' ); 20 │ 20 │ var Vector2 = require( 'DOT/Vector2' ); 21 │ 21 │ 22 │ 22 │ // Model-view transform for scaling the node used in the tool box. This 23 │ 23 │ // may scale the node differently than what is used in the model so that 24 │ 24 │ // items in the tool box can be sized differently (generally smaller). 25 │ 25 │ var SCALING_MVT = ModelViewTransform2.createOffsetScaleMapping( Vector2.ZERO, 80 ); 26 │ 26 │ 27 │ 27 │ /** 28 │ 28 │ * @param {BalanceLabModel} model 29 │ 29 │ * @param {ModelViewTransform2} modelViewTransform 30 │ 30 │ * @constructor 31 │ 31 │ */ 32 │ 32 │ function GirlCreatorNode( model, modelViewTransform ) { 33 │ 33 │ ImageMassCreatorNode.call( this, model, modelViewTransform, new Girl(), true ); - ..\balancing-act\js\common\view\LevelSupportColumnNode.js: 29-68 ..\balancing-act\js\common\view\TiltedSupportColumnNode.js: 30-69 29 │ 30 │ var transformedColumnShape = modelViewTransform.modelToViewShape( levelSupportColumn.shape ); 30 │ 31 │ var mainBodyGradient = new LinearGradient( transformedColumnShape.bounds.minX, 0, transformedColumnShape.bounds.maxX, 0 ). 31 │ 32 │ addColorStop( 0, 'rgb( 150, 150, 150 )' ). 32 │ 33 │ addColorStop( 0.25, 'rgb( 230, 230, 230 )' ). 33 │ 34 │ addColorStop( 0.65, 'rgb( 150, 150, 150 )' ). 34 │ 35 │ addColorStop( 1, 'rgb( 200, 200, 200 )' ); 35 │ 36 │ 36 │ 37 │ var columnNode = new Path( transformedColumnShape, 37 │ 38 │ { 38 │ 39 │ fill: mainBodyGradient, 39 │ 40 │ stroke: 'black', 40 │ 41 │ lineWidth: 1 41 │ 42 │ } ); 42 │ 43 │ self.addChild( columnNode ); 43 │ 44 │ 44 │ 45 │ // Create and add the column support. 45 │ 46 │ var supportWidth = transformedColumnShape.bounds.width * 1.3; // Empirically determined. 46 │ 47 │ var supportHeight = transformedColumnShape.bounds.height * 0.15; // Empirically determined. 47 │ 48 │ var supportGradient = new LinearGradient( transformedColumnShape.bounds.centerX - supportWidth / 2, 0, transformedColumnShape.bounds.centerX + supportWidth / 2, 0 ). 48 │ 49 │ addColorStop( 0, 'rgb( 150, 150, 150 )' ). 49 │ 50 │ addColorStop( 0.25, 'rgb( 210, 210, 210 )' ). 50 │ 51 │ addColorStop( 0.65, 'rgb( 150, 150, 150 )' ). 51 │ 52 │ addColorStop( 1, 'rgb( 170, 170, 170 )' ); 52 │ 53 │ var columnSupportNode = new Rectangle( 53 │ 54 │ transformedColumnShape.bounds.centerX - supportWidth / 2, 54 │ 55 │ transformedColumnShape.bounds.maxY - supportHeight, 55 │ 56 │ supportWidth, 56 │ 57 │ supportHeight, 57 │ 58 │ 3, 58 │ 59 │ 3, 59 │ 60 │ { 60 │ 61 │ fill: supportGradient, 61 │ 62 │ stroke: 'black', 62 │ 63 │ lineWidth: 1 63 │ 64 │ } ); 64 │ 65 │ self.addChild( columnSupportNode ); 65 │ 66 │ 66 │ 67 │ columnState.link( function( state ) { 67 │ 68 │ self.visible = state === 'doubleColumns'; 68 │ 69 │ } ); - ..\balancing-act\js\game\model\BalanceGameChallengeFactory.js: 514-522 ..\balancing-act\js\game\model\BalanceGameChallengeFactory.js: 541-549 514 │ 541 │ generateEasyMassDeductionChallenge: function() { 515 │ 542 │ var indexOffset = this.randInt( BALANCE_CHALLENGE_MASSES.length ); 516 │ 543 │ var knownMass = null; 517 │ 544 │ var mysteryMassPrototype = null; 518 │ 545 │ 519 │ 546 │ for ( var i = 0; i < MYSTERY_MASSES.length && knownMass === null; i++ ) { 520 │ 547 │ mysteryMassPrototype = MYSTERY_MASSES[ ( i + indexOffset ) % MYSTERY_MASSES.length ]; 521 │ 548 │ knownMass = this.createMassByRatio( mysteryMassPrototype.massValue, [ 2, 0.5 ] ); 522 │ 549 │ } - ..\area-builder\js\game\view\StartGameLevelNode.js: 14-27 ..\balancing-act\js\game\view\StartGameLevelNode.js: 12-25 14 │ 12 │ var AreaBuilderSharedConstants = require( 'AREA_BUILDER/common/AreaBuilderSharedConstants' ); 15 │ 13 │ var inherit = require( 'PHET_CORE/inherit' ); 16 │ 14 │ var LevelSelectionButton = require( 'VEGAS/LevelSelectionButton' ); 17 │ 15 │ var Node = require( 'SCENERY/nodes/Node' ); 18 │ 16 │ var PhetFont = require( 'SCENERY_PHET/PhetFont' ); 19 │ 17 │ var ResetAllButton = require( 'SCENERY_PHET/buttons/ResetAllButton' ); 20 │ 18 │ var SoundToggleButton = require( 'SCENERY_PHET/buttons/SoundToggleButton' ); 21 │ 19 │ var Text = require( 'SCENERY/nodes/Text' ); 22 │ 20 │ var TimerToggleButton = require( 'SCENERY_PHET/buttons/TimerToggleButton' ); 23 │ 21 │ var Vector2 = require( 'DOT/Vector2' ); 24 │ 22 │ 25 │ 23 │ // strings 26 │ 24 │ var chooseYourLevelString = require( 'string!AREA_BUILDER/chooseYourLevel' ); 27 │ 25 │ - ..\area-builder\js\game\view\StartGameLevelNode.js: 59-84 ..\balancing-act\js\game\view\StartGameLevelNode.js: 57-82 59 │ 57 │ }, options ); 60 │ 58 │ 61 │ 59 │ // Verify parameters 62 │ 60 │ if ( iconNodes.length !== options.numLevels || scores.length !== options.numLevels ) { 63 │ 61 │ throw new Error( 'Number of game levels doesn\'t match length of provided arrays' ); 64 │ 62 │ } 65 │ 63 │ 66 │ 64 │ // Title 67 │ 65 │ var title = new Text( options.titleString, { font: new PhetFont( 30 ), maxWidth: options.maxTitleWidth } ); 68 │ 66 │ this.addChild( title ); 69 │ 67 │ 70 │ 68 │ // Add the buttons 71 │ 69 │ function createLevelStartFunction( level ) { 72 │ 70 │ return function() { startLevelFunction( level ); }; 73 │ 71 │ } 74 │ 72 │ 75 │ 73 │ var buttons = new Array( options.numLevels ); 76 │ 74 │ for ( var i = 0; i < options.numLevels; i++ ) { 77 │ 75 │ buttons[ i ] = new LevelSelectionButton( 78 │ 76 │ iconNodes[ i ], 79 │ 77 │ options.numStarsOnButtons, 80 │ 78 │ createLevelStartFunction( i ), 81 │ 79 │ scores[ i ], 82 │ 80 │ options.perfectScore, 83 │ 81 │ { 84 │ 82 │ baseColor: options.buttonBackgroundColor - ..\area-builder\js\game\view\StartGameLevelNode.js: 104-113 ..\balancing-act\js\game\view\StartGameLevelNode.js: 96-105 104 │ 96 │ var resetButton = new ResetAllButton( { listener: resetFunction, radius: 22, touchAreaDilation: 7 } ); 105 │ 97 │ this.addChild( resetButton ); 106 │ 98 │ 107 │ 99 │ // Layout 108 │ 100 │ var numColumns = options.numLevels / options.numButtonRows; 109 │ 101 │ var buttonSpacingX = buttons[ 0 ].width * 1.2; // Note: Assumes all buttons are the same size. 110 │ 102 │ var buttonSpacingY = buttons[ 0 ].height * 1.2; // Note: Assumes all buttons are the same size. 111 │ 103 │ var firstButtonOrigin = new Vector2( options.size.width / 2 - ( numColumns - 1 ) * buttonSpacingX / 2, 112 │ 104 │ options.size.height * 0.5 - ( ( options.numButtonRows - 1 ) * buttonSpacingY ) / 2 ); 113 │ 105 │ for ( var row = 0; row < options.numButtonRows; row++ ) { - ..\area-builder\js\game\view\StartGameLevelNode.js: 112-124 ..\balancing-act\js\game\view\StartGameLevelNode.js: 104-116 112 │ 104 │ options.size.height * 0.5 - ( ( options.numButtonRows - 1 ) * buttonSpacingY ) / 2 ); 113 │ 105 │ for ( var row = 0; row < options.numButtonRows; row++ ) { 114 │ 106 │ for ( var col = 0; col < numColumns; col++ ) { 115 │ 107 │ var buttonIndex = row * numColumns + col; 116 │ 108 │ buttons[ buttonIndex ].centerX = firstButtonOrigin.x + col * buttonSpacingX; 117 │ 109 │ buttons[ buttonIndex ].centerY = firstButtonOrigin.y + row * buttonSpacingY; 118 │ 110 │ } 119 │ 111 │ } 120 │ 112 │ resetButton.right = options.size.width - options.controlsInset; 121 │ 113 │ resetButton.bottom = options.size.height - options.controlsInset; 122 │ 114 │ title.centerX = options.size.width / 2; 123 │ 115 │ title.centerY = buttons[ 0 ].top / 2; 124 │ 116 │ soundToggleButton.left = options.controlsInset; - ..\balancing-chemical-equations\js\common\view\BalanceScalesNode.js: 47-61 ..\balancing-chemical-equations\js\common\view\BarChartsNode.js: 47-61 47 │ 47 │ Node.call( this ); 48 │ 48 │ 49 │ 49 │ // Wire coefficients observer to current equation. 50 │ 50 │ var coefficientsObserver = this.updateCounts.bind( this ); 51 │ 51 │ equationProperty.link( function( newEquation, oldEquation ) { 52 │ 52 │ self.updateNode(); 53 │ 53 │ if ( oldEquation ) { oldEquation.removeCoefficientsObserver( coefficientsObserver ); } 54 │ 54 │ newEquation.addCoefficientsObserver( coefficientsObserver ); 55 │ 55 │ } ); 56 │ 56 │ 57 │ 57 │ this.mutate( options ); 58 │ 58 │ } 59 │ 59 │ 60 │ 60 │ balancingChemicalEquations.register( 'BalanceScalesNode', BalanceScalesNode ); 61 │ 61 │ - ..\balancing-chemical-equations\js\common\view\BalanceScalesNode.js: 127-141 ..\balancing-chemical-equations\js\common\view\BarChartsNode.js: 134-148 127 │ 134 │ * @private 128 │ 135 │ */ 129 │ 136 │ updateCounts: function() { 130 │ 137 │ if ( this.visible ) { 131 │ 138 │ var atomCounts = this.equationProperty.get().getAtomCounts(); 132 │ 139 │ for ( var i = 0; i < atomCounts.length; i++ ) { 133 │ 140 │ var atomCount = atomCounts[ i ]; 134 │ 141 │ this.reactantCountProperties[ atomCount.element.symbol ].set( atomCount.reactantsCount ); 135 │ 142 │ this.productCountProperties[ atomCount.element.symbol ].set( atomCount.productsCount ); 136 │ 143 │ } 137 │ 144 │ } 138 │ 145 │ } 139 │ 146 │ } ); 140 │ 147 │ } ); - ..\balancing-chemical-equations\js\common\model\MoleculeFactory.js: 13-50 ..\balancing-chemical-equations\js\game\view\BCERewardNode.js: 18-55 13 │ 18 │ var Molecule = require( 'BALANCING_CHEMICAL_EQUATIONS/common/model/Molecule' ); 14 │ 19 │ 15 │ 20 │ // modules - molecules 16 │ 21 │ var C2H2Node = require( 'NITROGLYCERIN/nodes/C2H2Node' ); 17 │ 22 │ var C2H4Node = require( 'NITROGLYCERIN/nodes/C2H4Node' ); 18 │ 23 │ var C2H5ClNode = require( 'NITROGLYCERIN/nodes/C2H5ClNode' ); 19 │ 24 │ var C2H5OHNode = require( 'NITROGLYCERIN/nodes/C2H5OHNode' ); 20 │ 25 │ var C2H6Node = require( 'NITROGLYCERIN/nodes/C2H6Node' ); 21 │ 26 │ var CH2ONode = require( 'NITROGLYCERIN/nodes/CH2ONode' ); 22 │ 27 │ var CH3OHNode = require( 'NITROGLYCERIN/nodes/CH3OHNode' ); 23 │ 28 │ var CH4Node = require( 'NITROGLYCERIN/nodes/CH4Node' ); 24 │ 29 │ var CNode = require( 'NITROGLYCERIN/nodes/CNode' ); 25 │ 30 │ var CO2Node = require( 'NITROGLYCERIN/nodes/CO2Node' ); 26 │ 31 │ var CONode = require( 'NITROGLYCERIN/nodes/CONode' ); 27 │ 32 │ var CS2Node = require( 'NITROGLYCERIN/nodes/CS2Node' ); 28 │ 33 │ var Cl2Node = require( 'NITROGLYCERIN/nodes/Cl2Node' ); 29 │ 34 │ var F2Node = require( 'NITROGLYCERIN/nodes/F2Node' ); 30 │ 35 │ var H2Node = require( 'NITROGLYCERIN/nodes/H2Node' ); 31 │ 36 │ var H2ONode = require( 'NITROGLYCERIN/nodes/H2ONode' ); 32 │ 37 │ var H2SNode = require( 'NITROGLYCERIN/nodes/H2SNode' ); 33 │ 38 │ var HClNode = require( 'NITROGLYCERIN/nodes/HClNode' ); 34 │ 39 │ var HFNode = require( 'NITROGLYCERIN/nodes/HFNode' ); 35 │ 40 │ var N2Node = require( 'NITROGLYCERIN/nodes/N2Node' ); 36 │ 41 │ var N2ONode = require( 'NITROGLYCERIN/nodes/N2ONode' ); 37 │ 42 │ var NH3Node = require( 'NITROGLYCERIN/nodes/NH3Node' ); 38 │ 43 │ var NO2Node = require( 'NITROGLYCERIN/nodes/NO2Node' ); 39 │ 44 │ var NONode = require( 'NITROGLYCERIN/nodes/NONode' ); 40 │ 45 │ var O2Node = require( 'NITROGLYCERIN/nodes/O2Node' ); 41 │ 46 │ var OF2Node = require( 'NITROGLYCERIN/nodes/OF2Node' ); 42 │ 47 │ var P4Node = require( 'NITROGLYCERIN/nodes/P4Node' ); 43 │ 48 │ var PCl3Node = require( 'NITROGLYCERIN/nodes/PCl3Node' ); 44 │ 49 │ var PCl5Node = require( 'NITROGLYCERIN/nodes/PCl5Node' ); 45 │ 50 │ var PF3Node = require( 'NITROGLYCERIN/nodes/PF3Node' ); 46 │ 51 │ var PH3Node = require( 'NITROGLYCERIN/nodes/PH3Node' ); 47 │ 52 │ var SNode = require( 'NITROGLYCERIN/nodes/SNode' ); 48 │ 53 │ var SO2Node = require( 'NITROGLYCERIN/nodes/SO2Node' ); 49 │ 54 │ var SO3Node = require( 'NITROGLYCERIN/nodes/SO3Node' ); 50 │ 55 │ - ..\balloons-and-static-electricity\js\balloons-and-static-electricity\view\MinusChargeNode.js: 4-25 ..\balloons-and-static-electricity\js\balloons-and-static-electricity\view\PlusChargeNode.js: 4-25 4 │ 4 │ * 5 │ 5 │ @author Vasily Shakhov (Mlearner) 6 │ 6 │ */ 7 │ 7 │ define( function( require ) { 8 │ 8 │ 'use strict'; 9 │ 9 │ 10 │ 10 │ // modules 11 │ 11 │ var inherit = require( 'PHET_CORE/inherit' ); 12 │ 12 │ var Node = require( 'SCENERY/nodes/Node' ); 13 │ 13 │ var Circle = require( 'SCENERY/nodes/Circle' ); 14 │ 14 │ var RadialGradient = require( 'SCENERY/util/RadialGradient' ); 15 │ 15 │ var Rectangle = require( 'SCENERY/nodes/Rectangle' ); 16 │ 16 │ var PointChargeModel = require( 'BALLOONS_AND_STATIC_ELECTRICITY/balloons-and-static-electricity/model/PointChargeModel' ); 17 │ 17 │ var Image = require( 'SCENERY/nodes/Image' ); 18 │ 18 │ var balloonsAndStaticElectricity = require( 'BALLOONS_AND_STATIC_ELECTRICITY/balloonsAndStaticElectricity' ); 19 │ 19 │ 20 │ 20 │ var radius = PointChargeModel.radius; 21 │ 21 │ 22 │ 22 │ //Scale up before rasterization so it won't be too pixellated/fuzzy 23 │ 23 │ var scale = 2; 24 │ 24 │ 25 │ 25 │ var minusChargeNode = new Node( { - ..\balloons-and-static-electricity\js\balloons-and-static-electricity\accessibility\BalloonDescriber.js: 469-487 ..\balloons-and-static-electricity\js\balloons-and-static-electricity\view\SweaterNode.js: 131-149 469 │ 131 │ var charge = Math.abs( balloon.chargeProperty.value ); 470 │ 132 │ if ( charge === 0 ) { 471 │ 133 │ chargeString = noString; 472 │ 134 │ neutralityString = neutralString; 473 │ 135 │ } 474 │ 136 │ else if ( A_FEW_RANGE.contains( charge ) ) { 475 │ 137 │ chargeString = aFewString; 476 │ 138 │ neutralityString = positiveString; 477 │ 139 │ } 478 │ 140 │ else if ( SEVERAL_RANGE.contains( charge ) ) { 479 │ 141 │ chargeString = severalString; 480 │ 142 │ neutralityString = positiveString; 481 │ 143 │ } 482 │ 144 │ else if ( MANY_RANGE.contains( charge ) ) { 483 │ 145 │ chargeString = manyString; 484 │ 146 │ neutralityString = positiveString; 485 │ 147 │ } 486 │ 148 │ 487 │ 149 │ assert && assert( chargeString, 'no description found for sweater with charge: ' + -balloon.chargeProperty.get() ); - ..\acid-base-solutions\js\acid-base-solutions-config.js: 15-36 ..\balloons-and-static-electricity\js\balloons-and-static-electricity-config.js: 16-37 15 │ 16 │ image: '../../chipper/js/requirejs-plugins/image', 16 │ 17 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 17 │ 18 │ string: '../../chipper/js/requirejs-plugins/string', 18 │ 19 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 19 │ 20 │ 20 │ 21 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 22 │ 22 │ 23 │ // PhET libs, uppercase names to identify them in require.js imports 23 │ 24 │ AXON: '../../axon/js', 24 │ 25 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 25 │ 26 │ DOT: '../../dot/js', 26 │ 27 │ JOIST: '../../joist/js', 27 │ 28 │ KITE: '../../kite/js', 28 │ 29 │ PHET_CORE: '../../phet-core/js', 29 │ 30 │ PHET_IO: '../../phet-io/js', 30 │ 31 │ PHETCOMMON: '../../phetcommon/js', 31 │ 32 │ REPOSITORY: '..', 32 │ 33 │ SCENERY: '../../scenery/js', 33 │ 34 │ SCENERY_PHET: '../../scenery-phet/js', 34 │ 35 │ SUN: '../../sun/js', 35 │ 36 │ TANDEM: '../../tandem/js', 36 │ 37 │ - ..\beers-law-lab\js\beerslaw\view\ATDetectorNode.js: 14-33 ..\beers-law-lab\js\concentration\view\ConcentrationMeterNode.js: 21-40 14 │ 21 │ var BLLConstants = require( 'BEERS_LAW_LAB/common/BLLConstants' ); 15 │ 22 │ var Bounds2 = require( 'DOT/Bounds2' ); 16 │ 23 │ var inherit = require( 'PHET_CORE/inherit' ); 17 │ 24 │ var LayoutBox = require( 'SCENERY/nodes/LayoutBox' ); 18 │ 25 │ var MovableDragHandler = require( 'SCENERY_PHET/input/MovableDragHandler' ); 19 │ 26 │ var Node = require( 'SCENERY/nodes/Node' ); 20 │ 27 │ var Path = require( 'SCENERY/nodes/Path' ); 21 │ 28 │ var PhetFont = require( 'SCENERY_PHET/PhetFont' ); 22 │ 29 │ var ProbeNode = require( 'SCENERY_PHET/ProbeNode' ); 23 │ 30 │ var ShadedRectangle = require( 'SCENERY_PHET/ShadedRectangle' ); 24 │ 31 │ var Shape = require( 'KITE/Shape' ); 25 │ 32 │ var StringUtils = require( 'PHETCOMMON/util/StringUtils' ); 26 │ 33 │ var Text = require( 'SCENERY/nodes/Text' ); 27 │ 34 │ var Util = require( 'DOT/Util' ); 28 │ 35 │ var Vector2 = require( 'DOT/Vector2' ); 29 │ 36 │ var Text = require( 'SCENERY/nodes/Text' ); 30 │ 37 │ 31 │ 38 │ // phet-io modules 32 │ 39 │ var TNode = require( 'SCENERY/nodes/TNode' ); 33 │ 40 │ - ..\beers-law-lab\js\beerslaw\view\ATDetectorNode.js: 132-145 ..\beers-law-lab\js\concentration\view\ConcentrationMeterNode.js: 173-186 132 │ 173 │ } ); 133 │ 174 │ 134 │ 175 │ // meter body 135 │ 176 │ var bodyWidth = vBox.width + ( 2 * BODY_X_MARGIN ); 136 │ 177 │ var bodyHeight = vBox.height + ( 2 * BODY_Y_MARGIN ); 137 │ 178 │ var bodyNode = new ShadedRectangle( new Bounds2( 0, 0, bodyWidth, bodyHeight ), { 138 │ 179 │ baseColor: PROBE_COLOR, 139 │ 180 │ lightOffset: 0.95 140 │ 181 │ } ); 141 │ 182 │ 142 │ 183 │ this.addChild( bodyNode ); 143 │ 184 │ this.addChild( vBox ); 144 │ 185 │ vBox.center = bodyNode.center; 145 │ 186 │ - ..\beers-law-lab\js\beerslaw\view\ATDetectorNode.js: 264-273 ..\beers-law-lab\js\concentration\view\ConcentrationMeterNode.js: 341-350 264 │ 341 │ self.shape = new Shape() 265 │ 342 │ .moveTo( bodyConnectionPoint.x, bodyConnectionPoint.y ) 266 │ 343 │ .cubicCurveTo( c1.x, c1.y, c2.x, c2.y, probeConnectionPoint.x, probeConnectionPoint.y ); 267 │ 344 │ }; 268 │ 345 │ body.locationProperty.link( updateCurve ); 269 │ 346 │ probe.locationProperty.link( updateCurve ); 270 │ 347 │ } 271 │ 348 │ 272 │ 349 │ beersLawLab.register( 'ATDetectorNode.WireNode', WireNode ); 273 │ 350 │ - ..\beers-law-lab\js\beerslaw\view\SolutionComboBox.js: 4-19 ..\beers-law-lab\js\concentration\view\SoluteComboBox.js: 4-19 4 │ 4 │ * 5 │ 5 │ * @author Chris Malley (PixelZoom, Inc.) 6 │ 6 │ */ 7 │ 7 │ define( function( require ) { 8 │ 8 │ 'use strict'; 9 │ 9 │ 10 │ 10 │ // modules 11 │ 11 │ var beersLawLab = require( 'BEERS_LAW_LAB/beersLawLab' ); 12 │ 12 │ var ComboBox = require( 'SUN/ComboBox' ); 13 │ 13 │ var inherit = require( 'PHET_CORE/inherit' ); 14 │ 14 │ var Node = require( 'SCENERY/nodes/Node' ); 15 │ 15 │ var PhetFont = require( 'SCENERY_PHET/PhetFont' ); 16 │ 16 │ var Rectangle = require( 'SCENERY/nodes/Rectangle' ); 17 │ 17 │ var StringUtils = require( 'PHETCOMMON/util/StringUtils' ); 18 │ 18 │ var SubSupText = require( 'SCENERY_PHET/SubSupText' ); 19 │ 19 │ var Text = require( 'SCENERY/nodes/Text' ); - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-44 ..\bending-light\js\bending-light-config.js: 12-45 11 │ 12 │ deps: [ 'area-model-multiplication-main' ], 12 │ 13 │ 13 │ 14 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 15 │ 15 │ 16 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 17 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 18 │ paths: { 18 │ 19 │ 19 │ 20 │ // third-party libs 20 │ 21 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 22 │ 22 │ 23 │ // PhET plugins 23 │ 24 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 25 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 26 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 27 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 28 │ 28 │ 29 │ // common directories, uppercase names to identify them in require imports 29 │ 30 │ AXON: '../../axon/js', 30 │ 31 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 32 │ DOT: '../../dot/js', 32 │ 33 │ JOIST: '../../joist/js', 33 │ 34 │ KITE: '../../kite/js', 34 │ 35 │ PHET_CORE: '../../phet-core/js', 35 │ 36 │ PHET_IO: '../../phet-io/js', 36 │ 37 │ PHETCOMMON: '../../phetcommon/js', 37 │ 38 │ REPOSITORY: '..', 38 │ 39 │ SCENERY: '../../scenery/js', 39 │ 40 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 41 │ SUN: '../../sun/js', 41 │ 42 │ TANDEM: '../../tandem/js', 42 │ 43 │ 43 │ 44 │ // this sim 44 │ 45 │ AREA_MODEL_MULTIPLICATION: '.' - ..\bending-light\js\prisms\model\Polygon.js: 113-143 ..\bending-light\js\prisms\model\SemiCircle.js: 96-126 113 │ 96 │ return new Polygon( this.referencePointIndex, newPoints, this.radius ); 114 │ 97 │ }, 115 │ 98 │ 116 │ 99 │ /** 117 │ 100 │ * Determines whether shape contains given point or not 118 │ 101 │ * @public 119 │ 102 │ * @param {Vector2} point 120 │ 103 │ * @returns {boolean} 121 │ 104 │ */ 122 │ 105 │ containsPoint: function( point ) { 123 │ 106 │ return this.shape.containsPoint( point ); 124 │ 107 │ }, 125 │ 108 │ 126 │ 109 │ /** 127 │ 110 │ * Just use the 0th point for the reference point for rotation drag handles 128 │ 111 │ * @public 129 │ 112 │ * @returns {Vector2} 130 │ 113 │ */ 131 │ 114 │ getReferencePoint: function() { 132 │ 115 │ return this.getPoint( this.referencePointIndex ); 133 │ 116 │ }, 134 │ 117 │ 135 │ 118 │ /** 136 │ 119 │ * Computes the centroid of the corner points (e.g. the center of "mass" assuming the corner points have equal 137 │ 120 │ * "mass") 138 │ 121 │ * @public 139 │ 122 │ * @returns {Vector2} 140 │ 123 │ */ 141 │ 124 │ getRotationCenter: function() { 142 │ 125 │ return this.centroid; 143 │ 126 │ }, - ..\brand\phet\js\Brand.js: 19-43 ..\brand\phet-io\js\Brand.js: 21-45 19 │ 21 │ isPhetApp: phet.chipper.queryParameters[ 'phet-app' ], 20 │ 22 │ getLinks: function( simName, locale ) { 21 │ 23 │ return [ { 22 │ 24 │ text: termsPrivacyAndLicensingString, 23 │ 25 │ url: 'http://phet.colorado.edu/en/licensing/html' 24 │ 26 │ }, { 25 │ 27 │ text: translationCreditsLinkString, 26 │ 28 │ url: 'http://phet.colorado.edu/translation-credits?simName=' + encodeURIComponent( simName ) + 27 │ 29 │ '&locale=' + encodeURIComponent( locale ) 28 │ 30 │ }, { 29 │ 31 │ text: thirdPartyCreditsLinkString, 30 │ 32 │ url: 'http://phet.colorado.edu/third-party-credits?simName=' + encodeURIComponent( simName ) + 31 │ 33 │ '&locale=' + encodeURIComponent( locale ) + '#' + simName 32 │ 34 │ } ]; 33 │ 35 │ } 34 │ 36 │ }; 35 │ 37 │ 36 │ 38 │ brand.register( 'Brand', Brand ); 37 │ 39 │ 38 │ 40 │ return Brand; 39 │ 41 │ } ); 40 │ 42 │ - ..\build-a-molecule\js\build-a-molecule-config.js: 10-51 ..\build-a-molecule\js\build-a-molecule-dev-config.js: 10-51 10 │ 10 │ deps: [ 'build-a-molecule-main' ], 11 │ 11 │ 12 │ 12 │ paths: { 13 │ 13 │ 14 │ 14 │ // require.js plugins 15 │ 15 │ audio: '../../chipper/js/requirejs-plugins/audio', 16 │ 16 │ image: '../../chipper/js/requirejs-plugins/image', 17 │ 17 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 18 │ 18 │ string: '../../chipper/js/requirejs-plugins/string', 19 │ 19 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 20 │ 20 │ 21 │ 21 │ // third-party libs 22 │ 22 │ text: '../../sherpa/lib/text-2.0.12', 23 │ 23 │ 24 │ 24 │ // PhET libs, uppercase names to identify them in require.js imports 25 │ 25 │ AXON: '../../axon/js', 26 │ 26 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 27 │ 27 │ DOT: '../../dot/js', 28 │ 28 │ JOIST: '../../joist/js', 29 │ 29 │ KITE: '../../kite/js', 30 │ 30 │ NITROGLYCERIN: '../../nitroglycerin/js', 31 │ 31 │ PHET_CORE: '../../phet-core/js', 32 │ 32 │ PHET_IO: '../../phet-io/js', 33 │ 33 │ PHETCOMMON: '../../phetcommon/js', 34 │ 34 │ REPOSITORY: '..', 35 │ 35 │ SCENERY: '../../scenery/js', 36 │ 36 │ SCENERY_PHET: '../../scenery-phet/js', 37 │ 37 │ SHERPA: '../../sherpa', 38 │ 38 │ SUN: '../../sun/js', 39 │ 39 │ TANDEM: '../../tandem/js', 40 │ 40 │ VEGAS: '../../vegas/js', 41 │ 41 │ VIBE: '../../vibe/js', 42 │ 42 │ 43 │ 43 │ BUILD_A_MOLECULE: '.' 44 │ 44 │ }, 45 │ 45 │ 46 │ 46 │ waitSeconds: 30, // because the sim's data files are big 47 │ 47 │ 48 │ 48 │ // optional cache buster to make browser refresh load all included scripts, can be disabled with ?cacheBuster=false 49 │ 49 │ urlArgs: phet.chipper.getCacheBusterArgs() 50 │ 50 │ } ); 51 │ 51 │ - ..\build-a-molecule\js\control\MultipleCollectionBoxNode.js: 5-24 ..\build-a-molecule\js\control\SingleCollectionBoxNode.js: 4-23 5 │ 4 │ * 6 │ 5 │ * @author Jonathan Olson 7 │ 6 │ */ 8 │ 7 │ 9 │ 8 │ define( function( require ) { 10 │ 9 │ 'use strict'; 11 │ 10 │ 12 │ 11 │ var buildAMolecule = require( 'BUILD_A_MOLECULE/buildAMolecule' ); 13 │ 12 │ var Bounds2 = require( 'DOT/Bounds2' ); 14 │ 13 │ var inherit = require( 'PHET_CORE/inherit' ); 15 │ 14 │ var SubSupText = require( 'SCENERY_PHET/SubSupText' ); 16 │ 15 │ var CollectionBoxNode = require( 'BUILD_A_MOLECULE/control/CollectionBoxNode' ); 17 │ 16 │ var MoleculeList = require( 'BUILD_A_MOLECULE/model/MoleculeList' ); 18 │ 17 │ var CollectionBox = require( 'BUILD_A_MOLECULE/model/CollectionBox' ); 19 │ 18 │ var StringUtils = require( 'PHETCOMMON/util/StringUtils' ); 20 │ 19 │ var PhetFont = require( 'SCENERY_PHET/PhetFont' ); 21 │ 20 │ 22 │ 21 │ // strings 23 │ 22 │ var collectionMultipleGoalFormatString = require( 'string!BUILD_A_MOLECULE/collection.multiple.goalFormat' ); 24 │ 23 │ var collectionMultipleQuantityEmptyString = require( 'string!BUILD_A_MOLECULE/collection.multiple.quantityEmpty' ); - ..\build-a-molecule\js\model\StrippedMolecule.js: 107-114 ..\build-a-molecule\js\model\StrippedMolecule.js: 143-150 107 │ 143 │ var myVisited = []; 108 │ 144 │ var otherVisited = []; 109 │ 145 │ var firstAtom = this.stripped.atoms[ 0 ]; // grab the 1st atom 110 │ 146 │ var length = other.stripped.atoms.length; 111 │ 147 │ for ( var i = 0; i < length; i++ ) { 112 │ 148 │ var otherAtom = other.stripped.atoms[ i ]; 113 │ 149 │ if ( self.checkEquivalency( other, myVisited, otherVisited, firstAtom, otherAtom, false ) ) { 114 │ 150 │ // we found an isomorphism with firstAtom => otherAtom - ..\build-a-molecule\js\model\MoleculeStructure.js: 381-392 ..\build-a-molecule\js\model\StrippedMolecule.js: 209-220 381 │ 209 │ */ 382 │ 210 │ var equivalences = new Array( size * size ); // booleans 383 │ 211 │ 384 │ 212 │ // keep track of available indices for the following matrix equivalency check 385 │ 213 │ var availableIndices = []; 386 │ 214 │ 387 │ 215 │ // for the love of god, this matrix is NOT symmetric. It computes whether each tree branch for A is equivalent to each tree branch for B 388 │ 216 │ for ( var myIndex = 0; myIndex < size; myIndex++ ) { 389 │ 217 │ availableIndices.push( myIndex ); 390 │ 218 │ for ( var otherIndex = 0; otherIndex < size; otherIndex++ ) { 391 │ 219 │ equivalences[ myIndex * size + otherIndex ] = this.checkEquivalency( other, myVisited, otherVisited, myUnvisitedNeighbors[ myIndex ], otherUnvisitedNeighbors[ otherIndex ] ); 392 │ 220 │ } - ..\build-a-molecule\js\screens\CollectMultipleScreen.js: 4-26 ..\build-a-molecule\js\screens\MakeMoleculeScreen.js: 4-26 4 │ 4 │ * 5 │ 5 │ * @author Jonathan Olson 6 │ 6 │ */ 7 │ 7 │ define( function( require ) { 8 │ 8 │ 'use strict'; 9 │ 9 │ 10 │ 10 │ var buildAMolecule = require( 'BUILD_A_MOLECULE/buildAMolecule' ); 11 │ 11 │ var inherit = require( 'PHET_CORE/inherit' ); 12 │ 12 │ var Dimension2 = require( 'DOT/Dimension2' ); 13 │ 13 │ var BAMScreen = require( 'BUILD_A_MOLECULE/screens/BAMScreen' ); 14 │ 14 │ var KitCollection = require( 'BUILD_A_MOLECULE/model/KitCollection' ); 15 │ 15 │ var Kit = require( 'BUILD_A_MOLECULE/model/Kit' ); 16 │ 16 │ var CollectionBox = require( 'BUILD_A_MOLECULE/model/CollectionBox' ); 17 │ 17 │ var MoleculeList = require( 'BUILD_A_MOLECULE/model/MoleculeList' ); 18 │ 18 │ var LayoutBounds = require( 'BUILD_A_MOLECULE/model/LayoutBounds' ); 19 │ 19 │ var Bucket = require( 'BUILD_A_MOLECULE/model/Bucket' ); 20 │ 20 │ var Element = require( 'NITROGLYCERIN/Element' ); 21 │ 21 │ var Rectangle = require( 'SCENERY/nodes/Rectangle' ); 22 │ 22 │ var MoleculeCollectingView = require( 'BUILD_A_MOLECULE/view/MoleculeCollectingView' ); 23 │ 23 │ 24 │ 24 │ // strings 25 │ 25 │ var titleCollectMultipleString = require( 'string!BUILD_A_MOLECULE/title.collectMultiple' ); 26 │ 26 │ - ..\build-a-molecule\js\screens\CollectMultipleScreen.js: 38-45 ..\build-a-molecule\js\screens\MakeMoleculeScreen.js: 42-49 38 │ 42 │ var kitCollection = new KitCollection(); 39 │ 43 │ kitCollection.addKit( new Kit( bounds, [ 40 │ 44 │ new Bucket( new Dimension2( 400, 200 ), clock, Element.H, 2 ), 41 │ 45 │ new Bucket( new Dimension2( 450, 200 ), clock, Element.O, 2 ) 42 │ 46 │ ] ) ); 43 │ 47 │ 44 │ 48 │ kitCollection.addKit( new Kit( bounds, [ 45 │ 49 │ new Bucket( new Dimension2( 500, 200 ), clock, Element.C, 2 ), - ..\build-a-molecule\js\view\AtomNode.js: 55-66 ..\build-a-molecule\js\view\AtomNode.js: 94-105 55 │ 94 │ var diameter = radius * 2; 56 │ 95 │ 57 │ 96 │ var gCenter = new Vector2( -radius / 3, -radius / 3 ); 58 │ 97 │ 59 │ 98 │ // copying ShadedSphereNode 60 │ 99 │ var middleRadius = diameter / 3; 61 │ 100 │ var fullRadius = middleRadius + 0.7 * diameter; 62 │ 101 │ 63 │ 102 │ var gradientFill = new RadialGradient( gCenter.x, gCenter.y, 0, gCenter.x, gCenter.y, fullRadius ); 64 │ 103 │ gradientFill.addColorStop( 0, '#ffffff' ); 65 │ 104 │ gradientFill.addColorStop( middleRadius / fullRadius, color.toCSS() ); 66 │ 105 │ gradientFill.addColorStop( 1, '#000000' ); - ..\build-a-molecule\js\view\AtomNode.js: 123-130 ..\build-a-molecule\js\view\AtomNode.js: 139-146 123 │ 139 │ AtomNode.experimentalBrightGradient = function( radius, baseColor ) { 124 │ 140 │ // var diameter = radius * 2; 125 │ 141 │ var gCenter = new Vector2( -radius / 3, -radius / 3 ); 126 │ 142 │ var fullRadius = gCenter.minus( new Vector2( 1, 1 ).normalize().multiply( radius ) ).magnitude(); 127 │ 143 │ var gradientFill = new RadialGradient( gCenter.x, gCenter.y, 0, gCenter.x, gCenter.y, fullRadius ); 128 │ 144 │ 129 │ 145 │ gradientFill.addColorStop( 0, baseColor.colorUtilsBrightness( 0.5 + 0.2 ).toCSS() ); 130 │ 146 │ gradientFill.addColorStop( 0.08, baseColor.colorUtilsBrightness( 0.2 + 0.2 ).toCSS() ); - ..\build-a-molecule\js\view\AtomNode.js: 112-121 ..\build-a-molecule\js\view\view3d\Molecule3DNode.js: 233-242 112 │ 233 │ var gradientFill = new RadialGradient( gCenter.x, gCenter.y, 0, gCenter.x, gCenter.y, fullRadius ); 113 │ 234 │ 114 │ 235 │ gradientFill.addColorStop( 0, baseColor.colorUtilsBrighter( 0.5 ).toCSS() ); 115 │ 236 │ gradientFill.addColorStop( 0.08, baseColor.colorUtilsBrighter( 0.2 ).toCSS() ); 116 │ 237 │ gradientFill.addColorStop( 0.4, baseColor.colorUtilsDarker( 0.1 ).toCSS() ); 117 │ 238 │ gradientFill.addColorStop( 0.8, baseColor.colorUtilsDarker( 0.4 ).toCSS() ); 118 │ 239 │ gradientFill.addColorStop( 0.95, baseColor.colorUtilsDarker( 0.6 ).toCSS() ); 119 │ 240 │ gradientFill.addColorStop( 1, baseColor.colorUtilsDarker( 0.4 ).toCSS() ); 120 │ 241 │ return gradientFill; 121 │ 242 │ }; - ..\axon\tests\qunit\unit-tests.js: 5-17 ..\build-a-molecule\tests\qunit\unit-tests.js: 4-16 5 │ 4 │ function loadTestFile( src ) { 6 │ 5 │ var script = document.createElement( 'script' ); 7 │ 6 │ script.type = 'text/javascript'; 8 │ 7 │ script.async = false; 9 │ 8 │ 10 │ 9 │ // make sure things aren't cached, just in case 11 │ 10 │ script.src = pathToTestBase + '/' + src + '?random=' + Math.random().toFixed( 10 ); 12 │ 11 │ 13 │ 12 │ document.getElementsByTagName( 'head' )[ 0 ].appendChild( script ); 14 │ 13 │ } 15 │ 14 │ 16 │ 15 │ loadTestFile( 'js/simple-tests.js' ); 17 │ 16 │ loadTestFile( 'js/events.js' ); - ..\area-builder\js\area-builder-config.js: 18-37 ..\build-an-atom\js\build-an-atom-config.js: 13-32 18 │ 13 │ audio: '../../chipper/js/requirejs-plugins/audio', 19 │ 14 │ image: '../../chipper/js/requirejs-plugins/image', 20 │ 15 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 21 │ 16 │ string: '../../chipper/js/requirejs-plugins/string', 22 │ 17 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 23 │ 18 │ 24 │ 19 │ // PhET libs, uppercase names to identify them in require.js imports 25 │ 20 │ AXON: '../../axon/js', 26 │ 21 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 27 │ 22 │ DOT: '../../dot/js', 28 │ 23 │ JOIST: '../../joist/js', 29 │ 24 │ KITE: '../../kite/js', 30 │ 25 │ PHET_CORE: '../../phet-core/js', 31 │ 26 │ PHET_IO: '../../phet-io/js', 32 │ 27 │ PHETCOMMON: '../../phetcommon/js', 33 │ 28 │ REPOSITORY: '..', 34 │ 29 │ SCENERY: '../../scenery/js', 35 │ 30 │ SCENERY_PHET: '../../scenery-phet/js', 36 │ 31 │ SHERPA: '../../sherpa', 37 │ 32 │ SUN: '../../sun/js', - ..\build-an-atom\js\game\model\AtomValuePool.js: 22-89 ..\build-an-atom\js\game\model\AtomValuePool.js: 56-123 22 │ 56 │ [ 23 │ 57 │ new NumberAtom( { protonCount: 1, neutronCount: 0, electronCount: 0 } ), 24 │ 58 │ new NumberAtom( { protonCount: 1, neutronCount: 0, electronCount: 1 } ), 25 │ 59 │ new NumberAtom( { protonCount: 1, neutronCount: 0, electronCount: 2 } ), 26 │ 60 │ new NumberAtom( { protonCount: 1, neutronCount: 1, electronCount: 0 } ), 27 │ 61 │ new NumberAtom( { protonCount: 1, neutronCount: 1, electronCount: 1 } ), 28 │ 62 │ new NumberAtom( { protonCount: 1, neutronCount: 1, electronCount: 2 } ), 29 │ 63 │ new NumberAtom( { protonCount: 2, neutronCount: 1, electronCount: 2 } ), 30 │ 64 │ new NumberAtom( { protonCount: 2, neutronCount: 2, electronCount: 2 } ), 31 │ 65 │ new NumberAtom( { protonCount: 3, neutronCount: 3, electronCount: 2 } ), 32 │ 66 │ new NumberAtom( { protonCount: 3, neutronCount: 3, electronCount: 3 } ), 33 │ 67 │ new NumberAtom( { protonCount: 3, neutronCount: 4, electronCount: 2 } ), 34 │ 68 │ new NumberAtom( { protonCount: 3, neutronCount: 4, electronCount: 3 } ), 35 │ 69 │ new NumberAtom( { protonCount: 4, neutronCount: 5, electronCount: 4 } ), 36 │ 70 │ new NumberAtom( { protonCount: 5, neutronCount: 5, electronCount: 5 } ), 37 │ 71 │ new NumberAtom( { protonCount: 5, neutronCount: 6, electronCount: 5 } ), 38 │ 72 │ new NumberAtom( { protonCount: 6, neutronCount: 6, electronCount: 6 } ), 39 │ 73 │ new NumberAtom( { protonCount: 6, neutronCount: 7, electronCount: 6 } ), 40 │ 74 │ new NumberAtom( { protonCount: 7, neutronCount: 7, electronCount: 7 } ), 41 │ 75 │ new NumberAtom( { protonCount: 7, neutronCount: 7, electronCount: 10 } ), 42 │ 76 │ new NumberAtom( { protonCount: 7, neutronCount: 8, electronCount: 7 } ), 43 │ 77 │ new NumberAtom( { protonCount: 7, neutronCount: 8, electronCount: 10 } ), 44 │ 78 │ new NumberAtom( { protonCount: 8, neutronCount: 8, electronCount: 8 } ), 45 │ 79 │ new NumberAtom( { protonCount: 8, neutronCount: 8, electronCount: 10 } ), 46 │ 80 │ new NumberAtom( { protonCount: 8, neutronCount: 9, electronCount: 8 } ), 47 │ 81 │ new NumberAtom( { protonCount: 8, neutronCount: 9, electronCount: 10 } ), 48 │ 82 │ new NumberAtom( { protonCount: 8, neutronCount: 10, electronCount: 8 } ), 49 │ 83 │ new NumberAtom( { protonCount: 8, neutronCount: 10, electronCount: 10 } ), 50 │ 84 │ new NumberAtom( { protonCount: 9, neutronCount: 10, electronCount: 9 } ), 51 │ 85 │ new NumberAtom( { protonCount: 9, neutronCount: 10, electronCount: 10 } ), 52 │ 86 │ new NumberAtom( { protonCount: 10, neutronCount: 10, electronCount: 10 } ), 53 │ 87 │ new NumberAtom( { protonCount: 10, neutronCount: 11, electronCount: 10 } ), 54 │ 88 │ new NumberAtom( { protonCount: 10, neutronCount: 12, electronCount: 10 } ) 55 │ 89 │ ], 56 │ 90 │ [ 57 │ 91 │ new NumberAtom( { protonCount: 1, neutronCount: 0, electronCount: 0 } ), 58 │ 92 │ new NumberAtom( { protonCount: 1, neutronCount: 0, electronCount: 1 } ), 59 │ 93 │ new NumberAtom( { protonCount: 1, neutronCount: 0, electronCount: 2 } ), 60 │ 94 │ new NumberAtom( { protonCount: 1, neutronCount: 1, electronCount: 0 } ), 61 │ 95 │ new NumberAtom( { protonCount: 1, neutronCount: 1, electronCount: 1 } ), 62 │ 96 │ new NumberAtom( { protonCount: 1, neutronCount: 1, electronCount: 2 } ), 63 │ 97 │ new NumberAtom( { protonCount: 2, neutronCount: 1, electronCount: 2 } ), 64 │ 98 │ new NumberAtom( { protonCount: 2, neutronCount: 2, electronCount: 2 } ), 65 │ 99 │ new NumberAtom( { protonCount: 3, neutronCount: 3, electronCount: 2 } ), 66 │ 100 │ new NumberAtom( { protonCount: 3, neutronCount: 3, electronCount: 3 } ), 67 │ 101 │ new NumberAtom( { protonCount: 3, neutronCount: 4, electronCount: 2 } ), 68 │ 102 │ new NumberAtom( { protonCount: 3, neutronCount: 4, electronCount: 3 } ), 69 │ 103 │ new NumberAtom( { protonCount: 4, neutronCount: 5, electronCount: 4 } ), 70 │ 104 │ new NumberAtom( { protonCount: 5, neutronCount: 5, electronCount: 5 } ), 71 │ 105 │ new NumberAtom( { protonCount: 5, neutronCount: 6, electronCount: 5 } ), 72 │ 106 │ new NumberAtom( { protonCount: 6, neutronCount: 6, electronCount: 6 } ), 73 │ 107 │ new NumberAtom( { protonCount: 6, neutronCount: 7, electronCount: 6 } ), 74 │ 108 │ new NumberAtom( { protonCount: 7, neutronCount: 7, electronCount: 7 } ), 75 │ 109 │ new NumberAtom( { protonCount: 7, neutronCount: 7, electronCount: 10 } ), 76 │ 110 │ new NumberAtom( { protonCount: 7, neutronCount: 8, electronCount: 7 } ), 77 │ 111 │ new NumberAtom( { protonCount: 7, neutronCount: 8, electronCount: 10 } ), 78 │ 112 │ new NumberAtom( { protonCount: 8, neutronCount: 8, electronCount: 8 } ), 79 │ 113 │ new NumberAtom( { protonCount: 8, neutronCount: 8, electronCount: 10 } ), 80 │ 114 │ new NumberAtom( { protonCount: 8, neutronCount: 9, electronCount: 8 } ), 81 │ 115 │ new NumberAtom( { protonCount: 8, neutronCount: 9, electronCount: 10 } ), 82 │ 116 │ new NumberAtom( { protonCount: 8, neutronCount: 10, electronCount: 8 } ), 83 │ 117 │ new NumberAtom( { protonCount: 8, neutronCount: 10, electronCount: 10 } ), 84 │ 118 │ new NumberAtom( { protonCount: 9, neutronCount: 10, electronCount: 9 } ), 85 │ 119 │ new NumberAtom( { protonCount: 9, neutronCount: 10, electronCount: 10 } ), 86 │ 120 │ new NumberAtom( { protonCount: 10, neutronCount: 10, electronCount: 10 } ), 87 │ 121 │ new NumberAtom( { protonCount: 10, neutronCount: 11, electronCount: 10 } ), 88 │ 122 │ new NumberAtom( { protonCount: 10, neutronCount: 12, electronCount: 10 } ) 89 │ 123 │ ], - ..\build-an-atom\js\game\model\AtomValuePool.js: 54-118 ..\build-an-atom\js\game\model\AtomValuePool.js: 150-214 54 │ 150 │ new NumberAtom( { protonCount: 10, neutronCount: 12, electronCount: 10 } ) 55 │ 151 │ ], 56 │ 152 │ [ 57 │ 153 │ new NumberAtom( { protonCount: 1, neutronCount: 0, electronCount: 0 } ), 58 │ 154 │ new NumberAtom( { protonCount: 1, neutronCount: 0, electronCount: 1 } ), 59 │ 155 │ new NumberAtom( { protonCount: 1, neutronCount: 0, electronCount: 2 } ), 60 │ 156 │ new NumberAtom( { protonCount: 1, neutronCount: 1, electronCount: 0 } ), 61 │ 157 │ new NumberAtom( { protonCount: 1, neutronCount: 1, electronCount: 1 } ), 62 │ 158 │ new NumberAtom( { protonCount: 1, neutronCount: 1, electronCount: 2 } ), 63 │ 159 │ new NumberAtom( { protonCount: 2, neutronCount: 1, electronCount: 2 } ), 64 │ 160 │ new NumberAtom( { protonCount: 2, neutronCount: 2, electronCount: 2 } ), 65 │ 161 │ new NumberAtom( { protonCount: 3, neutronCount: 3, electronCount: 2 } ), 66 │ 162 │ new NumberAtom( { protonCount: 3, neutronCount: 3, electronCount: 3 } ), 67 │ 163 │ new NumberAtom( { protonCount: 3, neutronCount: 4, electronCount: 2 } ), 68 │ 164 │ new NumberAtom( { protonCount: 3, neutronCount: 4, electronCount: 3 } ), 69 │ 165 │ new NumberAtom( { protonCount: 4, neutronCount: 5, electronCount: 4 } ), 70 │ 166 │ new NumberAtom( { protonCount: 5, neutronCount: 5, electronCount: 5 } ), 71 │ 167 │ new NumberAtom( { protonCount: 5, neutronCount: 6, electronCount: 5 } ), 72 │ 168 │ new NumberAtom( { protonCount: 6, neutronCount: 6, electronCount: 6 } ), 73 │ 169 │ new NumberAtom( { protonCount: 6, neutronCount: 7, electronCount: 6 } ), 74 │ 170 │ new NumberAtom( { protonCount: 7, neutronCount: 7, electronCount: 7 } ), 75 │ 171 │ new NumberAtom( { protonCount: 7, neutronCount: 7, electronCount: 10 } ), 76 │ 172 │ new NumberAtom( { protonCount: 7, neutronCount: 8, electronCount: 7 } ), 77 │ 173 │ new NumberAtom( { protonCount: 7, neutronCount: 8, electronCount: 10 } ), 78 │ 174 │ new NumberAtom( { protonCount: 8, neutronCount: 8, electronCount: 8 } ), 79 │ 175 │ new NumberAtom( { protonCount: 8, neutronCount: 8, electronCount: 10 } ), 80 │ 176 │ new NumberAtom( { protonCount: 8, neutronCount: 9, electronCount: 8 } ), 81 │ 177 │ new NumberAtom( { protonCount: 8, neutronCount: 9, electronCount: 10 } ), 82 │ 178 │ new NumberAtom( { protonCount: 8, neutronCount: 10, electronCount: 8 } ), 83 │ 179 │ new NumberAtom( { protonCount: 8, neutronCount: 10, electronCount: 10 } ), 84 │ 180 │ new NumberAtom( { protonCount: 9, neutronCount: 10, electronCount: 9 } ), 85 │ 181 │ new NumberAtom( { protonCount: 9, neutronCount: 10, electronCount: 10 } ), 86 │ 182 │ new NumberAtom( { protonCount: 10, neutronCount: 10, electronCount: 10 } ), 87 │ 183 │ new NumberAtom( { protonCount: 10, neutronCount: 11, electronCount: 10 } ), 88 │ 184 │ new NumberAtom( { protonCount: 10, neutronCount: 12, electronCount: 10 } ) 89 │ 185 │ ], 90 │ 186 │ [ 91 │ 187 │ new NumberAtom( { protonCount: 1, neutronCount: 0, electronCount: 0 } ), 92 │ 188 │ new NumberAtom( { protonCount: 1, neutronCount: 0, electronCount: 1 } ), 93 │ 189 │ new NumberAtom( { protonCount: 1, neutronCount: 0, electronCount: 2 } ), 94 │ 190 │ new NumberAtom( { protonCount: 1, neutronCount: 1, electronCount: 0 } ), 95 │ 191 │ new NumberAtom( { protonCount: 1, neutronCount: 1, electronCount: 1 } ), 96 │ 192 │ new NumberAtom( { protonCount: 1, neutronCount: 1, electronCount: 2 } ), 97 │ 193 │ new NumberAtom( { protonCount: 2, neutronCount: 1, electronCount: 2 } ), 98 │ 194 │ new NumberAtom( { protonCount: 2, neutronCount: 2, electronCount: 2 } ), 99 │ 195 │ new NumberAtom( { protonCount: 3, neutronCount: 3, electronCount: 2 } ), 100 │ 196 │ new NumberAtom( { protonCount: 3, neutronCount: 3, electronCount: 3 } ), 101 │ 197 │ new NumberAtom( { protonCount: 3, neutronCount: 4, electronCount: 2 } ), 102 │ 198 │ new NumberAtom( { protonCount: 3, neutronCount: 4, electronCount: 3 } ), 103 │ 199 │ new NumberAtom( { protonCount: 4, neutronCount: 5, electronCount: 4 } ), 104 │ 200 │ new NumberAtom( { protonCount: 5, neutronCount: 5, electronCount: 5 } ), 105 │ 201 │ new NumberAtom( { protonCount: 5, neutronCount: 6, electronCount: 5 } ), 106 │ 202 │ new NumberAtom( { protonCount: 6, neutronCount: 6, electronCount: 6 } ), 107 │ 203 │ new NumberAtom( { protonCount: 6, neutronCount: 7, electronCount: 6 } ), 108 │ 204 │ new NumberAtom( { protonCount: 7, neutronCount: 7, electronCount: 7 } ), 109 │ 205 │ new NumberAtom( { protonCount: 7, neutronCount: 7, electronCount: 10 } ), 110 │ 206 │ new NumberAtom( { protonCount: 7, neutronCount: 8, electronCount: 7 } ), 111 │ 207 │ new NumberAtom( { protonCount: 7, neutronCount: 8, electronCount: 10 } ), 112 │ 208 │ new NumberAtom( { protonCount: 8, neutronCount: 8, electronCount: 8 } ), 113 │ 209 │ new NumberAtom( { protonCount: 8, neutronCount: 8, electronCount: 10 } ), 114 │ 210 │ new NumberAtom( { protonCount: 8, neutronCount: 9, electronCount: 8 } ), 115 │ 211 │ new NumberAtom( { protonCount: 8, neutronCount: 9, electronCount: 10 } ), 116 │ 212 │ new NumberAtom( { protonCount: 8, neutronCount: 10, electronCount: 8 } ), 117 │ 213 │ new NumberAtom( { protonCount: 8, neutronCount: 10, electronCount: 10 } ), 118 │ 214 │ new NumberAtom( { protonCount: 9, neutronCount: 10, electronCount: 9 } ), - ..\build-an-atom\js\game\model\BAAGameProblem.js: 65-86 ..\build-an-atom\js\game\model\ToElementProblem.js: 56-77 65 │ 56 │ this.scoreProperty.set( pointsIfCorrect ); 66 │ 57 │ this.model.scoreProperty.set( this.model.scoreProperty.get() + this.scoreProperty.get() ); 67 │ 58 │ 68 │ 59 │ // Move to the next state. 69 │ 60 │ this.problemStateProperty.set( 'problemSolvedCorrectly' ); 70 │ 61 │ } 71 │ 62 │ else { 72 │ 63 │ 73 │ 64 │ // Handle incorrect answer. 74 │ 65 │ if ( this.numSubmissionsProperty.get() < ShredConstants.MAX_PROBLEM_ATTEMPTS ) { 75 │ 66 │ 76 │ 67 │ // Give the user another chance. 77 │ 68 │ this.problemStateProperty.set( 'presentingTryAgain' ); 78 │ 69 │ } 79 │ 70 │ else { 80 │ 71 │ 81 │ 72 │ // User has exhausted their attempts. 82 │ 73 │ this.problemStateProperty.set( 'attemptsExhausted' ); 83 │ 74 │ } 84 │ 75 │ } 85 │ 76 │ }, 86 │ 77 │ - ..\build-an-atom\js\game\view\CountsToChargeProblemView.js: 5-21 ..\build-an-atom\js\game\view\CountsToMassNumberProblemView.js: 5-21 5 │ 5 │ * 6 │ 6 │ * @author John Blanco 7 │ 7 │ */ 8 │ 8 │ define( function( require ) { 9 │ 9 │ 'use strict'; 10 │ 10 │ 11 │ 11 │ // modules 12 │ 12 │ var buildAnAtom = require( 'BUILD_AN_ATOM/buildAnAtom' ); 13 │ 13 │ var PhetFont = require( 'SCENERY_PHET/PhetFont' ); 14 │ 14 │ var inherit = require( 'PHET_CORE/inherit' ); 15 │ 15 │ var MultiLineText = require( 'SCENERY_PHET/MultiLineText' ); 16 │ 16 │ var NumberAtom = require( 'SHRED/model/NumberAtom' ); 17 │ 17 │ var NumberEntryNode = require( 'BUILD_AN_ATOM/game/view/NumberEntryNode' ); 18 │ 18 │ var ParticleCountsNode = require( 'BUILD_AN_ATOM/game/view/ParticleCountsNode' ); 19 │ 19 │ var ProblemView = require( 'BUILD_AN_ATOM/game/view/ProblemView' ); 20 │ 20 │ var Property = require( 'AXON/Property' ); 21 │ 21 │ var ShredConstants = require( 'SHRED/ShredConstants' ); - ..\build-an-atom\js\game\view\CountsToChargeProblemView.js: 59-73 ..\build-an-atom\js\game\view\CountsToMassNumberProblemView.js: 56-70 59 │ 56 │ minValue: -99 60 │ 57 │ } ); 61 │ 58 │ self.interactiveAnswerNode.addChild( numberEntryNode ); 62 │ 59 │ 63 │ 60 │ // Layout 64 │ 61 │ particleCountsNode.centerX = layoutBounds.width * 0.3; 65 │ 62 │ particleCountsNode.centerY = layoutBounds.height * 0.5; 66 │ 63 │ questionPrompt.centerX = layoutBounds.width * 0.65; 67 │ 64 │ questionPrompt.centerY = layoutBounds.height * 0.5; 68 │ 65 │ numberEntryNode.left = questionPrompt.right + 10; 69 │ 66 │ numberEntryNode.centerY = questionPrompt.centerY; 70 │ 67 │ } 71 │ 68 │ 72 │ 69 │ buildAnAtom.register( 'CountsToChargeProblemView', CountsToChargeProblemView ); 73 │ 70 │ - ..\build-an-atom\js\game\view\CountsToChargeProblemView.js: 75-91 ..\build-an-atom\js\game\view\SchematicToChargeProblemView.js: 87-103 75 │ 87 │ return inherit( ProblemView, CountsToChargeProblemView, { 76 │ 88 │ 77 │ 89 │ // @public 78 │ 90 │ checkAnswer: function() { 79 │ 91 │ var userSubmittedAnswer = new NumberAtom( { 80 │ 92 │ protonCount: this.problem.answerAtom.protonCountProperty.get(), 81 │ 93 │ neutronCount: this.problem.answerAtom.neutronCountProperty.get(), 82 │ 94 │ electronCount: this.problem.answerAtom.protonCountProperty.get() - this.chargeAnswerProperty.value 83 │ 95 │ } ); 84 │ 96 │ this.problem.checkAnswer( userSubmittedAnswer ); 85 │ 97 │ }, 86 │ 98 │ 87 │ 99 │ // @public 88 │ 100 │ displayCorrectAnswer: function() { 89 │ 101 │ this.chargeAnswerProperty.value = this.problem.answerAtom.chargeProperty.get(); 90 │ 102 │ } 91 │ 103 │ } ); - ..\build-an-atom\js\game\view\SchematicToChargeProblemView.js: 6-24 ..\build-an-atom\js\game\view\SchematicToMassNumberProblemView.js: 6-24 6 │ 6 │ * 7 │ 7 │ * @author John Blanco 8 │ 8 │ */ 9 │ 9 │ define( function( require ) { 10 │ 10 │ 'use strict'; 11 │ 11 │ 12 │ 12 │ // modules 13 │ 13 │ var buildAnAtom = require( 'BUILD_AN_ATOM/buildAnAtom' ); 14 │ 14 │ var PhetFont = require( 'SCENERY_PHET/PhetFont' ); 15 │ 15 │ var inherit = require( 'PHET_CORE/inherit' ); 16 │ 16 │ var ModelViewTransform2 = require( 'PHETCOMMON/view/ModelViewTransform2' ); 17 │ 17 │ var MultiLineText = require( 'SCENERY_PHET/MultiLineText' ); 18 │ 18 │ var NonInteractiveSchematicAtomNode = require( 'BUILD_AN_ATOM/game/view/NonInteractiveSchematicAtomNode' ); 19 │ 19 │ var NumberAtom = require( 'SHRED/model/NumberAtom' ); 20 │ 20 │ var NumberEntryNode = require( 'BUILD_AN_ATOM/game/view/NumberEntryNode' ); 21 │ 21 │ var ProblemView = require( 'BUILD_AN_ATOM/game/view/ProblemView' ); 22 │ 22 │ var Property = require( 'AXON/Property' ); 23 │ 23 │ var ShredConstants = require( 'SHRED/ShredConstants' ); 24 │ 24 │ var Vector2 = require( 'DOT/Vector2' ); - ..\build-an-atom\js\game\view\CountsToMassNumberProblemView.js: 72-88 ..\build-an-atom\js\game\view\SchematicToMassNumberProblemView.js: 85-101 72 │ 85 │ return inherit( ProblemView, CountsToMassNumberProblemView, { 73 │ 86 │ 74 │ 87 │ // @public 75 │ 88 │ checkAnswer: function() { 76 │ 89 │ var userSubmittedAnswer = new NumberAtom( { 77 │ 90 │ protonCount: this.problem.answerAtom.protonCountProperty.get(), 78 │ 91 │ neutronCount: this.massNumberAnswerProperty.value - this.problem.answerAtom.protonCountProperty.get(), 79 │ 92 │ electronCount: this.problem.answerAtom.electronCountProperty.get() 80 │ 93 │ } ); 81 │ 94 │ this.problem.checkAnswer( userSubmittedAnswer ); 82 │ 95 │ }, 83 │ 96 │ 84 │ 97 │ // @public 85 │ 98 │ displayCorrectAnswer: function() { 86 │ 99 │ this.massNumberAnswerProperty.value = this.problem.answerAtom.massNumberProperty.get(); 87 │ 100 │ } 88 │ 101 │ } ); - ..\build-an-atom\js\game\view\CountsToSymbolProblemView.js: 29-42 ..\build-an-atom\js\game\view\SchematicToSymbolProblemView.js: 32-45 29 │ 32 │ this.interactiveSymbolNode = new InteractiveSymbolNode( 30 │ 33 │ toSymbolProblem.answerAtom, 31 │ 34 │ tandem.createTandem( 'interactiveSymbolNode' ), { 32 │ 35 │ interactiveProtonCount: toSymbolProblem.configurableProtonCount, 33 │ 36 │ interactiveMassNumber: toSymbolProblem.configurableMassNumber, 34 │ 37 │ interactiveCharge: toSymbolProblem.configurableCharge 35 │ 38 │ } 36 │ 39 │ ); 37 │ 40 │ 38 │ 41 │ ProblemView.call( this, toSymbolProblem, layoutBounds, tandem ); // Call super constructor. 39 │ 42 │ 40 │ 43 │ // Add the interactive symbol. 41 │ 44 │ this.interactiveSymbolNode.scale( 0.75 ); 42 │ 45 │ this.interactiveAnswerNode.addChild( this.interactiveSymbolNode ); - ..\build-an-atom\js\game\view\CountsToSymbolProblemView.js: 58-76 ..\build-an-atom\js\game\view\SchematicToSymbolProblemView.js: 70-88 58 │ 70 │ return inherit( ProblemView, CountsToSymbolProblemView, { 59 │ 71 │ 60 │ 72 │ // @public 61 │ 73 │ checkAnswer: function() { 62 │ 74 │ var userSubmittedAtom = new NumberAtom( { 63 │ 75 │ protonCount: this.interactiveSymbolNode.protonCountProperty.value, 64 │ 76 │ neutronCount: this.interactiveSymbolNode.massNumberProperty.value - this.interactiveSymbolNode.protonCountProperty.value, 65 │ 77 │ electronCount: this.interactiveSymbolNode.protonCountProperty.value - this.interactiveSymbolNode.chargeProperty.value 66 │ 78 │ } ); 67 │ 79 │ this.problem.checkAnswer( userSubmittedAtom ); 68 │ 80 │ }, 69 │ 81 │ 70 │ 82 │ // @public 71 │ 83 │ displayCorrectAnswer: function() { 72 │ 84 │ this.interactiveSymbolNode.protonCountProperty.value = this.problem.answerAtom.protonCountProperty.get(); 73 │ 85 │ this.interactiveSymbolNode.massNumberProperty.value = this.problem.answerAtom.massNumberProperty.get(); 74 │ 86 │ this.interactiveSymbolNode.chargeProperty.value = this.problem.answerAtom.chargeProperty.get(); 75 │ 87 │ } 76 │ 88 │ } ); - ..\build-an-atom\js\game\view\InteractiveSymbolNode.js: 60-75 ..\build-an-atom\js\symbol\view\SymbolNode.js: 42-57 60 │ 42 │ // Add the bounding box, which is also the root node for everything else 61 │ 43 │ // that comprises this node. 62 │ 44 │ var boundingBox = new Rectangle( 0, 0, SYMBOL_BOX_WIDTH, SYMBOL_BOX_HEIGHT, 0, 0, { 63 │ 45 │ stroke: 'black', 64 │ 46 │ lineWidth: 2, 65 │ 47 │ fill: 'white' 66 │ 48 │ } ); 67 │ 49 │ this.addChild( boundingBox ); 68 │ 50 │ 69 │ 51 │ // Add the symbol text. 70 │ 52 │ var symbolText = new Text( '', { 71 │ 53 │ font: new PhetFont( 150 ), 72 │ 54 │ fill: 'black', 73 │ 55 │ center: new Vector2( SYMBOL_BOX_WIDTH / 2, SYMBOL_BOX_HEIGHT / 2 ) 74 │ 56 │ } ); 75 │ 57 │ boundingBox.addChild( symbolText ); - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-44 ..\calculus-grapher\js\calculus-grapher-config.js: 10-43 11 │ 10 │ deps: [ 'area-model-multiplication-main' ], 12 │ 11 │ 13 │ 12 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 13 │ 15 │ 14 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 15 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 16 │ paths: { 18 │ 17 │ 19 │ 18 │ // third-party libs 20 │ 19 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 20 │ 22 │ 21 │ // PhET plugins 23 │ 22 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 23 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 24 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 25 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 26 │ 28 │ 27 │ // common directories, uppercase names to identify them in require imports 29 │ 28 │ AXON: '../../axon/js', 30 │ 29 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 30 │ DOT: '../../dot/js', 32 │ 31 │ JOIST: '../../joist/js', 33 │ 32 │ KITE: '../../kite/js', 34 │ 33 │ PHET_CORE: '../../phet-core/js', 35 │ 34 │ PHET_IO: '../../phet-io/js', 36 │ 35 │ PHETCOMMON: '../../phetcommon/js', 37 │ 36 │ REPOSITORY: '..', 38 │ 37 │ SCENERY: '../../scenery/js', 39 │ 38 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 39 │ SUN: '../../sun/js', 41 │ 40 │ TANDEM: '../../tandem/js', 42 │ 41 │ 43 │ 42 │ // this sim 44 │ 43 │ AREA_MODEL_MULTIPLICATION: '.' - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-42 ..\capacitor-lab-basics\js\capacitor-lab-basics-config.js: 10-41 11 │ 10 │ deps: [ 'area-model-multiplication-main' ], 12 │ 11 │ 13 │ 12 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 13 │ 15 │ 14 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 15 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 16 │ paths: { 18 │ 17 │ 19 │ 18 │ // third-party libs 20 │ 19 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 20 │ 22 │ 21 │ // PhET plugins 23 │ 22 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 23 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 24 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 25 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 26 │ 28 │ 27 │ // common directories, uppercase names to identify them in require imports 29 │ 28 │ AXON: '../../axon/js', 30 │ 29 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 30 │ DOT: '../../dot/js', 32 │ 31 │ JOIST: '../../joist/js', 33 │ 32 │ KITE: '../../kite/js', 34 │ 33 │ PHET_CORE: '../../phet-core/js', 35 │ 34 │ PHET_IO: '../../phet-io/js', 36 │ 35 │ PHETCOMMON: '../../phetcommon/js', 37 │ 36 │ REPOSITORY: '..', 38 │ 37 │ SCENERY: '../../scenery/js', 39 │ 38 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 39 │ SUN: '../../sun/js', 41 │ 40 │ TANDEM: '../../tandem/js', 42 │ 41 │ - ..\capacitor-lab-basics\js\common\view\drag\PlateAreaDragHandleNode.js: 6-23 ..\capacitor-lab-basics\js\common\view\drag\PlateSeparationDragHandleNode.js: 5-22 6 │ 5 │ * 7 │ 6 │ * @author Chris Malley (cmalley@pixelzoom.com) 8 │ 7 │ * @author Jesse Greenberg 9 │ 8 │ */ 10 │ 9 │ define( function( require ) { 11 │ 10 │ 'use strict'; 12 │ 11 │ 13 │ 12 │ // modules 14 │ 13 │ var ButtonListener = require( 'SCENERY/input/ButtonListener' ); 15 │ 14 │ var capacitorLabBasics = require( 'CAPACITOR_LAB_BASICS/capacitorLabBasics' ); 16 │ 15 │ var CLBConstants = require( 'CAPACITOR_LAB_BASICS/common/CLBConstants' ); 17 │ 16 │ var DragHandleArrowNode = require( 'CAPACITOR_LAB_BASICS/common/view/drag/DragHandleArrowNode' ); 18 │ 17 │ var DragHandleLineNode = require( 'CAPACITOR_LAB_BASICS/common/view/drag/DragHandleLineNode' ); 19 │ 18 │ var DragHandleValueNode = require( 'CAPACITOR_LAB_BASICS/common/view/drag/DragHandleValueNode' ); 20 │ 19 │ var inherit = require( 'PHET_CORE/inherit' ); 21 │ 20 │ var Node = require( 'SCENERY/nodes/Node' ); 22 │ 21 │ var PlateAreaDragHandler = require( 'CAPACITOR_LAB_BASICS/common/view/drag/PlateAreaDragHandler' ); 23 │ 22 │ var UnitsUtils = require( 'CAPACITOR_LAB_BASICS/common/model/util/UnitsUtils' ); - ..\capacitor-lab-basics\js\common\view\drag\PlateAreaDragHandleNode.js: 76-96 ..\capacitor-lab-basics\js\common\view\drag\PlateSeparationDragHandleNode.js: 73-93 76 │ 73 │ this.valueNode = new DragHandleValueNode( plateAreaString, millimetersSquared, unitsMillimetersString + '' + 2 + '' ); 77 │ 74 │ 78 │ 75 │ // Make text part of the draggable area 79 │ 76 │ this.valueNode.mouseArea = this.valueNode.bounds.dilated( 0 ); 80 │ 77 │ this.valueNode.touchArea = this.valueNode.bounds.dilated( 0 ); 81 │ 78 │ 82 │ 79 │ // Highlight the arrow on pointer over text 83 │ 80 │ this.valueNode.addInputListener( new ButtonListener( { 84 │ 81 │ over: function( event ) { 85 │ 82 │ arrowNode.fill = arrowNode.highlightColor; 86 │ 83 │ }, 87 │ 84 │ up: function( event ) { 88 │ 85 │ arrowNode.fill = arrowNode.normalColor; 89 │ 86 │ } 90 │ 87 │ } ) ); 91 │ 88 │ 92 │ 89 │ // rendering order 93 │ 90 │ this.addChild( lineNode ); 94 │ 91 │ this.addChild( arrowNode ); 95 │ 92 │ this.addChild( this.valueNode ); 96 │ 93 │ - ..\capacitor-lab-basics\js\capacitance\view\CapacitanceScreenView.js: 59-73 ..\capacitor-lab-basics\js\light-bulb\view\CLBLightBulbScreenView.js: 61-75 59 │ 61 │ capacitanceBarMeterPanel.leftBottom = capacitanceCircuitNode.topWireNode.leftTop.minus( BAR_METER_PANEL_OFFSET ); 60 │ 62 │ 61 │ 63 │ var resetAllButton = new ResetAllButton( { 62 │ 64 │ listener: function() { 63 │ 65 │ model.reset(); 64 │ 66 │ }, 65 │ 67 │ bottom: this.layoutBounds.bottom - 20, 66 │ 68 │ right: this.layoutBounds.right - 30, 67 │ 69 │ radius: 25, 68 │ 70 │ tandem: tandem.createTandem( 'resetAllButton' ) 69 │ 71 │ } ); 70 │ 72 │ 71 │ 73 │ // rendering order 72 │ 74 │ this.addChild( capacitanceCircuitNode ); 73 │ 75 │ this.addChild( capacitanceBarMeterPanel ); - ..\charges-and-fields\js\charges-and-fields\view\ElectricFieldCanvasNode.js: 62-77 ..\charges-and-fields\js\charges-and-fields\view\ElectricPotentialCanvasNode.js: 51-66 62 │ 51 │ isElectricFieldDirectionOnlyProperty.link( invalidateSelfListener ); // visibility change 63 │ 52 │ 64 │ 53 │ chargedParticles.addItemAddedListener( function( particle ) { 65 │ 54 │ particle.positionProperty.link( invalidateSelfListener ); 66 │ 55 │ } ); // particle added 67 │ 56 │ 68 │ 57 │ chargedParticles.addItemRemovedListener( function( particle ) { 69 │ 58 │ invalidateSelfListener(); 70 │ 59 │ particle.positionProperty.unlink( invalidateSelfListener ); 71 │ 60 │ } ); // particle removed 72 │ 61 │ 73 │ 62 │ isVisibleProperty.linkAttribute( this, 'visible' ); 74 │ 63 │ 75 │ 64 │ this.modelPositions = []; // {Array.} 76 │ 65 │ var width = modelBounds.width; 77 │ 66 │ var height = modelBounds.height; - ..\charges-and-fields\js\charges-and-fields\view\ElectricFieldCanvasNode.js: 79-89 ..\charges-and-fields\js\charges-and-fields\view\ElectricPotentialCanvasNode.js: 66-76 79 │ 66 │ var numVertical = Math.ceil( height / ELECTRIC_FIELD_SENSOR_SPACING ); 80 │ 67 │ for ( var row = 0; row < numVertical; row++ ) { 81 │ 68 │ var y = modelBounds.minY + ( row + 0.5 ) * height / numVertical; 82 │ 69 │ 83 │ 70 │ for ( var col = 0; col < numHorizontal; col++ ) { 84 │ 71 │ var x = modelBounds.minX + ( col + 0.5 ) * width / numHorizontal; 85 │ 72 │ 86 │ 73 │ this.modelPositions.push( new Vector2( x, y ) ); 87 │ 74 │ } 88 │ 75 │ } 89 │ 76 │ - ..\charges-and-fields\js\charges-and-fields\view\ElectricFieldCanvasNode.js: 110-124 ..\charges-and-fields\js\charges-and-fields\view\ElectricPotentialCanvasNode.js: 104-118 110 │ 104 │ updateElectricPotentials: function() { 111 │ 105 │ var kConstant = ChargesAndFieldsConstants.K_CONSTANT; 112 │ 106 │ 113 │ 107 │ var numChanges = this.chargeTracker.queue.length; 114 │ 108 │ 115 │ 109 │ for ( var i = 0; i < numChanges; i++ ) { 116 │ 110 │ var item = this.chargeTracker.queue[ i ]; 117 │ 111 │ var oldPosition = item.oldPosition; 118 │ 112 │ var newPosition = item.newPosition; 119 │ 113 │ var charge = item.charge; 120 │ 114 │ 121 │ 115 │ for ( var j = 0; j < this.modelPositions.length; j++ ) { 122 │ 116 │ var position = this.modelPositions[ j ]; 123 │ 117 │ var electricField = this.electricField[ j ]; 124 │ 118 │ - ..\charges-and-fields\js\charges-and-fields\view\ElectricPotentialCanvasNode.js: 47-59 ..\charges-and-fields\js\charges-and-fields\view\ElectricPotentialMobileWebGLNode.js: 40-52 47 │ 40 │ var invalidateSelfListener = this.forceRepaint.bind( this ); 48 │ 41 │ ChargesAndFieldsColorProfile.electricPotentialGridZeroProperty.link( invalidateSelfListener ); 49 │ 42 │ ChargesAndFieldsColorProfile.electricPotentialGridSaturationPositiveProperty.link( invalidateSelfListener ); 50 │ 43 │ ChargesAndFieldsColorProfile.electricPotentialGridSaturationNegativeProperty.link( invalidateSelfListener ); 51 │ 44 │ isVisibleProperty.link( invalidateSelfListener ); // visibility change 52 │ 45 │ chargedParticles.addItemAddedListener( function( particle ) { 53 │ 46 │ particle.positionProperty.link( invalidateSelfListener ); 54 │ 47 │ } ); // particle added 55 │ 48 │ chargedParticles.addItemRemovedListener( function( particle ) { 56 │ 49 │ invalidateSelfListener(); 57 │ 50 │ particle.positionProperty.unlink( invalidateSelfListener ); 58 │ 51 │ } ); // particle removed 59 │ 52 │ - ..\charges-and-fields\js\charges-and-fields\view\ElectricPotentialMobileWebGLNode.js: 37-52 ..\charges-and-fields\js\charges-and-fields\view\ElectricPotentialWebGLNode.js: 72-87 37 │ 72 │ } ); 38 │ 73 │ 39 │ 74 │ // Invalidate paint on a bunch of changes 40 │ 75 │ var invalidateSelfListener = this.invalidatePaint.bind( this ); 41 │ 76 │ ChargesAndFieldsColorProfile.electricPotentialGridZeroProperty.link( invalidateSelfListener ); 42 │ 77 │ ChargesAndFieldsColorProfile.electricPotentialGridSaturationPositiveProperty.link( invalidateSelfListener ); 43 │ 78 │ ChargesAndFieldsColorProfile.electricPotentialGridSaturationNegativeProperty.link( invalidateSelfListener ); 44 │ 79 │ isVisibleProperty.link( invalidateSelfListener ); // visibility change 45 │ 80 │ chargedParticles.addItemAddedListener( function( particle ) { 46 │ 81 │ particle.positionProperty.link( invalidateSelfListener ); 47 │ 82 │ } ); // particle added 48 │ 83 │ chargedParticles.addItemRemovedListener( function( particle ) { 49 │ 84 │ invalidateSelfListener(); 50 │ 85 │ particle.positionProperty.unlink( invalidateSelfListener ); 51 │ 86 │ } ); // particle removed 52 │ 87 │ } - ..\charges-and-fields\js\charges-and-fields\view\ElectricPotentialMobileWebGLNode.js: 133-147 ..\charges-and-fields\js\charges-and-fields\view\ElectricPotentialWebGLNode.js: 239-253 133 │ 239 │ } ); 134 │ 240 │ 135 │ 241 │ // we only need one vertex buffer with the same contents for all three shaders! 136 │ 242 │ this.vertexBuffer = gl.createBuffer(); 137 │ 243 │ gl.bindBuffer( gl.ARRAY_BUFFER, this.vertexBuffer ); 138 │ 244 │ gl.bufferData( gl.ARRAY_BUFFER, new Float32Array( [ 139 │ 245 │ -1, -1, 140 │ 246 │ -1, +1, 141 │ 247 │ +1, -1, 142 │ 248 │ +1, +1 143 │ 249 │ ] ), gl.STATIC_DRAW ); 144 │ 250 │ } 145 │ 251 │ 146 │ 252 │ inherit( Object, ElectricPotentialMobilePainter, { 147 │ 253 │ paint: function( modelViewMatrix, projectionMatrix ) { - ..\charges-and-fields\js\charges-and-fields\view\ElectricPotentialMobileWebGLNode.js: 163-172 ..\charges-and-fields\js\charges-and-fields\view\ElectricPotentialWebGLNode.js: 373-382 163 │ 373 │ gl.uniformMatrix3fv( displayShaderProgram.uniformLocations.uMatrixInverse, false, matrixInverseEntries ); 164 │ 374 │ 165 │ 375 │ // tell the shader our colors / scale 166 │ 376 │ var zeroColor = ChargesAndFieldsColorProfile.electricPotentialGridZeroProperty.value; 167 │ 377 │ var positiveColor = ChargesAndFieldsColorProfile.electricPotentialGridSaturationPositiveProperty.value; 168 │ 378 │ var negativeColor = ChargesAndFieldsColorProfile.electricPotentialGridSaturationNegativeProperty.value; 169 │ 379 │ gl.uniform3f( displayShaderProgram.uniformLocations.uZeroColor, zeroColor.red / 255, zeroColor.green / 255, zeroColor.blue / 255 ); 170 │ 380 │ gl.uniform3f( displayShaderProgram.uniformLocations.uPositiveColor, positiveColor.red / 255, positiveColor.green / 255, positiveColor.blue / 255 ); 171 │ 381 │ gl.uniform3f( displayShaderProgram.uniformLocations.uNegativeColor, negativeColor.red / 255, negativeColor.green / 255, negativeColor.blue / 255 ); 172 │ 382 │ - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-44 ..\charges-and-fields\js\charges-and-fields-config.js: 9-42 11 │ 9 │ deps: [ 'area-model-multiplication-main' ], 12 │ 10 │ 13 │ 11 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 12 │ 15 │ 13 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 14 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 15 │ paths: { 18 │ 16 │ 19 │ 17 │ // third-party libs 20 │ 18 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 19 │ 22 │ 20 │ // PhET plugins 23 │ 21 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 22 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 23 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 24 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 25 │ 28 │ 26 │ // common directories, uppercase names to identify them in require imports 29 │ 27 │ AXON: '../../axon/js', 30 │ 28 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 29 │ DOT: '../../dot/js', 32 │ 30 │ JOIST: '../../joist/js', 33 │ 31 │ KITE: '../../kite/js', 34 │ 32 │ PHET_CORE: '../../phet-core/js', 35 │ 33 │ PHET_IO: '../../phet-io/js', 36 │ 34 │ PHETCOMMON: '../../phetcommon/js', 37 │ 35 │ REPOSITORY: '..', 38 │ 36 │ SCENERY: '../../scenery/js', 39 │ 37 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 38 │ SUN: '../../sun/js', 41 │ 39 │ TANDEM: '../../tandem/js', 42 │ 40 │ 43 │ 41 │ // this sim 44 │ 42 │ AREA_MODEL_MULTIPLICATION: '.' - ..\chipper\eslint\rules\require-statement-match.js: 47-55 ..\chipper\eslint\rules\string-require-statement-match.js: 42-50 47 │ 42 │ if ( node.declarations && 48 │ 43 │ node.declarations.length > 0 && 49 │ 44 │ node.declarations[ 0 ].init && 50 │ 45 │ node.declarations[ 0 ].init.arguments && 51 │ 46 │ node.declarations[ 0 ].init.arguments.length > 0 ) { 52 │ 47 │ if ( node.declarations[ 0 ].init && 53 │ 48 │ node.declarations[ 0 ].init.callee.name === 'require' ) { 54 │ 49 │ var lhs = node.declarations[ 0 ].id.name; 55 │ 50 │ var rhs = node.declarations[ 0 ].init.arguments[ 0 ].value; - ..\circuit-construction-kit-common\js\blackbox\model\ChallengeSet.js: 153-212 ..\circuit-construction-kit-common\js\blackbox\model\ChallengeSet.js: 222-281 153 │ 222 │ } 154 │ 223 │ ], 155 │ 224 │ batteries: [], 156 │ 225 │ lightBulbs: [], 157 │ 226 │ resistors: [ 158 │ 227 │ { 159 │ 228 │ resistance: 10, 160 │ 229 │ startVertex: 3, 161 │ 230 │ endVertex: 4 162 │ 231 │ } 163 │ 232 │ ], 164 │ 233 │ switches: [], 165 │ 234 │ vertices: [ 166 │ 235 │ { 167 │ 236 │ x: 381, 168 │ 237 │ y: 305 169 │ 238 │ }, 170 │ 239 │ { 171 │ 240 │ x: 641, 172 │ 241 │ y: 305 173 │ 242 │ }, 174 │ 243 │ { 175 │ 244 │ x: 508.6893353941268, 176 │ 245 │ y: 178.18907779495106 177 │ 246 │ }, 178 │ 247 │ { 179 │ 248 │ x: 494.73089897821814, 180 │ 249 │ y: 243.01287667140764, 181 │ 250 │ options: { 182 │ 251 │ attachable: false 183 │ 252 │ } 184 │ 253 │ }, 185 │ 254 │ { 186 │ 255 │ x: 575.7047913446678, 187 │ 256 │ y: 317.4657393096343, 188 │ 257 │ options: { 189 │ 258 │ attachable: false 190 │ 259 │ } 191 │ 260 │ }, 192 │ 261 │ { 193 │ 262 │ x: 474.16074188562595, 194 │ 263 │ y: 304.80422462648113, 195 │ 264 │ options: { 196 │ 265 │ attachable: false 197 │ 266 │ } 198 │ 267 │ } 199 │ 268 │ ] 200 │ 269 │ }, 201 │ 270 │ { 202 │ 271 │ wires: [ 203 │ 272 │ { 204 │ 273 │ resistivity: resistivity, 205 │ 274 │ startVertex: 2, 206 │ 275 │ endVertex: 3 207 │ 276 │ }, 208 │ 277 │ { 209 │ 278 │ resistivity: resistivity, 210 │ 279 │ startVertex: 4, 211 │ 280 │ endVertex: 1 212 │ 281 │ }, - ..\circuit-construction-kit-common\js\blackbox\model\ChallengeSet.js: 498-531 ..\circuit-construction-kit-common\js\blackbox\model\ChallengeSet.js: 676-709 498 │ 676 │ y: 306.68553459119494, 499 │ 677 │ options: { 500 │ 678 │ attachable: false 501 │ 679 │ } 502 │ 680 │ } 503 │ 681 │ ] 504 │ 682 │ }, 505 │ 683 │ 506 │ 684 │ { 507 │ 685 │ wires: [ 508 │ 686 │ { 509 │ 687 │ resistivity: resistivity, 510 │ 688 │ startVertex: 0, 511 │ 689 │ endVertex: 4 512 │ 690 │ }, 513 │ 691 │ { 514 │ 692 │ resistivity: resistivity, 515 │ 693 │ startVertex: 5, 516 │ 694 │ endVertex: 2 517 │ 695 │ }, 518 │ 696 │ { 519 │ 697 │ resistivity: resistivity, 520 │ 698 │ startVertex: 7, 521 │ 699 │ endVertex: 1 522 │ 700 │ }, 523 │ 701 │ { 524 │ 702 │ resistivity: resistivity, 525 │ 703 │ startVertex: 6, 526 │ 704 │ endVertex: 3 527 │ 705 │ }, 528 │ 706 │ { 529 │ 707 │ resistivity: resistivity, 530 │ 708 │ startVertex: 6, 531 │ 709 │ endVertex: 7 - ..\circuit-construction-kit-common\js\blackbox\view\BlackBoxSceneView.js: 165-178 ..\circuit-construction-kit-common\js\blackbox\view\BlackBoxSceneView.js: 182-195 165 │ 182 │ var vertices = blackBoxSceneModel.circuit.findAllConnectedVertices( vertex ); 166 │ 183 │ var connectedToBlackBox = vertices.filter( function( v ) {return v.blackBoxInterface;} ).length > 0; 167 │ 184 │ if ( !connectedToBlackBox ) { 168 │ 185 │ for ( var i = 0; i < vertices.length; i++ ) { 169 │ 186 │ var vertexInGroup = vertices[ i ]; 170 │ 187 │ 171 │ 188 │ var closestPoint = blackBoxNode.bounds.eroded( 30 ).closestPointTo( vertexInGroup.position ); 172 │ 189 │ var delta = closestPoint.minus( vertexInGroup.position ); 173 │ 190 │ 174 │ 191 │ self.circuitNode.translateVertexGroup( vertexInGroup, vertices, delta, null, [] ); 175 │ 192 │ } 176 │ 193 │ } 177 │ 194 │ })(); 178 │ 195 │ - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-44 ..\circuit-construction-kit-common\js\circuit-construction-kit-common-config.js: 10-43 11 │ 10 │ deps: [ 'area-model-multiplication-main' ], 12 │ 11 │ 13 │ 12 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 13 │ 15 │ 14 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 15 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 16 │ paths: { 18 │ 17 │ 19 │ 18 │ // third-party libs 20 │ 19 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 20 │ 22 │ 21 │ // PhET plugins 23 │ 22 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 23 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 24 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 25 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 26 │ 28 │ 27 │ // common directories, uppercase names to identify them in require imports 29 │ 28 │ AXON: '../../axon/js', 30 │ 29 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 30 │ DOT: '../../dot/js', 32 │ 31 │ JOIST: '../../joist/js', 33 │ 32 │ KITE: '../../kite/js', 34 │ 33 │ PHET_CORE: '../../phet-core/js', 35 │ 34 │ PHET_IO: '../../phet-io/js', 36 │ 35 │ PHETCOMMON: '../../phetcommon/js', 37 │ 36 │ REPOSITORY: '..', 38 │ 37 │ SCENERY: '../../scenery/js', 39 │ 38 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 39 │ SUN: '../../sun/js', 41 │ 40 │ TANDEM: '../../tandem/js', 42 │ 41 │ 43 │ 42 │ // this sim 44 │ 43 │ AREA_MODEL_MULTIPLICATION: '.' - ..\circuit-construction-kit-common\js\common\view\CCKLightBulbForegroundNode.js: 30-51 ..\circuit-construction-kit-common\js\common\view\CCKLightBulbNode.js: 40-61 30 │ 40 │ scale: 3.5 31 │ 41 │ } ); 32 │ 42 │ var contentScale = 2.5; 33 │ 43 │ var scratchMatrix = new Matrix3(); 34 │ 44 │ var scratchMatrix2 = new Matrix3(); 35 │ 45 │ var updateLayout = function( startPosition, endPosition ) { 36 │ 46 │ var angle = endPosition.minus( startPosition ).angle() + Math.PI / 4; 37 │ 47 │ 38 │ 48 │ // Update the node transform in a single step, see #66 39 │ 49 │ scratchMatrix.setToTranslation( startPosition.x, startPosition.y ) 40 │ 50 │ .multiplyMatrix( scratchMatrix2.setToRotationZ( angle ) ) 41 │ 51 │ .multiplyMatrix( scratchMatrix2.setToScale( contentScale ) ); 42 │ 52 │ self.lightBulbNode.setMatrix( scratchMatrix ); 43 │ 53 │ 44 │ 54 │ self.highlightParent && self.highlightParent.setMatrix( scratchMatrix.copy() ); 45 │ 55 │ }; 46 │ 56 │ options = _.extend( { 47 │ 57 │ updateLayout: updateLayout, 48 │ 58 │ 49 │ 59 │ // Override the dimensions of the bulb node because the invisible rays contribute to the bounds. 50 │ 60 │ contentWidth: 12 * 0.2, 51 │ 61 │ contentHeight: 22 * 0.5, - ..\balloons-and-static-electricity\js\balloons-and-static-electricity\view\MinusChargeNode.js: 28-42 ..\circuit-construction-kit-common\js\common\view\ElectronNode.js: 30-44 28 │ 30 │ x: 0, y: 0, 29 │ 31 │ fill: new RadialGradient( 2, -3, 2, 2, -3, 7 ) 30 │ 32 │ .addColorStop( 0, '#4fcfff' ) 31 │ 33 │ .addColorStop( 0.5, '#2cbef5' ) 32 │ 34 │ .addColorStop( 1, '#00a9e8' ) 33 │ 35 │ } ), 34 │ 36 │ 35 │ 37 │ new Rectangle( 0, 0, 11, 2, { 36 │ 38 │ fill: 'white', 37 │ 39 │ centerX: 0, 38 │ 40 │ centerY: 0 39 │ 41 │ } ) 40 │ 42 │ ], scale: scale 41 │ 43 │ } ); 42 │ 44 │ - ..\circuit-construction-kit-common\js\common\view\SwitchNode.js: 37-96 ..\circuit-construction-kit-common\js\common\view\WireNode.js: 41-100 37 │ 41 │ this.switchModel = switchModel; 38 │ 42 │ 39 │ 43 │ var highlightNode = new Path( null, { 40 │ 44 │ stroke: CircuitConstructionKitConstants.highlightColor, 41 │ 45 │ lineWidth: CircuitConstructionKitConstants.highlightLineWidth, 42 │ 46 │ pickable: false, 43 │ 47 │ visible: false 44 │ 48 │ } ); 45 │ 49 │ 46 │ 50 │ // In order to show a gradient on the line, while still allowing the line to stretch (without stretching rounded 47 │ 51 │ // ends), use a parent node to position and rotate the line, and keep the line the same width. 48 │ 52 │ // This increases the complexity of the code, but allows us to use Line renderer with a constant gradient. 49 │ 53 │ 50 │ 54 │ /** 51 │ 55 │ * Create a LinearGradient for the wire, depending on the orientation relative to the shading (light comes from 52 │ 56 │ * top left) 53 │ 57 │ * @param {{point:number,color:Color}} array 54 │ 58 │ * @param {function} op 55 │ 59 │ * @returns {LinearGradient} 56 │ 60 │ */ 57 │ 61 │ var createGradient = function( array, op ) { 58 │ 62 │ var normalGradient = new LinearGradient( 0, -WIRE_LINE_WIDTH / 2, 0, WIRE_LINE_WIDTH / 2 ); 59 │ 63 │ array.forEach( function( element ) {normalGradient.addColorStop( op( element.point ), element.color );} ); 60 │ 64 │ return normalGradient; 61 │ 65 │ }; 62 │ 66 │ 63 │ 67 │ var array = [ 64 │ 68 │ { point: 0.0, color: new Color( '#7b332b' ).brighterColor( 0.8 ) }, 65 │ 69 │ { point: 0.2, color: new Color( '#cd7767' ) }, 66 │ 70 │ { point: 0.3, color: new Color( '#f6bda0' ) }, 67 │ 71 │ { point: 1.0, color: new Color( '#3c0c08' ) } 68 │ 72 │ ]; 69 │ 73 │ 70 │ 74 │ var normalGradient = createGradient( array, function( e ) {return e;} ); 71 │ 75 │ var reverseGradient = createGradient( array.reverse(), function( e ) {return 1.0 - e;} ); 72 │ 76 │ 73 │ 77 │ var lineNode = new Line( 0, 0, 100, 0, { 74 │ 78 │ stroke: normalGradient, 75 │ 79 │ lineWidth: WIRE_LINE_WIDTH, 76 │ 80 │ cursor: 'pointer', 77 │ 81 │ strokePickable: true, 78 │ 82 │ lineCap: 'round' 79 │ 83 │ } ); 80 │ 84 │ 81 │ 85 │ var lineNodeParent = new Node( { 82 │ 86 │ children: [ lineNode ] 83 │ 87 │ } ); 84 │ 88 │ var highlightNodeParent = new Node( { 85 │ 89 │ children: [ highlightNode ] 86 │ 90 │ } ); 87 │ 91 │ 88 │ 92 │ circuitNode && circuitNode.highlightLayer.addChild( highlightNodeParent ); 89 │ 93 │ 90 │ 94 │ // @private 91 │ 95 │ this.lineNodeParent = lineNodeParent; 92 │ 96 │ 93 │ 97 │ // @private 94 │ 98 │ this.lineNode = lineNode; 95 │ 99 │ CircuitElementNode.call( this, switchModel, { 96 │ 100 │ children: [ - ..\circuit-construction-kit-common\js\common\view\SwitchNode.js: 141-153 ..\circuit-construction-kit-common\js\common\view\WireNode.js: 134-146 141 │ 134 │ var deltaVector = endPoint.minus( switchModel.startVertex.position ); 142 │ 135 │ lineNodeParent.setRotation( deltaVector.angle() ); 143 │ 136 │ highlightNodeParent.setRotation( deltaVector.angle() ); 144 │ 137 │ if ( highlightNode.visible ) { 145 │ 138 │ highlightNode.shape = self.getHighlightStrokedShape( highlightStrokeStyles ); 146 │ 139 │ } 147 │ 140 │ 148 │ 141 │ // normal angle 149 │ 142 │ var directionForNormalLighting = new Vector2( 167.67173252279636, 72.6241134751773 ); // sampled manually 150 │ 143 │ var dot = directionForNormalLighting.dot( deltaVector ); 151 │ 144 │ 152 │ 145 │ lineNode.stroke = dot < 0 ? reverseGradient : normalGradient; 153 │ 146 │ - ..\circuit-construction-kit-common\js\common\view\SwitchNode.js: 241-256 ..\circuit-construction-kit-common\js\common\view\WireNode.js: 236-251 241 │ 236 │ this.disposeSwitchNode(); 242 │ 237 │ CircuitElementNode.prototype.dispose.call( this ); 243 │ 238 │ }, 244 │ 239 │ 245 │ 240 │ // @private 246 │ 241 │ getHighlightStrokedShape: function( lineStyles ) { 247 │ 242 │ return this.lineNode.shape.getStrokedShape( lineStyles ); 248 │ 243 │ }, 249 │ 244 │ 250 │ 245 │ // @public 251 │ 246 │ getStrokedShape: function() { 252 │ 247 │ return this.lineNode.getStrokedShape().transformed( this.lineNodeParent.matrix ); 253 │ 248 │ } 254 │ 249 │ } ); 255 │ 250 │ } ); - ..\circuit-construction-kit-common\js\energy\EnergyScreen.js: 13-40 ..\circuit-construction-kit-common\js\explore\ExploreScreen.js: 13-40 13 │ 13 │ var EnergyScreenView = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/energy/view/EnergyScreenView' ); 14 │ 14 │ var inherit = require( 'PHET_CORE/inherit' ); 15 │ 15 │ var Screen = require( 'JOIST/Screen' ); 16 │ 16 │ var Rectangle = require( 'SCENERY/nodes/Rectangle' ); 17 │ 17 │ var CircuitConstructionKitConstants = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/CircuitConstructionKitConstants' ); 18 │ 18 │ var VBox = require( 'SCENERY/nodes/VBox' ); 19 │ 19 │ var HBox = require( 'SCENERY/nodes/HBox' ); 20 │ 20 │ var Image = require( 'SCENERY/nodes/Image' ); 21 │ 21 │ var ResistorNode = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/common/view/ResistorNode' ); 22 │ 22 │ var Vertex = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/common/model/Vertex' ); 23 │ 23 │ var Resistor = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/common/model/Resistor' ); 24 │ 24 │ var Wire = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/common/model/Wire' ); 25 │ 25 │ var WireNode = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/common/view/WireNode' ); 26 │ 26 │ var CustomLightBulbNode = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/common/view/CustomLightBulbNode' ); 27 │ 27 │ var Property = require( 'AXON/Property' ); 28 │ 28 │ var Color = require( 'SCENERY/util/Color' ); 29 │ 29 │ 30 │ 30 │ // images 31 │ 31 │ var batteryImage = require( 'mipmap!CIRCUIT_CONSTRUCTION_KIT_COMMON/battery.png' ); 32 │ 32 │ 33 │ 33 │ // constants 34 │ 34 │ var backgroundColor = CircuitConstructionKitConstants.backgroundColor; 35 │ 35 │ 36 │ 36 │ /** 37 │ 37 │ * @constructor 38 │ 38 │ */ 39 │ 39 │ function EnergyScreen( tandem ) { 40 │ 40 │ - ..\circuit-construction-kit-common\js\energy\EnergyScreen.js: 39-55 ..\circuit-construction-kit-common\js\explore\ExploreScreen.js: 39-55 39 │ 39 │ function EnergyScreen( tandem ) { 40 │ 40 │ 41 │ 41 │ var icon = new Rectangle( 0, 0, Screen.MINIMUM_HOME_SCREEN_ICON_SIZE.width, Screen.MINIMUM_HOME_SCREEN_ICON_SIZE.height, { 42 │ 42 │ fill: backgroundColor 43 │ 43 │ } ); 44 │ 44 │ 45 │ 45 │ var wireNode = new WireNode( null, null, new Wire( new Vertex( 0, 0 ), new Vertex( 100, 0 ), 0 ), null, tandem.createTandem( 'wireIcon' ) ); 46 │ 46 │ var resistorNode = new ResistorNode( null, null, new Resistor( new Vertex( 0, 0 ), new Vertex( Resistor.RESISTOR_LENGTH, 0 ), CircuitConstructionKitConstants.defaultResistance ), 47 │ 47 │ tandem.createTandem( 'resistorIcon' ), { icon: true } ); 48 │ 48 │ var battery = new Image( batteryImage ); 49 │ 49 │ var lightBulbNode = new CustomLightBulbNode( new Property( 0 ) ); // TODO: For all icons, use image instead of something with a lot of LightRayNode lines 50 │ 50 │ 51 │ 51 │ var elementWidth = 50; 52 │ 52 │ resistorNode.mutate( { scale: elementWidth / resistorNode.width * 0.75 } ); 53 │ 53 │ wireNode.mutate( { scale: elementWidth / wireNode.width * 0.7 } ); 54 │ 54 │ battery.mutate( { scale: elementWidth / battery.width } ); 55 │ 55 │ lightBulbNode.mutate( { scale: elementWidth / lightBulbNode.width / 2 } ); - ..\circuit-construction-kit-common\js\energy\EnergyScreen.js: 51-71 ..\circuit-construction-kit-common\js\explore\ExploreScreen.js: 57-77 51 │ 57 │ var elementWidth = 50; 52 │ 58 │ resistorNode.mutate( { scale: elementWidth / resistorNode.width * 0.75 } ); 53 │ 59 │ wireNode.mutate( { scale: elementWidth / wireNode.width * 0.7 } ); 54 │ 60 │ battery.mutate( { scale: elementWidth / battery.width } ); 55 │ 61 │ lightBulbNode.mutate( { scale: elementWidth / lightBulbNode.width / 2 } ); 56 │ 62 │ var vBox = new VBox( { 57 │ 63 │ spacing: 20, 58 │ 64 │ children: [ new HBox( { spacing: 20, children: [ wireNode, resistorNode ] } ), new HBox( { 59 │ 65 │ spacing: 20, 60 │ 66 │ children: [ battery, lightBulbNode ] 61 │ 67 │ } ) ] 62 │ 68 │ } ); 63 │ 69 │ vBox.mutate( { 64 │ 70 │ scale: icon.height / vBox.height * 0.8, 65 │ 71 │ center: icon.center 66 │ 72 │ } ); 67 │ 73 │ icon.addChild( vBox ); 68 │ 74 │ 69 │ 75 │ var options = { 70 │ 76 │ name: 'Energy', //TODO i18n 71 │ 77 │ backgroundColorProperty: new Property( Color.toColor( backgroundColor ) ), - ..\circuit-construction-kit-common\js\energy\EnergyScreen.js: 13-40 ..\circuit-construction-kit-common\js\intro\IntroScreen.js: 13-40 13 │ 13 │ var EnergyScreenView = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/energy/view/EnergyScreenView' ); 14 │ 14 │ var inherit = require( 'PHET_CORE/inherit' ); 15 │ 15 │ var Screen = require( 'JOIST/Screen' ); 16 │ 16 │ var Rectangle = require( 'SCENERY/nodes/Rectangle' ); 17 │ 17 │ var CircuitConstructionKitConstants = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/CircuitConstructionKitConstants' ); 18 │ 18 │ var VBox = require( 'SCENERY/nodes/VBox' ); 19 │ 19 │ var HBox = require( 'SCENERY/nodes/HBox' ); 20 │ 20 │ var Image = require( 'SCENERY/nodes/Image' ); 21 │ 21 │ var ResistorNode = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/common/view/ResistorNode' ); 22 │ 22 │ var Vertex = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/common/model/Vertex' ); 23 │ 23 │ var Resistor = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/common/model/Resistor' ); 24 │ 24 │ var Wire = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/common/model/Wire' ); 25 │ 25 │ var WireNode = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/common/view/WireNode' ); 26 │ 26 │ var CustomLightBulbNode = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/common/view/CustomLightBulbNode' ); 27 │ 27 │ var Property = require( 'AXON/Property' ); 28 │ 28 │ var Color = require( 'SCENERY/util/Color' ); 29 │ 29 │ 30 │ 30 │ // images 31 │ 31 │ var batteryImage = require( 'mipmap!CIRCUIT_CONSTRUCTION_KIT_COMMON/battery.png' ); 32 │ 32 │ 33 │ 33 │ // constants 34 │ 34 │ var backgroundColor = CircuitConstructionKitConstants.backgroundColor; 35 │ 35 │ 36 │ 36 │ /** 37 │ 37 │ * @constructor 38 │ 38 │ */ 39 │ 39 │ function EnergyScreen( tandem ) { 40 │ 40 │ - ..\circuit-construction-kit-common\js\energy\EnergyScreen.js: 41-52 ..\circuit-construction-kit-common\js\intro\IntroScreen.js: 41-52 41 │ 41 │ var icon = new Rectangle( 0, 0, Screen.MINIMUM_HOME_SCREEN_ICON_SIZE.width, Screen.MINIMUM_HOME_SCREEN_ICON_SIZE.height, { 42 │ 42 │ fill: backgroundColor 43 │ 43 │ } ); 44 │ 44 │ 45 │ 45 │ var wireNode = new WireNode( null, null, new Wire( new Vertex( 0, 0 ), new Vertex( 100, 0 ), 0 ), null, tandem.createTandem( 'wireIcon' ) ); 46 │ 46 │ var resistorNode = new ResistorNode( null, null, new Resistor( new Vertex( 0, 0 ), new Vertex( Resistor.RESISTOR_LENGTH, 0 ), CircuitConstructionKitConstants.defaultResistance ), 47 │ 47 │ tandem.createTandem( 'resistorIcon' ), { icon: true } ); 48 │ 48 │ var battery = new Image( batteryImage ); 49 │ 49 │ var lightBulbNode = new CustomLightBulbNode( new Property( 0 ) ); // TODO: For all icons, use image instead of something with a lot of LightRayNode lines 50 │ 50 │ 51 │ 51 │ var elementWidth = 50; 52 │ 52 │ resistorNode.mutate( { scale: elementWidth / resistorNode.width * 0.75 } ); - ..\circuit-construction-kit-common\js\explore\ExploreScreen.js: 50-77 ..\circuit-construction-kit-common\js\intro\IntroScreen.js: 46-73 50 │ 46 │ null, 51 │ 47 │ tandem.createTandem( 'resistorIcon' ), { 52 │ 48 │ icon: true 53 │ 49 │ } ); 54 │ 50 │ var battery = new Image( batteryImage ); 55 │ 51 │ var lightBulbNode = new CustomLightBulbNode( new Property( 0 ) ); 56 │ 52 │ 57 │ 53 │ var elementWidth = 50; 58 │ 54 │ resistorNode.mutate( { scale: elementWidth / resistorNode.width * 0.75 } ); 59 │ 55 │ wireNode.mutate( { scale: elementWidth / wireNode.width * 0.7 } ); 60 │ 56 │ battery.mutate( { scale: elementWidth / battery.width } ); 61 │ 57 │ lightBulbNode.mutate( { scale: elementWidth / lightBulbNode.width / 2 } ); 62 │ 58 │ var vBox = new VBox( { 63 │ 59 │ spacing: 20, 64 │ 60 │ children: [ new HBox( { spacing: 20, children: [ wireNode, resistorNode ] } ), new HBox( { 65 │ 61 │ spacing: 20, 66 │ 62 │ children: [ battery, lightBulbNode ] 67 │ 63 │ } ) ] 68 │ 64 │ } ); 69 │ 65 │ vBox.mutate( { 70 │ 66 │ scale: icon.height / vBox.height * 0.8, 71 │ 67 │ center: icon.center 72 │ 68 │ } ); 73 │ 69 │ icon.addChild( vBox ); 74 │ 70 │ 75 │ 71 │ var options = { 76 │ 72 │ name: 'Explore', //TODO i18n 77 │ 73 │ backgroundColorProperty: new Property( Color.toColor( CircuitConstructionKitConstants.backgroundColor ) ), - ..\circuit-construction-kit-common\js\energy\EnergyScreen.js: 13-40 ..\circuit-construction-kit-common\js\lab\LabScreen.js: 13-40 13 │ 13 │ var EnergyScreenView = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/energy/view/EnergyScreenView' ); 14 │ 14 │ var inherit = require( 'PHET_CORE/inherit' ); 15 │ 15 │ var Screen = require( 'JOIST/Screen' ); 16 │ 16 │ var Rectangle = require( 'SCENERY/nodes/Rectangle' ); 17 │ 17 │ var CircuitConstructionKitConstants = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/CircuitConstructionKitConstants' ); 18 │ 18 │ var VBox = require( 'SCENERY/nodes/VBox' ); 19 │ 19 │ var HBox = require( 'SCENERY/nodes/HBox' ); 20 │ 20 │ var Image = require( 'SCENERY/nodes/Image' ); 21 │ 21 │ var ResistorNode = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/common/view/ResistorNode' ); 22 │ 22 │ var Vertex = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/common/model/Vertex' ); 23 │ 23 │ var Resistor = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/common/model/Resistor' ); 24 │ 24 │ var Wire = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/common/model/Wire' ); 25 │ 25 │ var WireNode = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/common/view/WireNode' ); 26 │ 26 │ var CustomLightBulbNode = require( 'CIRCUIT_CONSTRUCTION_KIT_COMMON/common/view/CustomLightBulbNode' ); 27 │ 27 │ var Property = require( 'AXON/Property' ); 28 │ 28 │ var Color = require( 'SCENERY/util/Color' ); 29 │ 29 │ 30 │ 30 │ // images 31 │ 31 │ var batteryImage = require( 'mipmap!CIRCUIT_CONSTRUCTION_KIT_COMMON/battery.png' ); 32 │ 32 │ 33 │ 33 │ // constants 34 │ 34 │ var backgroundColor = CircuitConstructionKitConstants.backgroundColor; 35 │ 35 │ 36 │ 36 │ /** 37 │ 37 │ * @constructor 38 │ 38 │ */ 39 │ 39 │ function EnergyScreen( tandem ) { 40 │ 40 │ - ..\circuit-construction-kit-common\js\intro\IntroScreen.js: 39-73 ..\circuit-construction-kit-common\js\lab\LabScreen.js: 39-73 39 │ 39 │ function IntroScreen( tandem ) { 40 │ 40 │ 41 │ 41 │ var icon = new Rectangle( 0, 0, Screen.MINIMUM_NAVBAR_ICON_SIZE.width, Screen.MINIMUM_NAVBAR_ICON_SIZE.height, { 42 │ 42 │ fill: backgroundColor 43 │ 43 │ } ); 44 │ 44 │ 45 │ 45 │ var wireNode = new WireNode( null, null, new Wire( new Vertex( 0, 0 ), new Vertex( 100, 0 ), 0 ), null, tandem.createTandem( 'wireIcon' ) ); 46 │ 46 │ var resistorNode = new ResistorNode( null, null, new Resistor( new Vertex( 0, 0 ), new Vertex( Resistor.RESISTOR_LENGTH, 0 ), CircuitConstructionKitConstants.defaultResistance ), 47 │ 47 │ tandem.createTandem( 'resistorIcon' ), { 48 │ 48 │ icon: true 49 │ 49 │ } ); 50 │ 50 │ var battery = new Image( batteryImage ); 51 │ 51 │ var lightBulbNode = new CustomLightBulbNode( new Property( 0 ) ); 52 │ 52 │ 53 │ 53 │ var elementWidth = 50; 54 │ 54 │ resistorNode.mutate( { scale: elementWidth / resistorNode.width * 0.75 } ); 55 │ 55 │ wireNode.mutate( { scale: elementWidth / wireNode.width * 0.7 } ); 56 │ 56 │ battery.mutate( { scale: elementWidth / battery.width } ); 57 │ 57 │ lightBulbNode.mutate( { scale: elementWidth / lightBulbNode.width / 2 } ); 58 │ 58 │ var vBox = new VBox( { 59 │ 59 │ spacing: 20, 60 │ 60 │ children: [ new HBox( { spacing: 20, children: [ wireNode, resistorNode ] } ), new HBox( { 61 │ 61 │ spacing: 20, 62 │ 62 │ children: [ battery, lightBulbNode ] 63 │ 63 │ } ) ] 64 │ 64 │ } ); 65 │ 65 │ vBox.mutate( { 66 │ 66 │ scale: icon.height / vBox.height * 0.8, 67 │ 67 │ center: icon.center 68 │ 68 │ } ); 69 │ 69 │ icon.addChild( vBox ); 70 │ 70 │ 71 │ 71 │ var options = { 72 │ 72 │ name: 'Intro', //TODO i18n 73 │ 73 │ homeScreenIcon: icon, - ..\build-a-molecule\tests\qunit\unit-tests.js: 3-16 ..\circuit-construction-kit-common\tests\qunit\unit-tests.js: 2-15 3 │ 2 │ function runBuildAMoleculeTests( pathToTestBase ) { 4 │ 3 │ function loadTestFile( src ) { 5 │ 4 │ var script = document.createElement( 'script' ); 6 │ 5 │ script.type = 'text/javascript'; 7 │ 6 │ script.async = false; 8 │ 7 │ 9 │ 8 │ // make sure things aren't cached, just in case 10 │ 9 │ script.src = pathToTestBase + '/' + src + '?random=' + Math.random().toFixed( 10 ); 11 │ 10 │ 12 │ 11 │ document.getElementsByTagName( 'head' )[ 0 ].appendChild( script ); 13 │ 12 │ } 14 │ 13 │ 15 │ 14 │ loadTestFile( 'js/model.js' ); 16 │ 15 │ }; - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-42 ..\circuit-construction-kit-black-box-study\js\circuit-construction-kit-black-box-study-config.js: 10-41 11 │ 10 │ deps: [ 'area-model-multiplication-main' ], 12 │ 11 │ 13 │ 12 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 13 │ 15 │ 14 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 15 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 16 │ paths: { 18 │ 17 │ 19 │ 18 │ // third-party libs 20 │ 19 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 20 │ 22 │ 21 │ // PhET plugins 23 │ 22 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 23 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 24 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 25 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 26 │ 28 │ 27 │ // common directories, uppercase names to identify them in require imports 29 │ 28 │ AXON: '../../axon/js', 30 │ 29 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 30 │ DOT: '../../dot/js', 32 │ 31 │ JOIST: '../../joist/js', 33 │ 32 │ KITE: '../../kite/js', 34 │ 33 │ PHET_CORE: '../../phet-core/js', 35 │ 34 │ PHET_IO: '../../phet-io/js', 36 │ 35 │ PHETCOMMON: '../../phetcommon/js', 37 │ 36 │ REPOSITORY: '..', 38 │ 37 │ SCENERY: '../../scenery/js', 39 │ 38 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 39 │ SUN: '../../sun/js', 41 │ 40 │ TANDEM: '../../tandem/js', 42 │ 41 │ - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-47 ..\circuit-construction-kit-dc\js\circuit-construction-kit-dc-config.js: 10-46 11 │ 10 │ deps: [ 'area-model-multiplication-main' ], 12 │ 11 │ 13 │ 12 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 13 │ 15 │ 14 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 15 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 16 │ paths: { 18 │ 17 │ 19 │ 18 │ // third-party libs 20 │ 19 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 20 │ 22 │ 21 │ // PhET plugins 23 │ 22 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 23 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 24 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 25 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 26 │ 28 │ 27 │ // common directories, uppercase names to identify them in require imports 29 │ 28 │ AXON: '../../axon/js', 30 │ 29 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 30 │ DOT: '../../dot/js', 32 │ 31 │ JOIST: '../../joist/js', 33 │ 32 │ KITE: '../../kite/js', 34 │ 33 │ PHET_CORE: '../../phet-core/js', 35 │ 34 │ PHET_IO: '../../phet-io/js', 36 │ 35 │ PHETCOMMON: '../../phetcommon/js', 37 │ 36 │ REPOSITORY: '..', 38 │ 37 │ SCENERY: '../../scenery/js', 39 │ 38 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 39 │ SUN: '../../sun/js', 41 │ 40 │ TANDEM: '../../tandem/js', 42 │ 41 │ 43 │ 42 │ // this sim 44 │ 43 │ AREA_MODEL_MULTIPLICATION: '.' 45 │ 44 │ }, 46 │ 45 │ 47 │ 46 │ // optional cache buster to make browser refresh load all included scripts, can be disabled with ?cacheBuster=false - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-44 ..\color-vision\js\color-vision-config.js: 11-44 11 │ 11 │ deps: [ 'area-model-multiplication-main' ], 12 │ 12 │ 13 │ 13 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 14 │ 15 │ 15 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 16 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 17 │ paths: { 18 │ 18 │ 19 │ 19 │ // third-party libs 20 │ 20 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 21 │ 22 │ 22 │ // PhET plugins 23 │ 23 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 24 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 25 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 26 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 27 │ 28 │ 28 │ // common directories, uppercase names to identify them in require imports 29 │ 29 │ AXON: '../../axon/js', 30 │ 30 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 31 │ DOT: '../../dot/js', 32 │ 32 │ JOIST: '../../joist/js', 33 │ 33 │ KITE: '../../kite/js', 34 │ 34 │ PHET_CORE: '../../phet-core/js', 35 │ 35 │ PHET_IO: '../../phet-io/js', 36 │ 36 │ PHETCOMMON: '../../phetcommon/js', 37 │ 37 │ REPOSITORY: '..', 38 │ 38 │ SCENERY: '../../scenery/js', 39 │ 39 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 40 │ SUN: '../../sun/js', 41 │ 41 │ TANDEM: '../../tandem/js', 42 │ 42 │ 43 │ 43 │ // this sim 44 │ 44 │ AREA_MODEL_MULTIPLICATION: '.' - ..\color-vision\js\rgb\model\RGBPhotonBeam.js: 80-88 ..\color-vision\js\singlebulb\model\SingleBulbPhotonBeam.js: 154-162 80 │ 154 │ var x = this.beamLength + ColorVisionConstants.X_VELOCITY * timeElapsed; 81 │ 155 │ var yVelocity = ( Math.random() * ColorVisionConstants.FAN_FACTOR - ( ColorVisionConstants.FAN_FACTOR / 2 ) ) * 60; 82 │ 156 │ 83 │ 157 │ var initialY = yVelocity * ( 25 / 60 ) + ( ColorVisionConstants.BEAM_HEIGHT / 2 ); 84 │ 158 │ var deltaY = yVelocity * timeElapsed; 85 │ 159 │ var y = initialY + deltaY; 86 │ 160 │ 87 │ 161 │ this.photons.push( new RGBPhoton( new Vector2( x, y ), new Vector2( ColorVisionConstants.X_VELOCITY, yVelocity ), intensity ) ); 88 │ 162 │ } - ..\beers-law-lab\js\beers-law-lab-config.js: 11-39 ..\concentration\js\concentration-config.js: 11-39 11 │ 11 │ deps: [ 'beers-law-lab-main' ], 12 │ 12 │ 13 │ 13 │ paths: { 14 │ 14 │ 15 │ 15 │ // third-party libs 16 │ 16 │ text: '../../sherpa/lib/text-2.0.12', 17 │ 17 │ 18 │ 18 │ // PhET plugins 19 │ 19 │ image: '../../chipper/js/requirejs-plugins/image', 20 │ 20 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 21 │ 21 │ string: '../../chipper/js/requirejs-plugins/string', 22 │ 22 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 23 │ 23 │ 24 │ 24 │ // PhET libs, uppercase names to identify them in require.js imports 25 │ 25 │ AXON: '../../axon/js', 26 │ 26 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 27 │ 27 │ DOT: '../../dot/js', 28 │ 28 │ JOIST: '../../joist/js', 29 │ 29 │ KITE: '../../kite/js', 30 │ 30 │ NITROGLYCERIN: '../../nitroglycerin/js', 31 │ 31 │ PHET_CORE: '../../phet-core/js', 32 │ 32 │ PHET_IO: '../../phet-io/js', 33 │ 33 │ PHETCOMMON: '../../phetcommon/js', 34 │ 34 │ REPOSITORY: '..', 35 │ 35 │ SCENERY: '../../scenery/js', 36 │ 36 │ SCENERY_PHET: '../../scenery-phet/js', 37 │ 37 │ SUN: '../../sun/js', 38 │ 38 │ TANDEM: '../../tandem/js', 39 │ 39 │ - ..\curve-fitting\js\curve-fitting\view\BarometerR2Node.js: 11-20 ..\curve-fitting\js\curve-fitting\view\BarometerX2Node.js: 15-24 11 │ 15 │ var curveFitting = require( 'CURVE_FITTING/curveFitting' ); 12 │ 16 │ var CurveFittingConstants = require( 'CURVE_FITTING/curve-fitting/CurveFittingConstants' ); 13 │ 17 │ var inherit = require( 'PHET_CORE/inherit' ); 14 │ 18 │ var Line = require( 'SCENERY/nodes/Line' ); 15 │ 19 │ var Node = require( 'SCENERY/nodes/Node' ); 16 │ 20 │ var PhetFont = require( 'SCENERY_PHET/PhetFont' ); 17 │ 21 │ var RangeWithValue = require( 'DOT/RangeWithValue' ); 18 │ 22 │ var Rectangle = require( 'SCENERY/nodes/Rectangle' ); 19 │ 23 │ var Text = require( 'SCENERY/nodes/Text' ); 20 │ 24 │ - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-44 ..\curve-fitting\js\curve-fitting-config.js: 10-43 11 │ 10 │ deps: [ 'area-model-multiplication-main' ], 12 │ 11 │ 13 │ 12 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 13 │ 15 │ 14 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 15 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 16 │ paths: { 18 │ 17 │ 19 │ 18 │ // third-party libs 20 │ 19 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 20 │ 22 │ 21 │ // PhET plugins 23 │ 22 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 23 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 24 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 25 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 26 │ 28 │ 27 │ // common directories, uppercase names to identify them in require imports 29 │ 28 │ AXON: '../../axon/js', 30 │ 29 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 30 │ DOT: '../../dot/js', 32 │ 31 │ JOIST: '../../joist/js', 33 │ 32 │ KITE: '../../kite/js', 34 │ 33 │ PHET_CORE: '../../phet-core/js', 35 │ 34 │ PHET_IO: '../../phet-io/js', 36 │ 35 │ PHETCOMMON: '../../phetcommon/js', 37 │ 36 │ REPOSITORY: '..', 38 │ 37 │ SCENERY: '../../scenery/js', 39 │ 38 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 39 │ SUN: '../../sun/js', 41 │ 40 │ TANDEM: '../../tandem/js', 42 │ 41 │ 43 │ 42 │ // this sim 44 │ 43 │ AREA_MODEL_MULTIPLICATION: '.' - ..\dot\js\Bounds2.js: 59-82 ..\dot\js\Bounds3.js: 65-88 59 │ 65 │ dimension: 2, 60 │ 66 │ 61 │ 67 │ /*---------------------------------------------------------------------------* 62 │ 68 │ * Properties 63 │ 69 │ *---------------------------------------------------------------------------*/ 64 │ 70 │ 65 │ 71 │ /** 66 │ 72 │ * The width of the bounds, defined as maxX - minX. 67 │ 73 │ * @public 68 │ 74 │ * 69 │ 75 │ * @returns {number} 70 │ 76 │ */ 71 │ 77 │ getWidth: function() { return this.maxX - this.minX; }, 72 │ 78 │ get width() { return this.getWidth(); }, 73 │ 79 │ 74 │ 80 │ /** 75 │ 81 │ * The height of the bounds, defined as maxY - minY. 76 │ 82 │ * @public 77 │ 83 │ * 78 │ 84 │ * @returns {number} 79 │ 85 │ */ 80 │ 86 │ getHeight: function() { return this.maxY - this.minY; }, 81 │ 87 │ get height() { return this.getHeight(); }, 82 │ 88 │ - ..\dot\js\Bounds2.js: 178-199 ..\dot\js\Bounds3.js: 236-257 178 │ 236 │ get bottom() { return this.maxY; }, 179 │ 237 │ 180 │ 238 │ /** 181 │ 239 │ * The horizontal (X-coordinate) center of the bounds, averaging the minX and maxX. 182 │ 240 │ * @public 183 │ 241 │ * 184 │ 242 │ * @returns {number} 185 │ 243 │ */ 186 │ 244 │ getCenterX: function() { return ( this.maxX + this.minX ) / 2; }, 187 │ 245 │ get centerX() { return this.getCenterX(); }, 188 │ 246 │ 189 │ 247 │ /** 190 │ 248 │ * The vertical (Y-coordinate) center of the bounds, averaging the minY and maxY. 191 │ 249 │ * @public 192 │ 250 │ * 193 │ 251 │ * @returns {number} 194 │ 252 │ */ 195 │ 253 │ getCenterY: function() { return ( this.maxY + this.minY ) / 2; }, 196 │ 254 │ get centerY() { return this.getCenterY(); }, 197 │ 255 │ 198 │ 256 │ /** 199 │ 257 │ * The point (minX, minY), in the UI-coordinate upper-left. - ..\dot\js\Bounds2.js: 461-474 ..\dot\js\Bounds3.js: 387-400 461 │ 387 │ * @param {number} epsilon 462 │ 388 │ * @returns {boolean} - Whether difference between the two bounds has no min/max with an absolute value greater 463 │ 389 │ * than epsilon. 464 │ 390 │ */ 465 │ 391 │ equalsEpsilon: function( other, epsilon ) { 466 │ 392 │ epsilon = epsilon !== undefined ? epsilon : 0; 467 │ 393 │ var thisFinite = this.isFinite(); 468 │ 394 │ var otherFinite = other.isFinite(); 469 │ 395 │ if ( thisFinite && otherFinite ) { 470 │ 396 │ // both are finite, so we can use Math.abs() - it would fail with non-finite values like Infinity 471 │ 397 │ return Math.abs( this.minX - other.minX ) < epsilon && 472 │ 398 │ Math.abs( this.minY - other.minY ) < epsilon && 473 │ 399 │ Math.abs( this.maxX - other.maxX ) < epsilon && 474 │ 400 │ Math.abs( this.maxY - other.maxY ) < epsilon; - ..\dot\js\Bounds2.js: 474-487 ..\dot\js\Bounds3.js: 402-415 474 │ 402 │ Math.abs( this.maxY - other.maxY ) < epsilon; 475 │ 403 │ } 476 │ 404 │ else if ( thisFinite !== otherFinite ) { 477 │ 405 │ return false; // one is finite, the other is not. definitely not equal 478 │ 406 │ } 479 │ 407 │ else if ( this === other ) { 480 │ 408 │ return true; // exact same instance, must be equal 481 │ 409 │ } 482 │ 410 │ else { 483 │ 411 │ // epsilon only applies on finite dimensions. due to JS's handling of isFinite(), it's faster to check the sum of both 484 │ 412 │ return ( isFinite( this.minX + other.minX ) ? ( Math.abs( this.minX - other.minX ) < epsilon ) : ( this.minX === other.minX ) ) && 485 │ 413 │ ( isFinite( this.minY + other.minY ) ? ( Math.abs( this.minY - other.minY ) < epsilon ) : ( this.minY === other.minY ) ) && 486 │ 414 │ ( isFinite( this.maxX + other.maxX ) ? ( Math.abs( this.maxX - other.maxX ) < epsilon ) : ( this.maxX === other.maxX ) ) && 487 │ 415 │ ( isFinite( this.maxY + other.maxY ) ? ( Math.abs( this.maxY - other.maxY ) < epsilon ) : ( this.maxY === other.maxY ) ); - ..\dot\js\Bounds3.js: 456-467 ..\dot\js\Bounds3.js: 1009-1020 456 │ 1009 │ return new Bounds3( 457 │ 1010 │ Math.min( this.minX, bounds.minX ), 458 │ 1011 │ Math.min( this.minY, bounds.minY ), 459 │ 1012 │ Math.min( this.minZ, bounds.minZ ), 460 │ 1013 │ Math.max( this.maxX, bounds.maxX ), 461 │ 1014 │ Math.max( this.maxY, bounds.maxY ), 462 │ 1015 │ Math.max( this.maxZ, bounds.maxZ ) 463 │ 1016 │ ); 464 │ 1017 │ }, 465 │ 1018 │ 466 │ 1019 │ /** 467 │ 1020 │ * The smallest bounds that is contained by both this bounds and the input bounds, returned as a copy. - ..\dot\js\Bounds3.js: 477-486 ..\dot\js\Bounds3.js: 1030-1039 477 │ 1030 │ return new Bounds3( 478 │ 1031 │ Math.max( this.minX, bounds.minX ), 479 │ 1032 │ Math.max( this.minY, bounds.minY ), 480 │ 1033 │ Math.max( this.minZ, bounds.minZ ), 481 │ 1034 │ Math.min( this.maxX, bounds.maxX ), 482 │ 1035 │ Math.min( this.maxY, bounds.maxY ), 483 │ 1036 │ Math.min( this.maxZ, bounds.maxZ ) 484 │ 1037 │ ); 485 │ 1038 │ }, 486 │ 1039 │ // TODO: difference should be well-defined, but more logic is needed to compute - ..\dot\js\Bounds3.js: 501-512 ..\dot\js\Bounds3.js: 1053-1064 501 │ 1053 │ return new Bounds3( 502 │ 1054 │ Math.min( this.minX, x ), 503 │ 1055 │ Math.min( this.minY, y ), 504 │ 1056 │ Math.min( this.minZ, z ), 505 │ 1057 │ Math.max( this.maxX, x ), 506 │ 1058 │ Math.max( this.maxY, y ), 507 │ 1059 │ Math.max( this.maxZ, z ) 508 │ 1060 │ ); 509 │ 1061 │ }, 510 │ 1062 │ 511 │ 1063 │ /** 512 │ 1064 │ * The smallest bounds that contains this bounds and the input point, returned as a copy. - ..\dot\js\Matrix.js: 200-206 ..\dot\js\Matrix.js: 212-218 200 │ 212 │ plus: function( matrix ) { 201 │ 213 │ this.checkMatrixDimensions( matrix ); 202 │ 214 │ var result = new Matrix( this.m, this.n ); 203 │ 215 │ for ( var i = 0; i < this.m; i++ ) { 204 │ 216 │ for ( var j = 0; j < this.n; j++ ) { 205 │ 217 │ var index = result.index( i, j ); 206 │ 218 │ result.entries[ index ] = this.entries[ index ] + matrix.entries[ index ]; - ..\dot\js\Matrix.js: 200-207 ..\dot\js\Matrix.js: 247-254 200 │ 247 │ plus: function( matrix ) { 201 │ 248 │ this.checkMatrixDimensions( matrix ); 202 │ 249 │ var result = new Matrix( this.m, this.n ); 203 │ 250 │ for ( var i = 0; i < this.m; i++ ) { 204 │ 251 │ for ( var j = 0; j < this.n; j++ ) { 205 │ 252 │ var index = result.index( i, j ); 206 │ 253 │ result.entries[ index ] = this.entries[ index ] + matrix.entries[ index ]; 207 │ 254 │ } - ..\dot\js\Matrix.js: 236-242 ..\dot\js\Matrix.js: 259-265 236 │ 259 │ minusEquals: function( matrix ) { 237 │ 260 │ this.checkMatrixDimensions( matrix ); 238 │ 261 │ for ( var i = 0; i < this.m; i++ ) { 239 │ 262 │ for ( var j = 0; j < this.n; j++ ) { 240 │ 263 │ var index = this.index( i, j ); 241 │ 264 │ this.entries[ index ] = this.entries[ index ] - matrix.entries[ index ]; 242 │ 265 │ } - ..\dot\js\Matrix.js: 224-231 ..\dot\js\Matrix.js: 270-277 224 │ 270 │ minus: function( matrix ) { 225 │ 271 │ this.checkMatrixDimensions( matrix ); 226 │ 272 │ var result = new Matrix( this.m, this.n ); 227 │ 273 │ for ( var i = 0; i < this.m; i++ ) { 228 │ 274 │ for ( var j = 0; j < this.n; j++ ) { 229 │ 275 │ var index = this.index( i, j ); 230 │ 276 │ result.entries[ index ] = this.entries[ index ] - matrix.entries[ index ]; 231 │ 277 │ } - ..\dot\js\Matrix.js: 236-242 ..\dot\js\Matrix.js: 282-288 236 │ 282 │ minusEquals: function( matrix ) { 237 │ 283 │ this.checkMatrixDimensions( matrix ); 238 │ 284 │ for ( var i = 0; i < this.m; i++ ) { 239 │ 285 │ for ( var j = 0; j < this.n; j++ ) { 240 │ 286 │ var index = this.index( i, j ); 241 │ 287 │ this.entries[ index ] = this.entries[ index ] - matrix.entries[ index ]; 242 │ 288 │ } - ..\dot\js\Matrix.js: 224-231 ..\dot\js\Matrix.js: 293-300 224 │ 293 │ minus: function( matrix ) { 225 │ 294 │ this.checkMatrixDimensions( matrix ); 226 │ 295 │ var result = new Matrix( this.m, this.n ); 227 │ 296 │ for ( var i = 0; i < this.m; i++ ) { 228 │ 297 │ for ( var j = 0; j < this.n; j++ ) { 229 │ 298 │ var index = this.index( i, j ); 230 │ 299 │ result.entries[ index ] = this.entries[ index ] - matrix.entries[ index ]; 231 │ 300 │ } - ..\dot\js\Matrix.js: 539-548 ..\dot\js\Matrix.js: 554-563 539 │ 554 │ var dimension = 3; 540 │ 555 │ var n = vectors.length; 541 │ 556 │ var data = new ArrayType( dimension * n ); 542 │ 557 │ 543 │ 558 │ for ( var i = 0; i < n; i++ ) { 544 │ 559 │ var vector = vectors[ i ]; 545 │ 560 │ data[ i ] = vector.x; 546 │ 561 │ data[ i + n ] = vector.y; 547 │ 562 │ data[ i + 2 * n ] = vector.z; 548 │ 563 │ } - ..\dot\js\Matrix3.js: 346-356 ..\dot\js\Matrix3.js: 362-372 346 │ 362 │ case Types.AFFINE: 347 │ 363 │ det = this.getDeterminant(); 348 │ 364 │ if ( det !== 0 ) { 349 │ 365 │ return Matrix3.createFromPool( 350 │ 366 │ ( -this.m12() * this.m21() + this.m11() * this.m22() ) / det, 351 │ 367 │ ( this.m02() * this.m21() - this.m01() * this.m22() ) / det, 352 │ 368 │ ( -this.m02() * this.m11() + this.m01() * this.m12() ) / det, 353 │ 369 │ ( this.m12() * this.m20() - this.m10() * this.m22() ) / det, 354 │ 370 │ ( -this.m02() * this.m20() + this.m00() * this.m22() ) / det, 355 │ 371 │ ( this.m02() * this.m10() - this.m00() * this.m12() ) / det, 356 │ 372 │ 0, 0, 1, Types.AFFINE - ..\dot\js\Matrix3.js: 299-305 ..\dot\js\Matrix3.js: 553-559 299 │ 553 │ return Matrix3.createFromPool( 300 │ 554 │ this.m00() + m.m00(), this.m01() + m.m01(), this.m02() + m.m02(), 301 │ 555 │ this.m10() + m.m10(), this.m11() + m.m11(), this.m12() + m.m12(), 302 │ 556 │ this.m20() + m.m20(), this.m21() + m.m21(), this.m22() + m.m22() 303 │ 557 │ ); 304 │ 558 │ }, 305 │ 559 │ - ..\dot\js\Matrix3.js: 307-313 ..\dot\js\Matrix3.js: 561-567 307 │ 561 │ return Matrix3.createFromPool( 308 │ 562 │ this.m00() - m.m00(), this.m01() - m.m01(), this.m02() - m.m02(), 309 │ 563 │ this.m10() - m.m10(), this.m11() - m.m11(), this.m12() - m.m12(), 310 │ 564 │ this.m20() - m.m20(), this.m21() - m.m21(), this.m22() - m.m22() 311 │ 565 │ ); 312 │ 566 │ }, 313 │ 567 │ - ..\dot\js\Matrix3.js: 315-322 ..\dot\js\Matrix3.js: 569-576 315 │ 569 │ return Matrix3.createFromPool( 316 │ 570 │ this.m00(), this.m10(), this.m20(), 317 │ 571 │ this.m01(), this.m11(), this.m21(), 318 │ 572 │ this.m02(), this.m12(), this.m22(), ( this.type === Types.IDENTITY || this.type === Types.SCALING ) ? this.type : undefined 319 │ 573 │ ); 320 │ 574 │ }, 321 │ 575 │ 322 │ 576 │ negated: function() { - ..\dot\js\Matrix3.js: 349-366 ..\dot\js\Matrix3.js: 604-621 349 │ 604 │ return Matrix3.createFromPool( 350 │ 605 │ ( -this.m12() * this.m21() + this.m11() * this.m22() ) / det, 351 │ 606 │ ( this.m02() * this.m21() - this.m01() * this.m22() ) / det, 352 │ 607 │ ( -this.m02() * this.m11() + this.m01() * this.m12() ) / det, 353 │ 608 │ ( this.m12() * this.m20() - this.m10() * this.m22() ) / det, 354 │ 609 │ ( -this.m02() * this.m20() + this.m00() * this.m22() ) / det, 355 │ 610 │ ( this.m02() * this.m10() - this.m00() * this.m12() ) / det, 356 │ 611 │ 0, 0, 1, Types.AFFINE 357 │ 612 │ ); 358 │ 613 │ } 359 │ 614 │ else { 360 │ 615 │ throw new Error( 'Matrix could not be inverted, determinant === 0' ); 361 │ 616 │ } 362 │ 617 │ case Types.OTHER: 363 │ 618 │ det = this.getDeterminant(); 364 │ 619 │ if ( det !== 0 ) { 365 │ 620 │ return Matrix3.createFromPool( 366 │ 621 │ ( -this.m12() * this.m21() + this.m11() * this.m22() ) / det, - ..\dot\js\Matrix3.js: 601-624 ..\dot\js\Matrix3.js: 617-640 601 │ 617 │ case Types.AFFINE: 602 │ 618 │ det = this.getDeterminant(); 603 │ 619 │ if ( det !== 0 ) { 604 │ 620 │ return this.rowMajor( 605 │ 621 │ ( -this.m12() * this.m21() + this.m11() * this.m22() ) / det, 606 │ 622 │ ( this.m02() * this.m21() - this.m01() * this.m22() ) / det, 607 │ 623 │ ( -this.m02() * this.m11() + this.m01() * this.m12() ) / det, 608 │ 624 │ ( this.m12() * this.m20() - this.m10() * this.m22() ) / det, 609 │ 625 │ ( -this.m02() * this.m20() + this.m00() * this.m22() ) / det, 610 │ 626 │ ( this.m02() * this.m10() - this.m00() * this.m12() ) / det, 611 │ 627 │ 0, 0, 1, Types.AFFINE 612 │ 628 │ ); 613 │ 629 │ } 614 │ 630 │ else { 615 │ 631 │ throw new Error( 'Matrix could not be inverted, determinant === 0' ); 616 │ 632 │ } 617 │ 633 │ case Types.OTHER: 618 │ 634 │ det = this.getDeterminant(); 619 │ 635 │ if ( det !== 0 ) { 620 │ 636 │ return this.rowMajor( 621 │ 637 │ ( -this.m12() * this.m21() + this.m11() * this.m22() ) / det, 622 │ 638 │ ( this.m02() * this.m21() - this.m01() * this.m22() ) / det, 623 │ 639 │ ( -this.m02() * this.m11() + this.m01() * this.m12() ) / det, 624 │ 640 │ ( this.m12() * this.m20() - this.m10() * this.m22() ) / det, - ..\dot\js\Matrix3.js: 414-426 ..\dot\js\Matrix3.js: 676-688 414 │ 676 │ return Matrix3.createFromPool( 415 │ 677 │ this.m00() * m.m00() + this.m01() * m.m10(), 416 │ 678 │ this.m00() * m.m01() + this.m01() * m.m11(), 417 │ 679 │ this.m00() * m.m02() + this.m01() * m.m12() + this.m02(), 418 │ 680 │ this.m10() * m.m00() + this.m11() * m.m10(), 419 │ 681 │ this.m10() * m.m01() + this.m11() * m.m11(), 420 │ 682 │ this.m10() * m.m02() + this.m11() * m.m12() + this.m12(), 421 │ 683 │ 0, 0, 1, Types.AFFINE ); 422 │ 684 │ } 423 │ 685 │ 424 │ 686 │ // general case 425 │ 687 │ return Matrix3.createFromPool( 426 │ 688 │ this.m00() * m.m00() + this.m01() * m.m10() + this.m02() * m.m20(), - ..\dot\js\Matrix3.js: 425-436 ..\dot\js\Matrix3.js: 687-698 425 │ 687 │ return Matrix3.createFromPool( 426 │ 688 │ this.m00() * m.m00() + this.m01() * m.m10() + this.m02() * m.m20(), 427 │ 689 │ this.m00() * m.m01() + this.m01() * m.m11() + this.m02() * m.m21(), 428 │ 690 │ this.m00() * m.m02() + this.m01() * m.m12() + this.m02() * m.m22(), 429 │ 691 │ this.m10() * m.m00() + this.m11() * m.m10() + this.m12() * m.m20(), 430 │ 692 │ this.m10() * m.m01() + this.m11() * m.m11() + this.m12() * m.m21(), 431 │ 693 │ this.m10() * m.m02() + this.m11() * m.m12() + this.m12() * m.m22(), 432 │ 694 │ this.m20() * m.m00() + this.m21() * m.m10() + this.m22() * m.m20(), 433 │ 695 │ this.m20() * m.m01() + this.m21() * m.m11() + this.m22() * m.m21(), 434 │ 696 │ this.m20() * m.m02() + this.m21() * m.m12() + this.m22() * m.m22() ); 435 │ 697 │ }, 436 │ 698 │ - ..\dot\js\Matrix3.js: 275-284 ..\dot\js\Matrix4.js: 282-291 275 │ 282 │ this.m20() === m.m20() && this.m21() === m.m21() && this.m22() === m.m22(); 276 │ 283 │ }, 277 │ 284 │ 278 │ 285 │ // equality within a margin of error 279 │ 286 │ equalsEpsilon: function( m, epsilon ) { 280 │ 287 │ return Math.abs( this.m00() - m.m00() ) < epsilon && Math.abs( this.m01() - m.m01() ) < epsilon && Math.abs( this.m02() - m.m02() ) < epsilon && 281 │ 288 │ Math.abs( this.m10() - m.m10() ) < epsilon && Math.abs( this.m11() - m.m11() ) < epsilon && Math.abs( this.m12() - m.m12() ) < epsilon && 282 │ 289 │ Math.abs( this.m20() - m.m20() ) < epsilon && Math.abs( this.m21() - m.m21() ) < epsilon && Math.abs( this.m22() - m.m22() ) < epsilon; 283 │ 290 │ }, 284 │ 291 │ - ..\dot\js\Matrix3.js: 425-430 ..\dot\js\Matrix4.js: 430-435 425 │ 430 │ return Matrix3.createFromPool( 426 │ 431 │ this.m00() * m.m00() + this.m01() * m.m10() + this.m02() * m.m20(), 427 │ 432 │ this.m00() * m.m01() + this.m01() * m.m11() + this.m02() * m.m21(), 428 │ 433 │ this.m00() * m.m02() + this.m01() * m.m12() + this.m02() * m.m22(), 429 │ 434 │ this.m10() * m.m00() + this.m11() * m.m10() + this.m12() * m.m20(), 430 │ 435 │ this.m10() * m.m01() + this.m11() * m.m11() + this.m12() * m.m21(), - ..\dot\js\Matrix3.js: 428-433 ..\dot\js\Matrix4.js: 434-439 428 │ 434 │ this.m00() * m.m02() + this.m01() * m.m12() + this.m02() * m.m22(), 429 │ 435 │ this.m10() * m.m00() + this.m11() * m.m10() + this.m12() * m.m20(), 430 │ 436 │ this.m10() * m.m01() + this.m11() * m.m11() + this.m12() * m.m21(), 431 │ 437 │ this.m10() * m.m02() + this.m11() * m.m12() + this.m12() * m.m22(), 432 │ 438 │ this.m20() * m.m00() + this.m21() * m.m10() + this.m22() * m.m20(), 433 │ 439 │ this.m20() * m.m01() + this.m21() * m.m11() + this.m22() * m.m21(), - ..\dot\js\MatrixOps3.js: 125-138 ..\dot\js\MatrixOps3.js: 156-169 125 │ 156 │ var m8 = left[ 6 ] * right[ 2 ] + left[ 7 ] * right[ 5 ] + left[ 8 ] * right[ 8 ]; 126 │ 157 │ result[ 0 ] = m0; 127 │ 158 │ result[ 1 ] = m1; 128 │ 159 │ result[ 2 ] = m2; 129 │ 160 │ result[ 3 ] = m3; 130 │ 161 │ result[ 4 ] = m4; 131 │ 162 │ result[ 5 ] = m5; 132 │ 163 │ result[ 6 ] = m6; 133 │ 164 │ result[ 7 ] = m7; 134 │ 165 │ result[ 8 ] = m8; 135 │ 166 │ }, 136 │ 167 │ 137 │ 168 │ /* 138 │ 169 │ * Writes the matrix multiplication ( transpose( left ) * right ) into result. (in-place modification is OK) - ..\dot\js\MatrixOps3.js: 125-138 ..\dot\js\MatrixOps3.js: 187-200 125 │ 187 │ var m8 = left[ 6 ] * right[ 2 ] + left[ 7 ] * right[ 5 ] + left[ 8 ] * right[ 8 ]; 126 │ 188 │ result[ 0 ] = m0; 127 │ 189 │ result[ 1 ] = m1; 128 │ 190 │ result[ 2 ] = m2; 129 │ 191 │ result[ 3 ] = m3; 130 │ 192 │ result[ 4 ] = m4; 131 │ 193 │ result[ 5 ] = m5; 132 │ 194 │ result[ 6 ] = m6; 133 │ 195 │ result[ 7 ] = m7; 134 │ 196 │ result[ 8 ] = m8; 135 │ 197 │ }, 136 │ 198 │ 137 │ 199 │ /* 138 │ 200 │ * Writes the matrix multiplication ( transpose( left ) * right ) into result. (in-place modification is OK) - ..\dot\js\MatrixOps3.js: 187-200 ..\dot\js\MatrixOps3.js: 220-233 187 │ 220 │ var m8 = left[ 6 ] * right[ 6 ] + left[ 7 ] * right[ 7 ] + left[ 8 ] * right[ 8 ]; 188 │ 221 │ result[ 0 ] = m0; 189 │ 222 │ result[ 1 ] = m1; 190 │ 223 │ result[ 2 ] = m2; 191 │ 224 │ result[ 3 ] = m3; 192 │ 225 │ result[ 4 ] = m4; 193 │ 226 │ result[ 5 ] = m5; 194 │ 227 │ result[ 6 ] = m6; 195 │ 228 │ result[ 7 ] = m7; 196 │ 229 │ result[ 8 ] = m8; 197 │ 230 │ }, 198 │ 231 │ 199 │ 232 │ /* 200 │ 233 │ * Writes the matrix multiplication ( transpose( left ) * transpose( right ) ) into result. - ..\dot\js\MatrixOps3.js: 612-623 ..\dot\js\MatrixOps3.js: 639-650 612 │ 639 │ mult: function( m, n, p, left, right, result ) { 613 │ 640 │ assert && assert( left.length >= m * n ); 614 │ 641 │ assert && assert( right.length >= n * p ); 615 │ 642 │ assert && assert( result.length >= m * p ); 616 │ 643 │ assert && assert( left !== result && right !== result, 'In-place modification not implemented yet' ); 617 │ 644 │ 618 │ 645 │ for ( var row = 0; row < m; row++ ) { 619 │ 646 │ for ( var col = 0; col < p; col++ ) { 620 │ 647 │ var x = 0; 621 │ 648 │ for ( var k = 0; k < n; k++ ) { 622 │ 649 │ x += left[ this.index( m, n, row, k ) ] * right[ this.index( n, p, k, col ) ]; 623 │ 650 │ } - ..\dot\js\Sphere3.js: 52-64 ..\dot\js\Sphere3.js: 120-132 52 │ 120 │ intersect: function( ray, epsilon ) { 53 │ 121 │ var raydir = ray.direction; 54 │ 122 │ var pos = ray.position; 55 │ 123 │ var centerToRay = pos.minus( this.center ); 56 │ 124 │ 57 │ 125 │ // basically, we can use the quadratic equation to solve for both possible hit points (both +- roots are the hit points) 58 │ 126 │ var tmp = raydir.dot( centerToRay ); 59 │ 127 │ var centerToRayDistSq = centerToRay.magnitudeSquared(); 60 │ 128 │ var det = 4 * tmp * tmp - 4 * ( centerToRayDistSq - this.radius * this.radius ); 61 │ 129 │ if ( det < epsilon ) { 62 │ 130 │ // ray misses sphere entirely 63 │ 131 │ return null; 64 │ 132 │ } - ..\dot\js\Transform3.js: 80-112 ..\dot\js\Transform4.js: 88-120 80 │ 88 │ */ 81 │ 89 │ setMatrix: function( matrix ) { 82 │ 90 │ assert && assert( checkMatrix( matrix ), 'Matrix has NaNs, non-finite values, or isn\'t a matrix!' ); 83 │ 91 │ 84 │ 92 │ // copy the matrix over to our matrix 85 │ 93 │ this.matrix.set( matrix ); 86 │ 94 │ 87 │ 95 │ // set flags and notify 88 │ 96 │ this.invalidate(); 89 │ 97 │ }, 90 │ 98 │ 91 │ 99 │ /** 92 │ 100 │ * This should be called after our internal matrix is changed. It marks the other dependent matrices as invalid, 93 │ 101 │ * and sends out notifications of the change. 94 │ 102 │ * @private 95 │ 103 │ */ 96 │ 104 │ invalidate: function() { 97 │ 105 │ // sanity check 98 │ 106 │ assert && assert( this.matrix.isFinite() ); 99 │ 107 │ 100 │ 108 │ // dependent matrices now invalid 101 │ 109 │ this.inverseValid = false; 102 │ 110 │ this.transposeValid = false; 103 │ 111 │ this.inverseTransposeValid = false; 104 │ 112 │ 105 │ 113 │ this.trigger0( 'change' ); 106 │ 114 │ }, 107 │ 115 │ 108 │ 116 │ /** 109 │ 117 │ * Modifies the primary matrix such that: this.matrix = matrix * this.matrix. 110 │ 118 │ * @public 111 │ 119 │ * 112 │ 120 │ * @param {Matrix3} matrix - ..\dot\js\Transform3.js: 260-280 ..\dot\js\Transform4.js: 249-269 260 │ 249 │ */ 261 │ 250 │ getInverseTransposed: function() { 262 │ 251 │ if ( !this.inverseTransposeValid ) { 263 │ 252 │ this.inverseTransposeValid = true; 264 │ 253 │ 265 │ 254 │ this.inverseTransposed.set( this.getInverse() ); // triggers inverse to be valid 266 │ 255 │ this.inverseTransposed.transpose(); 267 │ 256 │ } 268 │ 257 │ return this.inverseTransposed; 269 │ 258 │ }, 270 │ 259 │ 271 │ 260 │ /** 272 │ 261 │ * Returns whether our primary matrix is known to be an identity matrix. If false is returned, it doesn't necessarily 273 │ 262 │ * mean our matrix isn't an identity matrix, just that it is unlikely in normal usage. 274 │ 263 │ * @public 275 │ 264 │ * 276 │ 265 │ * @returns {boolean} 277 │ 266 │ */ 278 │ 267 │ isIdentity: function() { 279 │ 268 │ return this.matrix.type === dot.Matrix3.Types.IDENTITY; 280 │ 269 │ }, - ..\dot\tests\qunit\js\binpacker.js: 98-119 ..\dot\tests\qunit\js\binpacker.js: 128-149 98 │ 128 │ bins.push( p.allocate( 0.07768157411677142, 0.2697811302108069 ) ); 99 │ 129 │ bins.push( p.allocate( 0.16336605860851705, 0.22413462478046617 ) ); 100 │ 130 │ bins.push( p.allocate( 0.1316782592330128, 0.12904599534037212 ) ); 101 │ 131 │ bins.push( p.allocate( 0.025292747964461643, 0.3277013657304148 ) ); 102 │ 132 │ bins.push( p.allocate( 0.06412563938647509, 0.21915481549998125 ) ); 103 │ 133 │ bins.push( p.allocate( 0.32486365052560967, 0.2792208661946158 ) ); 104 │ 134 │ bins.push( p.allocate( 0.10311868538459142, 0.2188195480654637 ) ); 105 │ 135 │ bins.push( p.allocate( 0.28303924466793734, 0.1862659997617205 ) ); 106 │ 136 │ bins.push( p.allocate( 0.08514244800123076, 0.10663530377981563 ) ); 107 │ 137 │ bins.push( p.allocate( 0.29217134749827284, 0.19149748445488513 ) ); 108 │ 138 │ bins.push( p.allocate( 0.027393308002501726, 0.21918218621673682 ) ); 109 │ 139 │ bins.push( p.allocate( 0.10661425278522074, 0.29555924283340573 ) ); 110 │ 140 │ bins.push( p.allocate( 0.2672333570662886, 0.27894352834361297 ) ); 111 │ 141 │ bins.push( p.allocate( 0.04347166659620901, 0.1237633553488801 ) ); 112 │ 142 │ bins.push( p.allocate( 0.05252628649274508, 0.07491425851670404 ) ); 113 │ 143 │ bins.push( p.allocate( 0.3171079190603147, 0.05559094832278788 ) ); 114 │ 144 │ bins.push( p.allocate( 0.0013751634396612644, 0.10906922242914636 ) ); 115 │ 145 │ bins.push( p.allocate( 0.10426920272099476, 0.3224470660400887 ) ); 116 │ 146 │ bins.push( p.allocate( 0.020921604009345174, 0.272700310839961 ) ); 117 │ 147 │ checkNoOverlappingBins( bins, bounds ); 118 │ 148 │ 119 │ 149 │ // remove some (every other one) - ..\dot\tests\qunit\js\matrix3.js: 56-69 ..\dot\tests\qunit\js\matrix3.js: 70-83 56 │ 70 │ var m = Matrix3.createFromPool( 1, 2, 3, 4, 5, 6, 7, 8, 9 ); 57 │ 71 │ equal( m.m00(), 1, 'm00' ); 58 │ 72 │ equal( m.m01(), 2, 'm01' ); 59 │ 73 │ equal( m.m02(), 3, 'm02' ); 60 │ 74 │ equal( m.m10(), 4, 'm10' ); 61 │ 75 │ equal( m.m11(), 5, 'm11' ); 62 │ 76 │ equal( m.m12(), 6, 'm12' ); 63 │ 77 │ equal( m.m20(), 7, 'm20' ); 64 │ 78 │ equal( m.m21(), 8, 'm21' ); 65 │ 79 │ equal( m.m22(), 9, 'm22' ); 66 │ 80 │ } ); 67 │ 81 │ 68 │ 82 │ test( 'Column-major', function() { 69 │ 83 │ var m = Matrix3.createFromPool(); - ..\build-a-molecule\tests\qunit\unit-tests.js: 3-17 ..\dot\tests\qunit\unit-tests.js: 3-17 3 │ 3 │ function runBuildAMoleculeTests( pathToTestBase ) { 4 │ 4 │ function loadTestFile( src ) { 5 │ 5 │ var script = document.createElement( 'script' ); 6 │ 6 │ script.type = 'text/javascript'; 7 │ 7 │ script.async = false; 8 │ 8 │ 9 │ 9 │ // make sure things aren't cached, just in case 10 │ 10 │ script.src = pathToTestBase + '/' + src + '?random=' + Math.random().toFixed( 10 ); 11 │ 11 │ 12 │ 12 │ document.getElementsByTagName( 'head' )[ 0 ].appendChild( script ); 13 │ 13 │ } 14 │ 14 │ 15 │ 15 │ loadTestFile( 'js/model.js' ); 16 │ 16 │ }; 17 │ 17 │ - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-44 ..\energy-forms-and-changes\js\energy-forms-and-changes-config.js: 11-44 11 │ 11 │ deps: [ 'area-model-multiplication-main' ], 12 │ 12 │ 13 │ 13 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 14 │ 15 │ 15 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 16 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 17 │ paths: { 18 │ 18 │ 19 │ 19 │ // third-party libs 20 │ 20 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 21 │ 22 │ 22 │ // PhET plugins 23 │ 23 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 24 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 25 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 26 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 27 │ 28 │ 28 │ // common directories, uppercase names to identify them in require imports 29 │ 29 │ AXON: '../../axon/js', 30 │ 30 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 31 │ DOT: '../../dot/js', 32 │ 32 │ JOIST: '../../joist/js', 33 │ 33 │ KITE: '../../kite/js', 34 │ 34 │ PHET_CORE: '../../phet-core/js', 35 │ 35 │ PHET_IO: '../../phet-io/js', 36 │ 36 │ PHETCOMMON: '../../phetcommon/js', 37 │ 37 │ REPOSITORY: '..', 38 │ 38 │ SCENERY: '../../scenery/js', 39 │ 39 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 40 │ SUN: '../../sun/js', 41 │ 41 │ TANDEM: '../../tandem/js', 42 │ 42 │ 43 │ 43 │ // this sim 44 │ 44 │ AREA_MODEL_MULTIPLICATION: '.' - ..\energy-forms-and-changes\js\energy-systems\model\BeakerHeater.js: 38-47 ..\energy-forms-and-changes\js\energy-systems\model\LightBulb.js: 36-45 38 │ 36 │ var HEATER_ELEMENT_ON_IMAGE = new EFACModelImage( HEATER_ELEMENT, HEATER_ELEMENT_OFFSET ); 39 │ 37 │ 40 │ 38 │ var OFFSET_TO_LEFT_SIDE_OF_WIRE = new Vector2( -0.04, -0.04 ); 41 │ 39 │ var OFFSET_TO_LEFT_SIDE_OF_WIRE_BEND = new Vector2( -0.02, -0.04 ); 42 │ 40 │ var OFFSET_TO_FIRST_WIRE_CURVE_POINT = new Vector2( -0.01, -0.0375 ); 43 │ 41 │ var OFFSET_TO_SECOND_WIRE_CURVE_POINT = new Vector2( -0.001, -0.025 ); 44 │ 42 │ var OFFSET_TO_THIRD_WIRE_CURVE_POINT = new Vector2( -0.0005, -0.0175 ); 45 │ 43 │ var OFFSET_TO_BOTTOM_OF_CONNECTOR = new Vector2( 0, -0.01 ); 46 │ 44 │ var OFFSET_TO_CONVERSION_POINT = new Vector2( 0, 0.012 ); 47 │ 45 │ - ..\energy-forms-and-changes\js\energy-systems\model\BeakerHeater.js: 335-355 ..\energy-forms-and-changes\js\energy-systems\model\LightBulb.js: 332-352 335 │ 332 │ path.push( startingPoint.plus( new Vector2( 0, HEATER_ELEMENT_2D_HEIGHT ).rotated( angle ) ) ); 336 │ 333 │ return path; 337 │ 334 │ }, 338 │ 335 │ 339 │ 336 │ /** 340 │ 337 │ * @param {Vector2} center 341 │ 338 │ * 342 │ 339 │ * @return {Vector2[]} 343 │ 340 │ * @private 344 │ 341 │ */ 345 │ 342 │ createElectricalEnergyChunkPath: function( center ) { 346 │ 343 │ var path = []; 347 │ 344 │ 348 │ 345 │ path.push( center.plus( OFFSET_TO_LEFT_SIDE_OF_WIRE_BEND ) ); 349 │ 346 │ path.push( center.plus( OFFSET_TO_FIRST_WIRE_CURVE_POINT ) ); 350 │ 347 │ path.push( center.plus( OFFSET_TO_SECOND_WIRE_CURVE_POINT ) ); 351 │ 348 │ path.push( center.plus( OFFSET_TO_THIRD_WIRE_CURVE_POINT ) ); 352 │ 349 │ path.push( center.plus( OFFSET_TO_BOTTOM_OF_CONNECTOR ) ); 353 │ 350 │ path.push( center.plus( OFFSET_TO_CONVERSION_POINT ) ); 354 │ 351 │ 355 │ 352 │ return path; - ..\energy-forms-and-changes\js\energy-systems\model\SunEnergySource.js: 14-25 ..\energy-forms-and-changes\js\energy-systems\model\TeaPot.js: 14-25 14 │ 14 │ var EFACConstants = require( 'ENERGY_FORMS_AND_CHANGES/common/EFACConstants' ); 15 │ 15 │ var Energy = require( 'ENERGY_FORMS_AND_CHANGES/energy-systems/model/Energy' ); 16 │ 16 │ var EnergyChunk = require( 'ENERGY_FORMS_AND_CHANGES/common/model/EnergyChunk' ); 17 │ 17 │ var energyFormsAndChanges = require( 'ENERGY_FORMS_AND_CHANGES/energyFormsAndChanges' ); 18 │ 18 │ var EnergySource = require( 'ENERGY_FORMS_AND_CHANGES/energy-systems/model/EnergySource' ); 19 │ 19 │ var EnergyType = require( 'ENERGY_FORMS_AND_CHANGES/common/model/EnergyType' ); 20 │ 20 │ var Image = require( 'SCENERY/nodes/Image' ); 21 │ 21 │ var inherit = require( 'PHET_CORE/inherit' ); 22 │ 22 │ var Property = require( 'AXON/Property' ); 23 │ 23 │ var Random = require( 'DOT/Random' ); 24 │ 24 │ var Util = require( 'DOT/Util' ); 25 │ 25 │ var Vector2 = require( 'DOT/Vector2' ); - ..\energy-forms-and-changes\js\energy-systems\view\FluorescentBulbNode.js: 29-47 ..\energy-forms-and-changes\js\energy-systems\view\IncandescentBulbNode.js: 28-46 29 │ 28 │ function FluorescentBulbNode( lightBulb, energyChunksVisibleProperty, modelViewTransform ) { 30 │ 29 │ 31 │ 30 │ EFACBaseNode.call( this, lightBulb, modelViewTransform ); 32 │ 31 │ 33 │ 32 │ var lightRays = new LightRays( Vector2.ZERO, 30, 400, 20, Color.YELLOW ); 34 │ 33 │ this.addChild( lightRays ); 35 │ 34 │ 36 │ 35 │ // Only show the light rays when the energy chunks are not shown. 37 │ 36 │ energyChunksVisibleProperty.link( function( visible ) { 38 │ 37 │ lightRays.setVisible( !visible ); 39 │ 38 │ } ); 40 │ 39 │ 41 │ 40 │ // Add the images and the layer that will contain the energy chunks. 42 │ 41 │ this.addChild( new EFACModelImageNode( LightBulb.WIRE_FLAT_IMAGE, modelViewTransform ) ); 43 │ 42 │ this.addChild( new EFACModelImageNode( LightBulb.WIRE_CURVE_IMAGE, modelViewTransform ) ); 44 │ 43 │ this.addChild( new EFACModelImageNode( LightBulb.ELEMENT_BASE_BACK_IMAGE, modelViewTransform ) ); 45 │ 44 │ this.addChild( new EnergyChunkLayer( lightBulb.energyChunkList, lightBulb.positionProperty, modelViewTransform ) ); 46 │ 45 │ this.addChild( new EFACModelImageNode( LightBulb.ELEMENT_BASE_FRONT_IMAGE, modelViewTransform ) ); 47 │ 46 │ - ..\energy-skate-park-basics\js\energy-skate-park-basics\model\DebugTracks.js: 38-46 ..\energy-skate-park-basics\js\energy-skate-park-basics\model\DebugTracks.js: 52-60 38 │ 52 │ model.skater.position.set( new Vector2( -5, 8 ) ); 39 │ 53 │ model.skater.released( 0, 0 ); 40 │ 54 │ 41 │ 55 │ controlPoints = [ createControlPoint( 3.9238282647584946, 3.1917866726296955 ), createControlPoint( 2.043971377459748, 4.847851073345259 ), createControlPoint( -1.116994633273702, 3.686296958855098 ), createControlPoint( -3.5806797853309487, 1.8639512522361352 ), createControlPoint( -5.982719141323793, 6.235364490161 ) ]; 42 │ 56 │ track = new Track( model, model.tracks, controlPoints, true, null, model.availableModelBoundsProperty, trackGroupTandem.createNextTandem() ); 43 │ 57 │ track.physical = true; 44 │ 58 │ model.tracks.add( track ); 45 │ 59 │ } 46 │ 60 │ - ..\energy-skate-park-basics\js\energy-skate-park-basics\model\DebugTracks.js: 69-74 ..\energy-skate-park-basics\js\energy-skate-park-basics\model\DebugTracks.js: 83-88 69 │ 83 │ controlPoints = [ createControlPoint( -1.8031842576028616, 3.53633273703041 ), createControlPoint( 1.7306618962432907, 2.8187991949910547 ), createControlPoint( 1.9246153846153842, 4.3405881037567084 ), createControlPoint( 3.834311270125223, 4.907529069767442 ), createControlPoint( 3.491162790697672, 1.0732177996422188 ), createControlPoint( -2.760107334525939, 1.461124776386404 ), createControlPoint( -5.162146690518783, 5.832538014311269 ) ]; 70 │ 84 │ track = new Track( model, model.tracks, controlPoints, true, null, model.availableModelBoundsProperty, trackGroupTandem.createNextTandem() ); 71 │ 85 │ track.physical = true; 72 │ 86 │ model.tracks.add( track ); 73 │ 87 │ } 74 │ 88 │ - ..\energy-skate-park-basics\js\energy-skate-park-basics\model\DebugTracks.js: 111-116 ..\energy-skate-park-basics\js\energy-skate-park-basics\model\DebugTracks.js: 125-130 111 │ 125 │ controlPoints = [ createControlPoint( 5.147227191413236, 6.57851296958855 ), createControlPoint( 0.05887058823529401, 1.0476264705882334 ), createControlPoint( -1.9427294117647067, 2.637132352941175 ), createControlPoint( -3.1201411764705886, 6.404849999999999 ), createControlPoint( 0.5690823529411766, 6.071249999999999 ), createControlPoint( -2.3940705882352944, 1.3419794117647044 ), createControlPoint( -5.474964705882353, 6.5029676470588225 ) ]; 112 │ 126 │ track = new Track( model, model.tracks, controlPoints, true, null, model.availableModelBoundsProperty, trackGroupTandem.createNextTandem() ); 113 │ 127 │ track.physical = true; 114 │ 128 │ model.tracks.add( track ); 115 │ 129 │ } 116 │ 130 │ - ..\energy-skate-park-basics\js\energy-skate-park-basics\model\DebugTracks.js: 139-144 ..\energy-skate-park-basics\js\energy-skate-park-basics\model\DebugTracks.js: 154-159 139 │ 154 │ controlPoints = [ createControlPoint( 5.07086859688196, 6.925682071269487 ), createControlPoint( 2.061781737193762, 0.7625271732714408 ), createControlPoint( 0.09287305122494338, 0.7625271732714408 ), createControlPoint( -3.287706013363029, 3.0472042334050697 ), createControlPoint( -2.2289532293986642, 4.399535077951003 ), createControlPoint( -0.6129621380846331, 4.306662026726059 ), createControlPoint( 0.7429844097995542, 3.3629726075698803 ), createControlPoint( 0.14859688195991083, 2.3227944338505053 ), createControlPoint( -1.4302449888641426, 1.4159674088426304 ), createControlPoint( -4.532204899777283, 0.580109947818132 ), createControlPoint( -6.1185746102449885, 7.75698912376468 ) ]; 140 │ 155 │ track = new Track( model, model.tracks, controlPoints, true, null, model.availableModelBoundsProperty, trackGroupTandem.createNextTandem() ); 141 │ 156 │ track.physical = true; 142 │ 157 │ model.tracks.add( track ); 143 │ 158 │ } 144 │ 159 │ - ..\energy-skate-park-basics\js\energy-skate-park-basics\model\DebugTracks.js: 137-146 ..\energy-skate-park-basics\js\energy-skate-park-basics\model\DebugTracks.js: 166-175 137 │ 166 │ model.skater.released( 0, 0 ); 138 │ 167 │ 139 │ 168 │ controlPoints = [ createControlPoint( 5.07086859688196, 6.925682071269487 ), createControlPoint( 2.061781737193762, 0.7625271732714408 ), createControlPoint( 0.09287305122494338, 0.7625271732714408 ), createControlPoint( -3.287706013363029, 3.0472042334050697 ), createControlPoint( -2.2289532293986642, 4.399535077951003 ), createControlPoint( -0.6129621380846331, 4.306662026726059 ), createControlPoint( 0.7429844097995542, 3.3629726075698803 ), createControlPoint( 0.14859688195991083, 2.3227944338505053 ), createControlPoint( -1.4302449888641426, 1.4159674088426304 ), createControlPoint( -4.532204899777283, 0.580109947818132 ), createControlPoint( -6.1185746102449885, 7.75698912376468 ) ]; 140 │ 169 │ track = new Track( model, model.tracks, controlPoints, true, null, model.availableModelBoundsProperty, trackGroupTandem.createNextTandem() ); 141 │ 170 │ track.physical = true; 142 │ 171 │ model.tracks.add( track ); 143 │ 172 │ } 144 │ 173 │ 145 │ 174 │ // Pops upside down in loop, PROBLEM 146 │ 175 │ if ( EnergySkateParkBasicsQueryParameters.testTrackIndex === 9 ) { - ..\energy-skate-park-basics\js\energy-skate-park-basics\model\DebugTracks.js: 190-203 ..\energy-skate-park-basics\js\energy-skate-park-basics\model\DebugTracks.js: 204-217 190 │ 204 │ model.detachable = true; 191 │ 205 │ // The skater falls through model track 192 │ 206 │ model.skater.position.set( new Vector2( 5, 7.9 ) ); 193 │ 207 │ model.skater.released( 0, 0 ); 194 │ 208 │ model.friction = 0.0363651226158039; 195 │ 209 │ 196 │ 210 │ controlPoints = [ createControlPoint( 0.8301088646967347, 3.5809234059097967 ), createControlPoint( 3.411228615863142, 2.4784350699844477 ), createControlPoint( 5.29194401244168, 5.928575038880248 ) ]; 197 │ 211 │ track = new Track( model, model.tracks, controlPoints, true, null, model.availableModelBoundsProperty, trackGroupTandem.createNextTandem() ); 198 │ 212 │ track.physical = true; 199 │ 213 │ model.tracks.add( track ); 200 │ 214 │ } 201 │ 215 │ 202 │ 216 │ if ( EnergySkateParkBasicsQueryParameters.testTrackIndex === 13 ) { 203 │ 217 │ - ..\energy-skate-park-basics\js\energy-skate-park-basics\model\Track.js: 657-668 ..\energy-skate-park-basics\js\energy-skate-park-basics\model\Track.js: 680-691 657 │ 680 │ var bestU = 0; 658 │ 681 │ 659 │ 682 │ // Search the entire space of the spline. Larger number of divisions was chosen to prevent large curvatures at a 660 │ 683 │ // single sampling point. 661 │ 684 │ var numDivisions = 400; 662 │ 685 │ var du = (this.maxPoint - this.minPoint) / numDivisions; 663 │ 686 │ for ( var parametricPosition = this.minPoint; parametricPosition < this.maxPoint; parametricPosition += du ) { 664 │ 687 │ this.getCurvature( parametricPosition, curvature ); 665 │ 688 │ var r = Math.abs( curvature.r ); 666 │ 689 │ if ( r < minRadius ) { 667 │ 690 │ minRadius = r; 668 │ 691 │ bestU = parametricPosition; - ..\energy-skate-park-basics\js\energy-skate-park-basics\view\FrictionControl.js: 4-21 ..\energy-skate-park-basics\js\energy-skate-park-basics\view\MassControlPanel.js: 4-21 4 │ 4 │ * 5 │ 5 │ * @author Sam Reid 6 │ 6 │ */ 7 │ 7 │ define( function( require ) { 8 │ 8 │ 'use strict'; 9 │ 9 │ 10 │ 10 │ // modules 11 │ 11 │ var energySkateParkBasics = require( 'ENERGY_SKATE_PARK_BASICS/energySkateParkBasics' ); 12 │ 12 │ var inherit = require( 'PHET_CORE/inherit' ); 13 │ 13 │ var VBox = require( 'SCENERY/nodes/VBox' ); 14 │ 14 │ var Text = require( 'SCENERY/nodes/Text' ); 15 │ 15 │ var PhetFont = require( 'SCENERY_PHET/PhetFont' ); 16 │ 16 │ var HSlider = require( 'SUN/HSlider' ); 17 │ 17 │ var Constants = require( 'ENERGY_SKATE_PARK_BASICS/energy-skate-park-basics/Constants' ); 18 │ 18 │ 19 │ 19 │ // strings 20 │ 20 │ var controlsFrictionTitleString = require( 'string!ENERGY_SKATE_PARK_BASICS/controls.friction.title' ); 21 │ 21 │ var controlsGravityNoneString = require( 'string!ENERGY_SKATE_PARK_BASICS/controls.gravity.none' ); - ..\estimation\js\common\view\CubeBackView.js: 29-45 ..\estimation\js\common\view\CubeView.js: 37-53 29 │ 37 │ this.addChild( dottedLineBack ); 30 │ 38 │ 31 │ 39 │ function updatePosition() { 32 │ 40 │ var transformedPosition = mvt.modelToViewPosition( cubeModel.positionProperty.value ); 33 │ 41 │ // Position is defined as the bottom left in this sim. 34 │ 42 │ self.left = transformedPosition.x; 35 │ 43 │ self.bottom = transformedPosition.y; 36 │ 44 │ } 37 │ 45 │ 38 │ 46 │ // Hook up the update functions 39 │ 47 │ cubeModel.sizeProperty.link( function() { 40 │ 48 │ var faceWidth = mvt.modelToViewDeltaX( cubeModel.sizeProperty.value.width ); 41 │ 49 │ var projectedDepth = mvt.modelToViewDeltaX( cubeModel.sizeProperty.value.depth ) * EstimationConstants.DEPTH_PROJECTION_PROPORTION; // Assumes x & y scales are the same. 42 │ 50 │ var projectionVector = Vector2.createPolar( projectedDepth, -EstimationConstants.CUBE_PROJECTION_ANGLE ); 43 │ 51 │ var height = -mvt.modelToViewDeltaY( cubeModel.sizeProperty.value.height ); 44 │ 52 │ var origin = new Vector2( projectionVector.x, height + projectionVector.y ); 45 │ 53 │ dottedLineBack.setShape( new Shape() - ..\estimation\js\explore\model\CubeExplorationMode.js: 89-114 ..\estimation\js\explore\model\CylinderExplorationMode.js: 78-103 89 │ 78 │ } 90 │ 79 │ } 91 │ 80 │ 92 │ 81 │ // Set the initial size of the continuous object. 93 │ 82 │ this.updateContinuousObjectSize( this.estimateProperty.value ); 94 │ 83 │ }, 95 │ 84 │ 96 │ 85 │ newReferenceObject: function() { 97 │ 86 │ // Choose a random size that hasn't been chosen for a while. 98 │ 87 │ var unique = false; 99 │ 88 │ var referenceObjectSize = null; 100 │ 89 │ while ( !unique ) { 101 │ 90 │ referenceObjectSize = VALID_REF_OBJECT_SIZES[ Math.floor( Math.random() * VALID_REF_OBJECT_SIZES.length ) ]; 102 │ 91 │ unique = ( referenceObjectSize !== this.previousReferenceObjectSize && referenceObjectSize !== this.referenceObject.size ); 103 │ 92 │ } 104 │ 93 │ this.previousReferenceObjectSize = referenceObjectSize; 105 │ 94 │ this.setReferenceObjectSize( referenceObjectSize ); 106 │ 95 │ }, 107 │ 96 │ 108 │ 97 │ setInitialReferenceObject: function() { 109 │ 98 │ this.setReferenceObjectSize( INITIAL_REFERENCE_OBJECT_SIZE ); 110 │ 99 │ }, 111 │ 100 │ 112 │ 101 │ updateDiscreteObjectVisibility: function( selectedMode, estimateValue ) { 113 │ 102 │ var targetNumVisibleDiscreteCubes = selectedMode === 'cubes' && this.continuousOrDiscreteProperty.value === 'discrete' ? estimateValue : 0; 114 │ 103 │ var startIndex = Math.min( this.numVisibleDiscreteCubes, targetNumVisibleDiscreteCubes ); - ..\estimation\js\explore\model\CubeExplorationMode.js: 93-110 ..\estimation\js\explore\model\LineExplorationMode.js: 58-75 93 │ 58 │ this.updateContinuousObjectSize( this.estimateProperty.value ); 94 │ 59 │ }, 95 │ 60 │ 96 │ 61 │ newReferenceObject: function() { 97 │ 62 │ // Choose a random size that hasn't been chosen for a while. 98 │ 63 │ var unique = false; 99 │ 64 │ var referenceObjectSize = null; 100 │ 65 │ while ( !unique ) { 101 │ 66 │ referenceObjectSize = VALID_REF_OBJECT_SIZES[ Math.floor( Math.random() * VALID_REF_OBJECT_SIZES.length ) ]; 102 │ 67 │ unique = ( referenceObjectSize !== this.previousReferenceObjectSize && referenceObjectSize !== this.referenceObject.size ); 103 │ 68 │ } 104 │ 69 │ this.previousReferenceObjectSize = referenceObjectSize; 105 │ 70 │ this.setReferenceObjectSize( referenceObjectSize ); 106 │ 71 │ }, 107 │ 72 │ 108 │ 73 │ setInitialReferenceObject: function() { 109 │ 74 │ this.setReferenceObjectSize( INITIAL_REFERENCE_OBJECT_SIZE ); 110 │ 75 │ }, - ..\estimation\js\explore\model\CubeExplorationMode.js: 87-114 ..\estimation\js\explore\model\RectangleExplorationMode.js: 79-106 87 │ 79 │ numCubesPlaced++; 88 │ 80 │ } 89 │ 81 │ } 90 │ 82 │ } 91 │ 83 │ 92 │ 84 │ // Set the initial size of the continuous object. 93 │ 85 │ this.updateContinuousObjectSize( this.estimateProperty.value ); 94 │ 86 │ }, 95 │ 87 │ 96 │ 88 │ newReferenceObject: function() { 97 │ 89 │ // Choose a random size that hasn't been chosen for a while. 98 │ 90 │ var unique = false; 99 │ 91 │ var referenceObjectSize = null; 100 │ 92 │ while ( !unique ) { 101 │ 93 │ referenceObjectSize = VALID_REF_OBJECT_SIZES[ Math.floor( Math.random() * VALID_REF_OBJECT_SIZES.length ) ]; 102 │ 94 │ unique = ( referenceObjectSize !== this.previousReferenceObjectSize && referenceObjectSize !== this.referenceObject.size ); 103 │ 95 │ } 104 │ 96 │ this.previousReferenceObjectSize = referenceObjectSize; 105 │ 97 │ this.setReferenceObjectSize( referenceObjectSize ); 106 │ 98 │ }, 107 │ 99 │ 108 │ 100 │ setInitialReferenceObject: function() { 109 │ 101 │ this.setReferenceObjectSize( INITIAL_REFERENCE_OBJECT_SIZE ); 110 │ 102 │ }, 111 │ 103 │ 112 │ 104 │ updateDiscreteObjectVisibility: function( selectedMode, estimateValue ) { 113 │ 105 │ var targetNumVisibleDiscreteCubes = selectedMode === 'cubes' && this.continuousOrDiscreteProperty.value === 'discrete' ? estimateValue : 0; 114 │ 106 │ var startIndex = Math.min( this.numVisibleDiscreteCubes, targetNumVisibleDiscreteCubes ); - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-44 ..\example-sim\js\example-sim-config.js: 11-44 11 │ 11 │ deps: [ 'area-model-multiplication-main' ], 12 │ 12 │ 13 │ 13 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 14 │ 15 │ 15 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 16 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 17 │ paths: { 18 │ 18 │ 19 │ 19 │ // third-party libs 20 │ 20 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 21 │ 22 │ 22 │ // PhET plugins 23 │ 23 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 24 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 25 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 26 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 27 │ 28 │ 28 │ // common directories, uppercase names to identify them in require imports 29 │ 29 │ AXON: '../../axon/js', 30 │ 30 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 31 │ DOT: '../../dot/js', 32 │ 32 │ JOIST: '../../joist/js', 33 │ 33 │ KITE: '../../kite/js', 34 │ 34 │ PHET_CORE: '../../phet-core/js', 35 │ 35 │ PHET_IO: '../../phet-io/js', 36 │ 36 │ PHETCOMMON: '../../phetcommon/js', 37 │ 37 │ REPOSITORY: '..', 38 │ 38 │ SCENERY: '../../scenery/js', 39 │ 39 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 40 │ SUN: '../../sun/js', 41 │ 41 │ TANDEM: '../../tandem/js', 42 │ 42 │ 43 │ 43 │ // this sim 44 │ 44 │ AREA_MODEL_MULTIPLICATION: '.' - ..\area-model-multiplication\js\area-model-multiplication-config.js: 23-42 ..\expression-exchange\js\expression-exchange-config.js: 23-42 23 │ 23 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 24 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 25 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 26 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 27 │ 28 │ 28 │ // common directories, uppercase names to identify them in require imports 29 │ 29 │ AXON: '../../axon/js', 30 │ 30 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 31 │ DOT: '../../dot/js', 32 │ 32 │ JOIST: '../../joist/js', 33 │ 33 │ KITE: '../../kite/js', 34 │ 34 │ PHET_CORE: '../../phet-core/js', 35 │ 35 │ PHET_IO: '../../phet-io/js', 36 │ 36 │ PHETCOMMON: '../../phetcommon/js', 37 │ 37 │ REPOSITORY: '..', 38 │ 38 │ SCENERY: '../../scenery/js', 39 │ 39 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 40 │ SUN: '../../sun/js', 41 │ 41 │ TANDEM: '../../tandem/js', 42 │ 42 │ - ..\area-builder\js\game\view\StartGameLevelNode.js: 14-27 ..\expression-exchange\js\game\view\StartGameLevelNode.js: 12-25 14 │ 12 │ var AreaBuilderSharedConstants = require( 'AREA_BUILDER/common/AreaBuilderSharedConstants' ); 15 │ 13 │ var inherit = require( 'PHET_CORE/inherit' ); 16 │ 14 │ var LevelSelectionButton = require( 'VEGAS/LevelSelectionButton' ); 17 │ 15 │ var Node = require( 'SCENERY/nodes/Node' ); 18 │ 16 │ var PhetFont = require( 'SCENERY_PHET/PhetFont' ); 19 │ 17 │ var ResetAllButton = require( 'SCENERY_PHET/buttons/ResetAllButton' ); 20 │ 18 │ var SoundToggleButton = require( 'SCENERY_PHET/buttons/SoundToggleButton' ); 21 │ 19 │ var Text = require( 'SCENERY/nodes/Text' ); 22 │ 20 │ var TimerToggleButton = require( 'SCENERY_PHET/buttons/TimerToggleButton' ); 23 │ 21 │ var Vector2 = require( 'DOT/Vector2' ); 24 │ 22 │ 25 │ 23 │ // strings 26 │ 24 │ var chooseYourLevelString = require( 'string!AREA_BUILDER/chooseYourLevel' ); 27 │ 25 │ - ..\area-builder\js\game\view\StartGameLevelNode.js: 26-57 ..\expression-exchange\js\game\view\StartGameLevelNode.js: 24-55 26 │ 24 │ var chooseYourLevelString = require( 'string!AREA_BUILDER/chooseYourLevel' ); 27 │ 25 │ 28 │ 26 │ // constants 29 │ 27 │ var CONTROL_BUTTON_TOUCH_AREA_DILATION = 4; 30 │ 28 │ 31 │ 29 │ /** 32 │ 30 │ * @param {Function} startLevelFunction - Function used to initiate a game 33 │ 31 │ * level, will be called with a zero-based index value. 34 │ 32 │ * @param {Function} resetFunction - Function to reset game and scores. 35 │ 33 │ * @param {Property} timerEnabledProperty 36 │ 34 │ * @param {Property} soundEnabledProperty 37 │ 35 │ * @param {Array} iconNodes - Set of iconNodes to use on the buttons, sizes 38 │ 36 │ * should be the same, length of array must match number of levels. 39 │ 37 │ * @param {Array} scores - Current scores, used to decide which stars to 40 │ 38 │ * illuminate on the level start buttons, length must match number of levels. 41 │ 39 │ * @param {Object} [options] - See code below for options and default values. 42 │ 40 │ * @constructor 43 │ 41 │ */ 44 │ 42 │ function StartGameLevelNode( startLevelFunction, resetFunction, timerEnabledProperty, soundEnabledProperty, iconNodes, scores, options ) { 45 │ 43 │ 46 │ 44 │ Node.call( this ); 47 │ 45 │ 48 │ 46 │ options = _.extend( { 49 │ 47 │ // Defaults 50 │ 48 │ numLevels: 4, 51 │ 49 │ titleString: chooseYourLevelString, 52 │ 50 │ maxTitleWidth: 500, 53 │ 51 │ numStarsOnButtons: 5, 54 │ 52 │ perfectScore: 10, 55 │ 53 │ buttonBackgroundColor: '#A8BEFF', 56 │ 54 │ numButtonRows: 1, // For layout 57 │ 55 │ controlsInset: 12, - ..\area-builder\js\game\view\StartGameLevelNode.js: 58-129 ..\expression-exchange\js\game\view\StartGameLevelNode.js: 57-128 58 │ 57 │ size: AreaBuilderSharedConstants.LAYOUT_BOUNDS 59 │ 58 │ }, options ); 60 │ 59 │ 61 │ 60 │ // Verify parameters 62 │ 61 │ if ( iconNodes.length !== options.numLevels || scores.length !== options.numLevels ) { 63 │ 62 │ throw new Error( 'Number of game levels doesn\'t match length of provided arrays' ); 64 │ 63 │ } 65 │ 64 │ 66 │ 65 │ // Title 67 │ 66 │ var title = new Text( options.titleString, { font: new PhetFont( 30 ), maxWidth: options.maxTitleWidth } ); 68 │ 67 │ this.addChild( title ); 69 │ 68 │ 70 │ 69 │ // Add the buttons 71 │ 70 │ function createLevelStartFunction( level ) { 72 │ 71 │ return function() { startLevelFunction( level ); }; 73 │ 72 │ } 74 │ 73 │ 75 │ 74 │ var buttons = new Array( options.numLevels ); 76 │ 75 │ for ( var i = 0; i < options.numLevels; i++ ) { 77 │ 76 │ buttons[ i ] = new LevelSelectionButton( 78 │ 77 │ iconNodes[ i ], 79 │ 78 │ options.numStarsOnButtons, 80 │ 79 │ createLevelStartFunction( i ), 81 │ 80 │ scores[ i ], 82 │ 81 │ options.perfectScore, 83 │ 82 │ { 84 │ 83 │ baseColor: options.buttonBackgroundColor 85 │ 84 │ } 86 │ 85 │ ); 87 │ 86 │ buttons[ i ].scale( 0.80 ); 88 │ 87 │ this.addChild( buttons[ i ] ); 89 │ 88 │ } 90 │ 89 │ 91 │ 90 │ // Sound and timer controls. 92 │ 91 │ var timerToggleButton = new TimerToggleButton( timerEnabledProperty, { 93 │ 92 │ touchAreaXDilation: CONTROL_BUTTON_TOUCH_AREA_DILATION, 94 │ 93 │ touchAreaYDilation: CONTROL_BUTTON_TOUCH_AREA_DILATION 95 │ 94 │ } ); 96 │ 95 │ this.addChild( timerToggleButton ); 97 │ 96 │ var soundToggleButton = new SoundToggleButton( soundEnabledProperty, { 98 │ 97 │ touchAreaXDilation: CONTROL_BUTTON_TOUCH_AREA_DILATION, 99 │ 98 │ touchAreaYDilation: CONTROL_BUTTON_TOUCH_AREA_DILATION 100 │ 99 │ } ); 101 │ 100 │ this.addChild( soundToggleButton ); 102 │ 101 │ 103 │ 102 │ // Reset button. 104 │ 103 │ var resetButton = new ResetAllButton( { listener: resetFunction, radius: 22, touchAreaDilation: 7 } ); 105 │ 104 │ this.addChild( resetButton ); 106 │ 105 │ 107 │ 106 │ // Layout 108 │ 107 │ var numColumns = options.numLevels / options.numButtonRows; 109 │ 108 │ var buttonSpacingX = buttons[ 0 ].width * 1.2; // Note: Assumes all buttons are the same size. 110 │ 109 │ var buttonSpacingY = buttons[ 0 ].height * 1.2; // Note: Assumes all buttons are the same size. 111 │ 110 │ var firstButtonOrigin = new Vector2( options.size.width / 2 - ( numColumns - 1 ) * buttonSpacingX / 2, 112 │ 111 │ options.size.height * 0.5 - ( ( options.numButtonRows - 1 ) * buttonSpacingY ) / 2 ); 113 │ 112 │ for ( var row = 0; row < options.numButtonRows; row++ ) { 114 │ 113 │ for ( var col = 0; col < numColumns; col++ ) { 115 │ 114 │ var buttonIndex = row * numColumns + col; 116 │ 115 │ buttons[ buttonIndex ].centerX = firstButtonOrigin.x + col * buttonSpacingX; 117 │ 116 │ buttons[ buttonIndex ].centerY = firstButtonOrigin.y + row * buttonSpacingY; 118 │ 117 │ } 119 │ 118 │ } 120 │ 119 │ resetButton.right = options.size.width - options.controlsInset; 121 │ 120 │ resetButton.bottom = options.size.height - options.controlsInset; 122 │ 121 │ title.centerX = options.size.width / 2; 123 │ 122 │ title.centerY = buttons[ 0 ].top / 2; 124 │ 123 │ soundToggleButton.left = options.controlsInset; 125 │ 124 │ soundToggleButton.bottom = options.size.height - options.controlsInset; 126 │ 125 │ timerToggleButton.left = options.controlsInset; 127 │ 126 │ timerToggleButton.bottom = soundToggleButton.top - 10; 128 │ 127 │ } 129 │ 128 │ - ..\expression-exchange\js\explore\view\EEExploreIconNode.js: 4-20 ..\expression-exchange\js\variables\view\EEVariablesIconNode.js: 4-20 4 │ 4 │ * 5 │ 5 │ * @author John Blanco 6 │ 6 │ */ 7 │ 7 │ define( function( require ) { 8 │ 8 │ 'use strict'; 9 │ 9 │ 10 │ 10 │ // modules 11 │ 11 │ var EESharedConstants = require( 'EXPRESSION_EXCHANGE/common/EESharedConstants' ); 12 │ 12 │ var expressionExchange = require( 'EXPRESSION_EXCHANGE/expressionExchange' ); 13 │ 13 │ var inherit = require( 'PHET_CORE/inherit' ); 14 │ 14 │ var MathSymbolFont = require( 'SCENERY_PHET/MathSymbolFont' ); 15 │ 15 │ var Node = require( 'SCENERY/nodes/Node' ); 16 │ 16 │ var PhetFont = require( 'SCENERY_PHET/PhetFont' ); 17 │ 17 │ var Rectangle = require( 'SCENERY/nodes/Rectangle' ); 18 │ 18 │ var Screen = require( 'JOIST/Screen' ); 19 │ 19 │ var Text = require( 'SCENERY/nodes/Text' ); 20 │ 20 │ - ..\capacitor-lab-basics\js\common\view\BulbNode.js: 127-184 ..\faradays-law\js\faradays-law\view\BulbNode.js: 40-97 127 │ 40 │ var iconNode = new Node( options ); 128 │ 41 │ 129 │ 42 │ // Create the base of the bulb 130 │ 43 │ var bulbBase = new Image( bulbBaseImage ); 131 │ 44 │ bulbBase.scale( BULB_BASE_WIDTH / bulbBase.bounds.height ); 132 │ 45 │ 133 │ 46 │ // Important Note: For the drawing code below, the reference frame is assumed to be such that the point x=0, y=0 is 134 │ 47 │ // at the left side of the light bulb base, which is also the right side of the light bulb body, and the vertical 135 │ 48 │ // center of both. This was the easiest to work with. 136 │ 49 │ 137 │ 50 │ // Create the bulb body. 138 │ 51 │ var bulbNeckWidth = BULB_BASE_WIDTH * 0.85; 139 │ 52 │ var bulbBodyHeight = BULB_HEIGHT - bulbBase.bounds.width; 140 │ 53 │ var controlPointYValue = BULB_WIDTH * 0.7; 141 │ 54 │ var bulbShape = new Shape().moveTo( 0, -bulbNeckWidth / 2 ).cubicCurveTo( -bulbBodyHeight * 0.33, -controlPointYValue, -bulbBodyHeight * 0.95, -controlPointYValue, -bulbBodyHeight, 0 ).cubicCurveTo( -bulbBodyHeight * 0.95, controlPointYValue, -bulbBodyHeight * 0.33, 142 │ 55 │ controlPointYValue, 0, bulbNeckWidth / 2 ); 143 │ 56 │ var bulbBodyOutline = new Path( bulbShape, { 144 │ 57 │ stroke: 'black', 145 │ 58 │ lineCap: 'round' 146 │ 59 │ } ); 147 │ 60 │ var bulbBodyFill = new Path( bulbShape, { 148 │ 61 │ fill: new RadialGradient( bulbBodyOutline.centerX, bulbBodyOutline.centerY, BULB_WIDTH / 10, bulbBodyOutline.centerX, 149 │ 62 │ bulbBodyOutline.centerY, BULB_WIDTH / 2 ).addColorStop( 0, '#eeeeee' ).addColorStop( 1, '#bbccbb' ) 150 │ 63 │ } ); 151 │ 64 │ 152 │ 65 │ // Create the filament support wires. 153 │ 66 │ var filamentWireHeight = bulbBodyHeight * 0.6; 154 │ 67 │ var filamentTopPoint = new Vector2( -filamentWireHeight, -BULB_WIDTH * 0.3 ); 155 │ 68 │ var filamentBottomPoint = new Vector2( -filamentWireHeight, BULB_WIDTH * 0.3 ); 156 │ 69 │ var filamentSupportWiresShape = new Shape(); 157 │ 70 │ filamentSupportWiresShape.moveTo( 0, -BULB_BASE_WIDTH * 0.3 ); 158 │ 71 │ filamentSupportWiresShape.cubicCurveTo( -filamentWireHeight * 0.3, -BULB_BASE_WIDTH * 0.3, -filamentWireHeight * 0.4, filamentTopPoint.y, filamentTopPoint.x, filamentTopPoint.y ); 159 │ 72 │ filamentSupportWiresShape.moveTo( 0, BULB_BASE_WIDTH * 0.3 ); 160 │ 73 │ filamentSupportWiresShape.cubicCurveTo( -filamentWireHeight * 0.3, BULB_BASE_WIDTH * 0.3, -filamentWireHeight * 0.4, filamentBottomPoint.y, filamentBottomPoint.x, filamentBottomPoint.y ); 161 │ 74 │ var filamentSupportWires = new Path( filamentSupportWiresShape, { stroke: 'black' } ); 162 │ 75 │ 163 │ 76 │ // Create the filament, which is a zig-zag shape. 164 │ 77 │ var filamentShape = new Shape().moveToPoint( filamentTopPoint ); 165 │ 78 │ for ( var i = 0; i < NUM_FILAMENT_ZIG_ZAGS - 1; i++ ) { 166 │ 79 │ var yPos = filamentTopPoint.y + ( filamentBottomPoint.y - filamentTopPoint.y ) / NUM_FILAMENT_ZIG_ZAGS * ( i + 1 ); 167 │ 80 │ if ( i % 2 === 0 ) { 168 │ 81 │ // zig 169 │ 82 │ filamentShape.lineTo( filamentTopPoint.x + FILAMENT_ZIG_ZAG_SPAN, yPos ); 170 │ 83 │ } 171 │ 84 │ else { 172 │ 85 │ // zag 173 │ 86 │ filamentShape.lineTo( filamentTopPoint.x, yPos ); 174 │ 87 │ } 175 │ 88 │ } 176 │ 89 │ filamentShape.lineToPoint( filamentBottomPoint ); 177 │ 90 │ var filament = new Path( filamentShape, { stroke: 'black' } ); 178 │ 91 │ 179 │ 92 │ // Create the 'halo' that makes the bulb look like it is shining. 180 │ 93 │ // @public 181 │ 94 │ iconNode.haloNode = new Node(); 182 │ 95 │ iconNode.haloNode.addChild( new Circle( 5, { 183 │ 96 │ fill: 'white', 184 │ 97 │ opacity: 0.46 - ..\faradays-law\js\faradays-law\view\CoilsWiresNode.js: 43-52 ..\faradays-law\js\faradays-law\view\CoilsWiresNode.js: 58-67 43 │ 58 │ ]; 44 │ 59 │ this.addChild( new Path( new Shape() 45 │ 60 │ .moveTo( keyPoints[ 0 ].x, keyPoints[ 0 ].y ) 46 │ 61 │ .lineTo( keyPoints[ 1 ].x, keyPoints[ 1 ].y - ARC_RADIUS ) 47 │ 62 │ .quadraticCurveTo( keyPoints[ 1 ].x, keyPoints[ 1 ].y, keyPoints[ 1 ].x + ARC_RADIUS, keyPoints[ 1 ].y ) 48 │ 63 │ .lineTo( keyPoints[ 2 ].x, keyPoints[ 2 ].y ), { 49 │ 64 │ stroke: wireColor, 50 │ 65 │ lineWidth: wireWidth 51 │ 66 │ } ) ); 52 │ 67 │ - ..\fluid-pressure-and-flow\js\flow\model\Pipe.js: 307-321 ..\fluid-pressure-and-flow\js\flow\model\Pipe.js: 329-343 307 │ 329 │ getVelocity: function( x, y ) { 308 │ 330 │ var fraction = this.getFractionToTop( x, y ); 309 │ 331 │ var speed = this.getSpeed( x ); 310 │ 332 │ 311 │ 333 │ var pre = this.getCrossSection( x - 1E-7 );// pipe cross section 312 │ 334 │ var post = this.getCrossSection( x + 1E-7 );// pipe cross section 313 │ 335 │ 314 │ 336 │ var x0 = pre.getX(); 315 │ 337 │ var y0 = Util.linear( 0, 1, pre.yBottom, pre.yTop, fraction ); 316 │ 338 │ var x1 = post.getX(); 317 │ 339 │ var y1 = Util.linear( 0, 1, post.yBottom, post.yTop, fraction ); 318 │ 340 │ var velocity = new Vector2( x1 - x0, y1 - y0 ); 319 │ 341 │ return velocity.setMagnitude( speed ); 320 │ 342 │ }, 321 │ 343 │ - ..\energy-skate-park-basics\js\energy-skate-park-basics\model\SplineEvaluation.js: 20-63 ..\fluid-pressure-and-flow\js\flow\model\SplineEvaluation.js: 16-59 20 │ 16 │ var _at = function( spline, x1, p ) { 21 │ 17 │ var x = spline.x; 22 │ 18 │ var yl = spline.yl; 23 │ 19 │ var yr = spline.yr; 24 │ 20 │ var kl = spline.kl; 25 │ 21 │ var kr = spline.kr; 26 │ 22 │ var a; 27 │ 23 │ var b; 28 │ 24 │ var t; 29 │ 25 │ a = (kl[ p ] * (x[ p + 1 ] - x[ p ])) - (yr[ p + 1 ] - yl[ p ]); 30 │ 26 │ b = kr[ p + 1 ] * (x[ p ] - x[ p + 1 ]) + yr[ p + 1 ] - yl[ p ]; 31 │ 27 │ t = (x1 - x[ p ]) / (x[ p + 1 ] - x[ p ]); 32 │ 28 │ var s = t * (1 - t); 33 │ 29 │ return ((1 - t) * yl[ p ] + t * yr[ p + 1 ] + 34 │ 30 │ a * s * (1 - t) ) + 35 │ 31 │ b * s * t; 36 │ 32 │ }; 37 │ 33 │ 38 │ 34 │ var atNumber = function( spline, x0 ) { 39 │ 35 │ var x = spline.x; 40 │ 36 │ var n = x.length; 41 │ 37 │ var p; 42 │ 38 │ var q; 43 │ 39 │ var mid; 44 │ 40 │ var floor = Math.floor; 45 │ 41 │ p = 0; 46 │ 42 │ q = n - 1; 47 │ 43 │ while ( q - p > 1 ) { 48 │ 44 │ mid = floor( (p + q) / 2 ); 49 │ 45 │ if ( x[ mid ] <= x0 ) { 50 │ 46 │ p = mid; 51 │ 47 │ } 52 │ 48 │ else { 53 │ 49 │ q = mid; 54 │ 50 │ } 55 │ 51 │ } 56 │ 52 │ return _at( spline, x0, p ); 57 │ 53 │ }; 58 │ 54 │ 59 │ 55 │ var atArray = function( spline, x0 ) { 60 │ 56 │ var n = x0.length; 61 │ 57 │ var i; 62 │ 58 │ var ret = new FastArray( n ); 63 │ 59 │ for ( i = n - 1; i !== -1; --i ) { - ..\fluid-pressure-and-flow\js\flow\view\ParticleCanvasNode.js: 45-53 ..\fluid-pressure-and-flow\js\flow\view\ParticleCanvasNode.js: 56-64 45 │ 56 │ particle = this.particles.get( i ); 46 │ 57 │ context.fillStyle = particle.color; 47 │ 58 │ context.beginPath(); 48 │ 59 │ context.arc( this.modelViewTransform.modelToViewX( particle.xPosition ), 49 │ 60 │ this.modelViewTransform.modelToViewY( particle.getY() ), 50 │ 61 │ this.modelViewTransform.modelToViewDeltaX( particle.radius ), 0, 2 * Math.PI, true ); 51 │ 62 │ context.fill(); 52 │ 63 │ } 53 │ 64 │ - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-44 ..\fluid-pressure-and-flow\js\fluid-pressure-and-flow-config.js: 10-43 11 │ 10 │ deps: [ 'area-model-multiplication-main' ], 12 │ 11 │ 13 │ 12 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 13 │ 15 │ 14 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 15 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 16 │ paths: { 18 │ 17 │ 19 │ 18 │ // third-party libs 20 │ 19 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 20 │ 22 │ 21 │ // PhET plugins 23 │ 22 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 23 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 24 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 25 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 26 │ 28 │ 27 │ // common directories, uppercase names to identify them in require imports 29 │ 28 │ AXON: '../../axon/js', 30 │ 29 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 30 │ DOT: '../../dot/js', 32 │ 31 │ JOIST: '../../joist/js', 33 │ 32 │ KITE: '../../kite/js', 34 │ 33 │ PHET_CORE: '../../phet-core/js', 35 │ 34 │ PHET_IO: '../../phet-io/js', 36 │ 35 │ PHETCOMMON: '../../phetcommon/js', 37 │ 36 │ REPOSITORY: '..', 38 │ 37 │ SCENERY: '../../scenery/js', 39 │ 38 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 39 │ SUN: '../../sun/js', 41 │ 40 │ TANDEM: '../../tandem/js', 42 │ 41 │ 43 │ 42 │ // this sim 44 │ 43 │ AREA_MODEL_MULTIPLICATION: '.' - ..\fluid-pressure-and-flow\js\under-pressure\view\ChamberPoolBack.js: 72-84 ..\fluid-pressure-and-flow\js\under-pressure\view\ChamberPoolWaterNode.js: 25-37 72 │ 25 │ this.addChild(grassRectangle); 73 │ 26 │ 74 │ 27 │ 75 │ 28 │ //calculated view coordinates for water 76 │ 29 │ var leftOpeningX1 = modelViewTransform.modelToViewX( poolDimensions.leftOpening.x1 ); 77 │ 30 │ var leftOpeningX2 = modelViewTransform.modelToViewX( poolDimensions.leftOpening.x2 ); 78 │ 31 │ var leftChamberX1 = modelViewTransform.modelToViewX( poolDimensions.leftChamber.x1 ); 79 │ 32 │ var leftChamberX2 = modelViewTransform.modelToViewX( poolDimensions.leftChamber.x2 ); 80 │ 33 │ var rightChamberX1 = modelViewTransform.modelToViewX( poolDimensions.rightChamber.x1 ); 81 │ 34 │ var rightChamberX2 = modelViewTransform.modelToViewX( poolDimensions.rightChamber.x2 ); 82 │ 35 │ var rightOpeningX1 = modelViewTransform.modelToViewX( poolDimensions.rightOpening.x1 ); 83 │ 36 │ var rightOpeningX2 = modelViewTransform.modelToViewX( poolDimensions.rightOpening.x2 ); 84 │ 37 │ var leftOpeningY1 = modelViewTransform.modelToViewY( poolDimensions.leftOpening.y1 ); - ..\fluid-pressure-and-flow\js\under-pressure\view\ChamberPoolBack.js: 118-130 ..\fluid-pressure-and-flow\js\under-pressure\view\ChamberPoolWaterNode.js: 50-62 118 │ 50 │ .moveTo( leftOpeningX1, leftOpeningY1 - 1 ) 119 │ 51 │ .lineTo( leftOpeningX1, leftOpeningY2 ) 120 │ 52 │ .lineTo( leftChamberX1, leftOpeningY2 ) 121 │ 53 │ .lineTo( leftChamberX1, leftChamberY2 ) 122 │ 54 │ .lineTo( leftChamberX2, leftChamberY2 ) 123 │ 55 │ .lineTo( leftChamberX2, passageY2 ) 124 │ 56 │ .lineTo( rightChamberX1, passageY2 ) 125 │ 57 │ .lineTo( rightChamberX1, leftChamberY2 ) 126 │ 58 │ .lineTo( rightChamberX2, leftChamberY2 ) 127 │ 59 │ .lineTo( rightChamberX2, leftOpeningY2 ) 128 │ 60 │ .lineTo( rightOpeningX2, leftOpeningY2 ) 129 │ 61 │ .lineTo( rightOpeningX2, leftOpeningY1 - 1 ) 130 │ 62 │ .lineTo( rightOpeningX1, leftOpeningY1 - 1 ) - ..\fluid-pressure-and-flow\js\under-pressure\view\ChamberPoolBack.js: 6-19 ..\fluid-pressure-and-flow\js\under-pressure\view\SquarePoolBack.js: 6-19 6 │ 6 │ */ 7 │ 7 │ define( function( require ) { 8 │ 8 │ 'use strict'; 9 │ 9 │ 10 │ 10 │ // modules 11 │ 11 │ var fluidPressureAndFlow = require( 'FLUID_PRESSURE_AND_FLOW/fluidPressureAndFlow' ); 12 │ 12 │ var Node = require( 'SCENERY/nodes/Node' ); 13 │ 13 │ var inherit = require( 'PHET_CORE/inherit' ); 14 │ 14 │ var Pattern = require( 'SCENERY/util/Pattern' ); 15 │ 15 │ var Rectangle = require( 'SCENERY/nodes/Rectangle' ); 16 │ 16 │ var Matrix3 = require( 'DOT/Matrix3' ); 17 │ 17 │ var Shape = require( 'KITE/Shape' ); 18 │ 18 │ var Path = require( 'SCENERY/nodes/Path' ); 19 │ 19 │ - ..\fluid-pressure-and-flow\js\under-pressure\view\SquarePoolBack.js: 4-26 ..\fluid-pressure-and-flow\js\under-pressure\view\TrapezoidPoolBack.js: 5-27 4 │ 5 │ * @author Vasily Shakhov (Mlearner) 5 │ 6 │ * @author Siddhartha Chinthapally (Actual Concepts) 6 │ 7 │ */ 7 │ 8 │ define( function( require ) { 8 │ 9 │ 'use strict'; 9 │ 10 │ 10 │ 11 │ // modules 11 │ 12 │ var fluidPressureAndFlow = require( 'FLUID_PRESSURE_AND_FLOW/fluidPressureAndFlow' ); 12 │ 13 │ var Node = require( 'SCENERY/nodes/Node' ); 13 │ 14 │ var inherit = require( 'PHET_CORE/inherit' ); 14 │ 15 │ var Pattern = require( 'SCENERY/util/Pattern' ); 15 │ 16 │ var Rectangle = require( 'SCENERY/nodes/Rectangle' ); 16 │ 17 │ var Matrix3 = require( 'DOT/Matrix3' ); 17 │ 18 │ var Shape = require( 'KITE/Shape' ); 18 │ 19 │ var Path = require( 'SCENERY/nodes/Path' ); 19 │ 20 │ var UnderPressureFaucetNode = require( 'FLUID_PRESSURE_AND_FLOW/under-pressure/view/UnderPressureFaucetNode' ); 20 │ 21 │ 21 │ 22 │ // images 22 │ 23 │ var grassImg = require( 'image!FLUID_PRESSURE_AND_FLOW/grass-texture.png' ); 23 │ 24 │ var cementImg = require( 'image!FLUID_PRESSURE_AND_FLOW/cement-texture-dark.jpg' ); 24 │ 25 │ 25 │ 26 │ /** 26 │ 27 │ * @param {SquarePoolModel} squarePoolModel of the simulation - ..\fluid-pressure-and-flow\js\watertower\view\HoseNode.js: 156-164 ..\fluid-pressure-and-flow\js\watertower\view\HoseNode.js: 192-200 156 │ 192 │ var createTopShape = function( hose, modelViewTransform ) { 157 │ 193 │ var shape = new Shape(); 158 │ 194 │ shape = shape.moveTo( modelViewTransform.modelToViewX( hose.elbowOuterX ), modelViewTransform.modelToViewY( hose.elbowOuterY ) ) 159 │ 195 │ .lineTo( modelViewTransform.modelToViewX( hose.nozzleAttachmentOuterX ), modelViewTransform.modelToViewY( hose.nozzleAttachmentOuterY ) ) 160 │ 196 │ .lineTo( modelViewTransform.modelToViewX( hose.nozzleAttachmentInnerX ), modelViewTransform.modelToViewY( hose.nozzleAttachmentInnerY ) ) 161 │ 197 │ .lineTo( modelViewTransform.modelToViewX( hose.elbowInnerX ), modelViewTransform.modelToViewY( hose.elbowInnerY ) - CORNER_RADIUS * Math.cos( hose.angleWithVertical ) ) 162 │ 198 │ .arc( modelViewTransform.modelToViewX( hose.elbowInnerX ) - CORNER_RADIUS, modelViewTransform.modelToViewY( hose.elbowInnerY ) - CORNER_RADIUS, CORNER_RADIUS, hose.angleWithVertical, Math.PI / 2, false ) 163 │ 199 │ .lineTo( modelViewTransform.modelToViewX( hose.L1 - hose.width ) + CORNER_RADIUS, modelViewTransform.modelToViewY( hose.elbowInnerY ) ); 164 │ 200 │ - ..\fluid-pressure-and-flow\js\watertower\view\HoseNode.js: 181-189 ..\fluid-pressure-and-flow\js\watertower\view\HoseNode.js: 217-225 181 │ 217 │ shape = shape.lineTo( modelViewTransform.modelToViewX( hose.L1 ), modelViewTransform.modelToViewY( hose.elbowLowerY ) ); 182 │ 218 │ } 183 │ 219 │ 184 │ 220 │ shape = shape.lineTo( modelViewTransform.modelToViewX( hose.elbowLowerX ), modelViewTransform.modelToViewY( hose.elbowLowerY ) ) 185 │ 221 │ .arc( modelViewTransform.modelToViewX( hose.elbowInnerX ), modelViewTransform.modelToViewY( hose.elbowInnerY ), modelViewTransform.modelToViewDeltaX( hose.width ), 186 │ 222 │ Math.PI / 2, hose.angleWithVertical, true ); 187 │ 223 │ 188 │ 224 │ return shape; 189 │ 225 │ }; - ..\fluid-pressure-and-flow\js\flow\view\FlowToolsControlPanel.js: 4-23 ..\fluid-pressure-and-flow\js\watertower\view\ToolsControlPanel.js: 4-23 4 │ 4 │ * 5 │ 5 │ * @author Siddhartha Chinthapally (ActualConcepts) 6 │ 6 │ */ 7 │ 7 │ define( function( require ) { 8 │ 8 │ 'use strict'; 9 │ 9 │ 10 │ 10 │ // modules 11 │ 11 │ var fluidPressureAndFlow = require( 'FLUID_PRESSURE_AND_FLOW/fluidPressureAndFlow' ); 12 │ 12 │ var inherit = require( 'PHET_CORE/inherit' ); 13 │ 13 │ var VBox = require( 'SCENERY/nodes/VBox' ); 14 │ 14 │ var HBox = require( 'SCENERY/nodes/HBox' ); 15 │ 15 │ var Shape = require( 'KITE/Shape' ); 16 │ 16 │ var HStrut = require( 'SCENERY/nodes/HStrut' ); 17 │ 17 │ var Panel = require( 'SUN/Panel' ); 18 │ 18 │ var CheckBox = require( 'SUN/CheckBox' ); 19 │ 19 │ var Text = require( 'SCENERY/nodes/Text' ); 20 │ 20 │ var PhetFont = require( 'SCENERY_PHET/PhetFont' ); 21 │ 21 │ var RulerNode = require( 'SCENERY_PHET/RulerNode' ); 22 │ 22 │ var Circle = require( 'SCENERY/nodes/Circle' ); 23 │ 23 │ var Node = require( 'SCENERY/nodes/Node' ); - ..\fluid-pressure-and-flow\js\watertower\view\WaterTowerNode.js: 72-77 ..\fluid-pressure-and-flow\js\watertower\view\WaterTowerNode.js: 173-178 72 │ 173 │ var waterShape = new Shape() 73 │ 174 │ .moveTo( modelViewTransform.modelToViewX( 0 ), modelViewTransform.modelToViewY( 0 ) ) 74 │ 175 │ .lineTo( modelViewTransform.modelToViewX( 2 * waterTower.TANK_RADIUS ), modelViewTransform.modelToViewY( 0 ) ) 75 │ 176 │ .lineTo( modelViewTransform.modelToViewX( 2 * waterTower.TANK_RADIUS ), modelViewTransform.modelToViewY( waterTower.fluidLevel ) ) 76 │ 177 │ .lineTo( modelViewTransform.modelToViewX( 0 ), modelViewTransform.modelToViewY( waterTower.fluidLevel ) ).close(); 77 │ 178 │ this.waterShapeNode = new Path( waterShape, { - ..\forces-and-motion-basics\js\motion\view\MotionControlPanel.js: 221-228 ..\forces-and-motion-basics\js\motion\view\MotionControlPanel.js: 258-265 221 │ 258 │ var checkBoxes = new VBox( { 222 │ 259 │ children: [ 223 │ 260 │ createCheckBox( forcesString, 'showForce', 'showForceCheckBox', { icon: createArrowIcon( 'showForceArrowIcon' ) } ), 224 │ 261 │ createCheckBox( sumOfForcesString, 'showSumOfForces', 'showSumOfForcesCheckBox' ), 225 │ 262 │ createCheckBox( valuesString, 'showValues', 'showValuesCheckBox' ), 226 │ 263 │ createCheckBox( massesString, 'showMasses', 'showMassesCheckBox' ), 227 │ 264 │ createCheckBox( speedString, 'showSpeed', 'showSpeedCheckBox', { icon: speedometerIcon() } ) 228 │ 265 │ ], - ..\forces-and-motion-basics\js\netforce\model\NetForceModel.js: 441-451 ..\forces-and-motion-basics\js\netforce\model\NetForceModel.js: 470-480 441 │ 470 │ var isInRightDirection = function( sourceKnot, destinationKnot, delta ) { 442 │ 471 │ assert && assert( delta < 0 || delta > 0 ); 443 │ 472 │ return delta < 0 ? destinationKnot.x < sourceKnot.x : 444 │ 473 │ delta > 0 ? destinationKnot.x > sourceKnot.x : 445 │ 474 │ 'error'; 446 │ 475 │ }; 447 │ 476 │ var filter = this.knots.filter( function( knot ) { 448 │ 477 │ return knot.type === puller.type && 449 │ 478 │ self.getPuller( knot ) === null && 450 │ 479 │ isInRightDirection( puller.knot, knot, delta ); 451 │ 480 │ } ); - ..\forces-and-motion-basics\js\motion\view\ItemToolboxNode.js: 51-70 ..\forces-and-motion-basics\js\netforce\view\PullerToolboxNode.js: 60-79 51 │ 60 │ domElement.id = self.accessibleId; 52 │ 61 │ 53 │ 62 │ // enter the puller group on 'enter' or 'space bar'. 54 │ 63 │ domElement.addEventListener( 'keydown', function( event ) { 55 │ 64 │ // prevent the the event from bubbling. 56 │ 65 │ if ( domElement !== event.target ) { return; } 57 │ 66 │ // on enter or spacebar, step in to the selected group. 58 │ 67 │ if ( event.keyCode === 13 || event.keyCode === 32 ) { 59 │ 68 │ self.enterGroup( event, domElement ); 60 │ 69 │ } 61 │ 70 │ } ); 62 │ 71 │ 63 │ 72 │ // exit the group on 'escape' 64 │ 73 │ domElement.addEventListener( 'keydown', function( event ) { 65 │ 74 │ // we want exit event bubbling - event fired in children should notify parent. 66 │ 75 │ if ( event.keyCode === 27 ) { 67 │ 76 │ self.exitGroup( domElement ); 68 │ 77 │ } 69 │ 78 │ } ); 70 │ 79 │ - ..\forces-and-motion-basics\js\motion\view\ItemToolboxNode.js: 88-128 ..\forces-and-motion-basics\js\netforce\view\PullerToolboxNode.js: 100-140 88 │ 100 │ */ 89 │ 101 │ enterGroup: function( event, parent ) { 90 │ 102 │ // add listeners to the children that apply the correct behavior for looping through children. 91 │ 103 │ _.each( parent.children, function( child ) { 92 │ 104 │ // add the child to the tab order. 93 │ 105 │ child.tabIndex = '0'; 94 │ 106 │ 95 │ 107 │ // Add event listeners to children for key navigation. 96 │ 108 │ var numberOfChildren = parent.children.length; 97 │ 109 │ child.addEventListener( 'keydown', function( event ) { 98 │ 110 │ var childIndex = _.indexOf( parent.children, child ); 99 │ 111 │ var nextIndex = ( childIndex + 1 ) % numberOfChildren; 100 │ 112 │ var previousIndex = ( childIndex - 1 ); 101 │ 113 │ // if previous index is -1, set focus to the last element 102 │ 114 │ previousIndex = previousIndex === -1 ? ( numberOfChildren - 1 ) : previousIndex; 103 │ 115 │ 104 │ 116 │ if ( event.keyCode === 39 ) { 105 │ 117 │ //right arrow pressed 106 │ 118 │ parent.children[ nextIndex ].focus(); 107 │ 119 │ } 108 │ 120 │ if ( event.keyCode === 37 ) { 109 │ 121 │ //left arrow pressed 110 │ 122 │ parent.children[ previousIndex ].focus(); 111 │ 123 │ } 112 │ 124 │ } ); 113 │ 125 │ } 114 │ 126 │ ); 115 │ 127 │ 116 │ 128 │ // set focus to the first child 117 │ 129 │ document.getElementById( parent.firstChild.id ).focus(); 118 │ 130 │ }, 119 │ 131 │ 120 │ 132 │ /** 121 │ 133 │ * Exit the group. This is called on 'escape' key. 122 │ 134 │ * 123 │ 135 │ * @param {domElement} parent 124 │ 136 │ */ 125 │ 137 │ exitGroup: function( parent ) { 126 │ 138 │ // set focus to the parent form 127 │ 139 │ parent.focus(); 128 │ 140 │ - ..\forces-and-motion-basics\js\motion\view\ItemToolboxNode.js: 130-152 ..\forces-and-motion-basics\js\netforce\view\PullerToolboxNode.js: 139-161 130 │ 139 │ parent.setAttribute( 'aria-activedescendant', parent.firstChild.id ); 131 │ 140 │ 132 │ 141 │ // pull all children out of the tab order 133 │ 142 │ for ( var i = 0; i < parent.children.length; i++ ) { 134 │ 143 │ parent.children[ i ].tabIndex = '-1'; 135 │ 144 │ } 136 │ 145 │ }, 137 │ 146 │ 138 │ 147 │ // Show a highlight around the toolbox when one of the items inside has focus 139 │ 148 │ set 140 │ 149 │ highlighted( h ) { 141 │ 150 │ this._highlighted = h; 142 │ 151 │ this.stroke = h ? this.highlightColor : defaultStroke; 143 │ 152 │ this.lineWidth = h ? 4 : defaultLineWidth; 144 │ 153 │ }, 145 │ 154 │ get 146 │ 155 │ highlighted() { 147 │ 156 │ return this._highlighted; 148 │ 157 │ } 149 │ 158 │ } ); 150 │ 159 │ } ); - ..\estimation\js\estimation-config.js: 11-38 ..\fraction-comparison\js\fraction-comparison-config.js: 10-37 11 │ 10 │ deps: [ 'estimation-main' ], 12 │ 11 │ 13 │ 12 │ paths: { 14 │ 13 │ 15 │ 14 │ // third-party libs 16 │ 15 │ text: '../../sherpa/lib/text-2.0.12', 17 │ 16 │ 18 │ 17 │ // PhET plugins 19 │ 18 │ image: '../../chipper/js/requirejs-plugins/image', 20 │ 19 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 21 │ 20 │ string: '../../chipper/js/requirejs-plugins/string', 22 │ 21 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 23 │ 22 │ 24 │ 23 │ // PhET libs, uppercase names to identify them in require.js imports 25 │ 24 │ AXON: '../../axon/js', 26 │ 25 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 27 │ 26 │ DOT: '../../dot/js', 28 │ 27 │ JOIST: '../../joist/js', 29 │ 28 │ KITE: '../../kite/js', 30 │ 29 │ PHET_CORE: '../../phet-core/js', 31 │ 30 │ PHET_IO: '../../phet-io/js', 32 │ 31 │ PHETCOMMON: '../../phetcommon/js', 33 │ 32 │ REPOSITORY: '..', 34 │ 33 │ SCENERY: '../../scenery/js', 35 │ 34 │ SCENERY_PHET: '../../scenery-phet/js', 36 │ 35 │ SUN: '../../sun/js', 37 │ 36 │ TANDEM: '../../tandem/js', 38 │ 37 │ VIBE: '../../vibe/js', - ..\energy-skate-park-basics\js\energy-skate-park-basics\view\EnergySkateParkBasicsScreenView.js: 290-303 ..\fraction-comparison\js\intro\view\CompareSeparateButton.js: 25-38 290 │ 25 │ model.tracks.addItemAddedListener( addTrackNode ); 291 │ 26 │ 292 │ 27 │ var xTip = 20; 293 │ 28 │ var yTip = 8; 294 │ 29 │ var xControl = 12; 295 │ 30 │ var yControl = -5; 296 │ 31 │ 297 │ 32 │ var createArrowhead = function( angle, tail ) { 298 │ 33 │ var headWidth = 10; 299 │ 34 │ var headHeight = 10; 300 │ 35 │ var directionUnitVector = Vector2.createPolar( 1, angle ); 301 │ 36 │ var orthogonalUnitVector = directionUnitVector.perpendicular(); 302 │ 37 │ var tip = directionUnitVector.times( headHeight ).plus( tail ); 303 │ 38 │ return new TandemPath( new Shape().moveToPoint( tail ).lineToPoint( tail.plus( orthogonalUnitVector.times( headWidth / 2 ) ) ).lineToPoint( tip ).lineToPoint( tail.plus( orthogonalUnitVector.times( -headWidth / 2 ) ) ).lineToPoint( tail ).close(), { - ..\fraction-comparison\js\intro\view\HorizontalBarContainerNode.js: 134-140 ..\fraction-comparison\js\intro\view\HorizontalBarContainerNode.js: 145-151 134 │ 145 │ .to( { x: this.comparePosition.x, y: this.comparePosition.y }, 500 ) 135 │ 146 │ .easing( TWEEN.Easing.Cubic.InOut ) 136 │ 147 │ .onUpdate( function() { self.center = new Vector2( this.x, this.y ); } ) 137 │ 148 │ .onComplete( function() {self.animatingProperty.value = false;} ) 138 │ 149 │ .start( phet.joist.elapsedTime ); 139 │ 150 │ this.stateProperty.set( 'compare' ); 140 │ 151 │ }, - ..\expression-exchange\js\expression-exchange-config.js: 16-42 ..\fraction-matcher\js\fraction-matcher-config.js: 20-46 16 │ 20 │ paths: { 17 │ 21 │ 18 │ 22 │ // third-party libs 19 │ 23 │ text: '../../sherpa/lib/text-2.0.12', 20 │ 24 │ 21 │ 25 │ // PhET plugins 22 │ 26 │ audio: '../../chipper/js/requirejs-plugins/audio', 23 │ 27 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 28 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 29 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 30 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 31 │ 28 │ 32 │ // common directories, uppercase names to identify them in require imports 29 │ 33 │ AXON: '../../axon/js', 30 │ 34 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 35 │ DOT: '../../dot/js', 32 │ 36 │ JOIST: '../../joist/js', 33 │ 37 │ KITE: '../../kite/js', 34 │ 38 │ PHET_CORE: '../../phet-core/js', 35 │ 39 │ PHET_IO: '../../phet-io/js', 36 │ 40 │ PHETCOMMON: '../../phetcommon/js', 37 │ 41 │ REPOSITORY: '..', 38 │ 42 │ SCENERY: '../../scenery/js', 39 │ 43 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 44 │ SUN: '../../sun/js', 41 │ 45 │ TANDEM: '../../tandem/js', 42 │ 46 │ VEGAS: '../../vegas/js', - ..\fraction-matcher\js\model\Constants.js: 116-133 ..\fraction-matcher\js\model\Constants.js: 139-156 116 │ 139 │ */ 117 │ 140 │ { 118 │ 141 │ fractions: [ 119 │ 142 │ new Fraction( 13, 7 ), 120 │ 143 │ new Fraction( 13, 7 ), 121 │ 144 │ new Fraction( 6, 3 ), 122 │ 145 │ new Fraction( 9, 5 ), 123 │ 146 │ new Fraction( 9, 7 ), 124 │ 147 │ new Fraction( 9, 8 ), 125 │ 148 │ new Fraction( 14, 8 ), 126 │ 149 │ new Fraction( 2, 9 ), 127 │ 150 │ new Fraction( 3, 9 ), 128 │ 151 │ new Fraction( 4, 9 ), 129 │ 152 │ new Fraction( 6, 9 ), 130 │ 153 │ new Fraction( 8, 9 ) 131 │ 154 │ ], 132 │ 155 │ numericScaleFactors: [ 1, 2 ], 133 │ 156 │ fillType: [ FillType.SEQUENTIAL ], - ..\fraction-matcher\js\shapes\Pattern.js: 41-55 ..\fraction-matcher\js\shapes\Pattern.js: 59-73 41 │ 59 │ x: j / options.denominator * options.width, fill: 'white', stroke: options.stroke, lineWidth: 1 42 │ 60 │ } ) ); 43 │ 61 │ } 44 │ 62 │ //outlines 45 │ 63 │ outlines.push( new Path( Shape.rect( 0, 0, options.width, options.height ), { 46 │ 64 │ stroke: options.stroke, 47 │ 65 │ lineWidth: options.outlineWidth 48 │ 66 │ } ) ); 49 │ 67 │ } 50 │ 68 │ return { 51 │ 69 │ shapes: shapes, 52 │ 70 │ outlines: outlines 53 │ 71 │ }; 54 │ 72 │ }, 55 │ 73 │ HORIZONTAL_BARS: function( shapes, outlines, options ) { - ..\fraction-matcher\js\shapes\Pattern.js: 87-100 ..\fraction-matcher\js\shapes\Pattern.js: 126-139 87 │ 126 │ return shape; 88 │ 127 │ }; 89 │ 128 │ 90 │ 129 │ for ( var i = 0, l = shapes.length; i < l; i++ ) { 91 │ 130 │ for ( var j = 0; j < options.denominator; j++ ) { 92 │ 131 │ shapes[ i ].push( new Path( getSlice( radiansPerSlice * j, radiansPerSlice * ( j + 1 ) ), { 93 │ 132 │ fill: 'white', 94 │ 133 │ stroke: options.stroke, 95 │ 134 │ lineWidth: 1 96 │ 135 │ } ) ); 97 │ 136 │ } 98 │ 137 │ //outlines 99 │ 138 │ outlines.push( new Path( getSlice( 0, radiansPerSlice * options.denominator ), { 100 │ 139 │ stroke: options.stroke, - ..\fraction-matcher\js\shapes\Pattern.js: 124-132 ..\fraction-matcher\js\shapes\Pattern.js: 164-172 124 │ 164 │ keyPoints.push( baseVector.rotated( radiansPerSlice * i ) ); 125 │ 165 │ } 126 │ 166 │ return Pattern.pointsToShape( new Shape(), keyPoints, options.diameter / 2 ); 127 │ 167 │ }; 128 │ 168 │ 129 │ 169 │ for ( var i = 0, l = shapes.length; i < l; i++ ) { 130 │ 170 │ for ( var j = 0; j < options.denominator; j++ ) { 131 │ 171 │ shapes[ i ].push( new Path( getSlice( radiansPerSlice * j, radiansPerSlice * ( j + 1 ) ), { 132 │ 172 │ fill: 'white', - ..\fraction-matcher\js\shapes\Pattern.js: 169-181 ..\fraction-matcher\js\shapes\Pattern.js: 328-340 169 │ 328 │ for ( var i = 0, l = shapes.length; i < l; i++ ) { 170 │ 329 │ for ( var j = 0; j < options.denominator; j++ ) { 171 │ 330 │ shapes[ i ].push( new Path( getSlice( j ), { fill: 'white', stroke: options.stroke, lineWidth: 1 } ) ); 172 │ 331 │ } 173 │ 332 │ //outlines 174 │ 333 │ outlines.push( new Path( getOutline(), { stroke: options.stroke, lineWidth: options.outlineWidth } ) ); 175 │ 334 │ } 176 │ 335 │ return { 177 │ 336 │ shapes: shapes, 178 │ 337 │ outlines: outlines 179 │ 338 │ }; 180 │ 339 │ }, 181 │ 340 │ RING_OF_HEXAGONS: function( shapes, outlines, options ) { - ..\fraction-matcher\js\shapes\Pattern.js: 41-55 ..\fraction-matcher\js\shapes\Pattern.js: 473-487 41 │ 473 │ x: j / options.denominator * options.width, fill: 'white', stroke: options.stroke, lineWidth: 1 42 │ 474 │ } ) ); 43 │ 475 │ } 44 │ 476 │ //outlines 45 │ 477 │ outlines.push( new Path( Shape.rect( 0, 0, options.width, options.height ), { 46 │ 478 │ stroke: options.stroke, 47 │ 479 │ lineWidth: options.outlineWidth 48 │ 480 │ } ) ); 49 │ 481 │ } 50 │ 482 │ return { 51 │ 483 │ shapes: shapes, 52 │ 484 │ outlines: outlines 53 │ 485 │ }; 54 │ 486 │ }, 55 │ 487 │ HORIZONTAL_BARS: function( shapes, outlines, options ) { - ..\fraction-matcher\js\shapes\Pattern.js: 41-55 ..\fraction-matcher\js\shapes\Pattern.js: 538-552 41 │ 538 │ x: j / options.denominator * options.width, fill: 'white', stroke: options.stroke, lineWidth: 1 42 │ 539 │ } ) ); 43 │ 540 │ } 44 │ 541 │ //outlines 45 │ 542 │ outlines.push( new Path( Shape.rect( 0, 0, options.width, options.height ), { 46 │ 543 │ stroke: options.stroke, 47 │ 544 │ lineWidth: options.outlineWidth 48 │ 545 │ } ) ); 49 │ 546 │ } 50 │ 547 │ return { 51 │ 548 │ shapes: shapes, 52 │ 549 │ outlines: outlines 53 │ 550 │ }; 54 │ 551 │ }, 55 │ 552 │ HORIZONTAL_BARS: function( shapes, outlines, options ) { - ..\area-model-multiplication\js\area-model-multiplication-config.js: 23-44 ..\friction\js\friction-config.js: 16-37 23 │ 16 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 17 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 18 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 19 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 20 │ 28 │ 21 │ // common directories, uppercase names to identify them in require imports 29 │ 22 │ AXON: '../../axon/js', 30 │ 23 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 24 │ DOT: '../../dot/js', 32 │ 25 │ JOIST: '../../joist/js', 33 │ 26 │ KITE: '../../kite/js', 34 │ 27 │ PHET_CORE: '../../phet-core/js', 35 │ 28 │ PHET_IO: '../../phet-io/js', 36 │ 29 │ PHETCOMMON: '../../phetcommon/js', 37 │ 30 │ REPOSITORY: '..', 38 │ 31 │ SCENERY: '../../scenery/js', 39 │ 32 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 33 │ SUN: '../../sun/js', 41 │ 34 │ TANDEM: '../../tandem/js', 42 │ 35 │ 43 │ 36 │ // this sim 44 │ 37 │ AREA_MODEL_MULTIPLICATION: '.' - ..\function-builder\js\common\view\equations\HelpfulEquationNode.js: 136-154 ..\function-builder\js\common\view\equations\HelpfulEquationNode.js: 162-180 136 │ 162 │ operatorNode = new Text( currentOperand >= 0 ? FBSymbols.PLUS : FBSymbols.MINUS, { 137 │ 163 │ font: options.symbolFont, 138 │ 164 │ left: nextLeft, 139 │ 165 │ centerY: nextCenterY 140 │ 166 │ } ); 141 │ 167 │ rhsNode.addChild( operatorNode ); 142 │ 168 │ 143 │ 169 │ operandNode = new Text( Math.abs( currentOperand ), { 144 │ 170 │ font: options.wholeNumberFont, 145 │ 171 │ left: operatorNode.right + options.operatorXSpacing, 146 │ 172 │ centerY: operatorNode.centerY 147 │ 173 │ } ); 148 │ 174 │ rhsNode.addChild( operandNode ); 149 │ 175 │ 150 │ 176 │ nextLeft = operandNode.right + options.operatorXSpacing; 151 │ 177 │ nextCenterY = operandNode.centerY; 152 │ 178 │ } 153 │ 179 │ else if ( currentOperator === FBSymbols.MINUS ) { 154 │ 180 │ - ..\area-builder\js\area-builder-config.js: 10-39 ..\function-builder\js\function-builder-config.js: 11-40 10 │ 11 │ deps: [ 'area-builder-main' ], 11 │ 12 │ 12 │ 13 │ paths: { 13 │ 14 │ 14 │ 15 │ // third-party libs 15 │ 16 │ text: '../../sherpa/lib/text-2.0.12', 16 │ 17 │ 17 │ 18 │ // PhET plugins 18 │ 19 │ audio: '../../chipper/js/requirejs-plugins/audio', 19 │ 20 │ image: '../../chipper/js/requirejs-plugins/image', 20 │ 21 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 21 │ 22 │ string: '../../chipper/js/requirejs-plugins/string', 22 │ 23 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 23 │ 24 │ 24 │ 25 │ // PhET libs, uppercase names to identify them in require.js imports 25 │ 26 │ AXON: '../../axon/js', 26 │ 27 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 27 │ 28 │ DOT: '../../dot/js', 28 │ 29 │ JOIST: '../../joist/js', 29 │ 30 │ KITE: '../../kite/js', 30 │ 31 │ PHET_CORE: '../../phet-core/js', 31 │ 32 │ PHET_IO: '../../phet-io/js', 32 │ 33 │ PHETCOMMON: '../../phetcommon/js', 33 │ 34 │ REPOSITORY: '..', 34 │ 35 │ SCENERY: '../../scenery/js', 35 │ 36 │ SCENERY_PHET: '../../scenery-phet/js', 36 │ 37 │ SHERPA: '../../sherpa', 37 │ 38 │ SUN: '../../sun/js', 38 │ 39 │ TANDEM: '../../tandem/js', 39 │ 40 │ VIBE: '../../vibe/js', - ..\function-builder\js\equations\model\EquationsScene.js: 16-30 ..\function-builder\js\mystery\model\MysteryScene.js: 20-34 16 │ 20 │ var MathBuilder = require( 'FUNCTION_BUILDER/common/model/builder/MathBuilder' ); 17 │ 21 │ var RangeWithValue = require( 'DOT/RangeWithValue' ); 18 │ 22 │ var RationalNumber = require( 'FUNCTION_BUILDER/common/model/RationalNumber' ); 19 │ 23 │ var Scene = require( 'FUNCTION_BUILDER/common/model/Scene' ); 20 │ 24 │ var Vector2 = require( 'DOT/Vector2' ); 21 │ 25 │ 22 │ 26 │ // function modules 23 │ 27 │ var Divide = require( 'FUNCTION_BUILDER/common/model/functions/Divide' ); 24 │ 28 │ var Minus = require( 'FUNCTION_BUILDER/common/model/functions/Minus' ); 25 │ 29 │ var Plus = require( 'FUNCTION_BUILDER/common/model/functions/Plus' ); 26 │ 30 │ var Times = require( 'FUNCTION_BUILDER/common/model/functions/Times' ); 27 │ 31 │ 28 │ 32 │ // constants 29 │ 33 │ var CARD_NUMBERS_RANGE = new RangeWithValue( -4, 6 ); 30 │ 34 │ - ..\function-builder\js\equations\model\EquationsScene.js: 12-30 ..\function-builder\js\numbers\model\NumbersScene.js: 11-29 12 │ 11 │ var FBSymbols = require( 'FUNCTION_BUILDER/common/FBSymbols' ); 13 │ 12 │ var functionBuilder = require( 'FUNCTION_BUILDER/functionBuilder' ); 14 │ 13 │ var FunctionCreator = require( 'FUNCTION_BUILDER/common/model/functions/FunctionCreator' ); 15 │ 14 │ var inherit = require( 'PHET_CORE/inherit' ); 16 │ 15 │ var MathBuilder = require( 'FUNCTION_BUILDER/common/model/builder/MathBuilder' ); 17 │ 16 │ var RangeWithValue = require( 'DOT/RangeWithValue' ); 18 │ 17 │ var RationalNumber = require( 'FUNCTION_BUILDER/common/model/RationalNumber' ); 19 │ 18 │ var Scene = require( 'FUNCTION_BUILDER/common/model/Scene' ); 20 │ 19 │ var Vector2 = require( 'DOT/Vector2' ); 21 │ 20 │ 22 │ 21 │ // function modules 23 │ 22 │ var Divide = require( 'FUNCTION_BUILDER/common/model/functions/Divide' ); 24 │ 23 │ var Minus = require( 'FUNCTION_BUILDER/common/model/functions/Minus' ); 25 │ 24 │ var Plus = require( 'FUNCTION_BUILDER/common/model/functions/Plus' ); 26 │ 25 │ var Times = require( 'FUNCTION_BUILDER/common/model/functions/Times' ); 27 │ 26 │ 28 │ 27 │ // constants 29 │ 28 │ var CARD_NUMBERS_RANGE = new RangeWithValue( -4, 6 ); 30 │ 29 │ - ..\function-builder\js\equations\model\EquationsScene.js: 57-71 ..\function-builder\js\numbers\model\NumbersScene.js: 63-77 57 │ 63 │ ]; 58 │ 64 │ 59 │ 65 │ // builder 60 │ 66 │ var builderX = ( FBConstants.SCREEN_VIEW_LAYOUT_BOUNDS.width / 2 ) - ( options.builderWidth / 2 ); 61 │ 67 │ var builder = new MathBuilder( { 62 │ 68 │ numberOfSlots: options.numberOfSlots, 63 │ 69 │ width: options.builderWidth, 64 │ 70 │ location: new Vector2( builderX, FBConstants.BUILDER_Y ) 65 │ 71 │ } ); 66 │ 72 │ 67 │ 73 │ Scene.call( this, cardContent, functionCreators, builder, options ); 68 │ 74 │ } 69 │ 75 │ 70 │ 76 │ functionBuilder.register( 'EquationsScene', EquationsScene ); 71 │ 77 │ - ..\function-builder\js\patterns\model\PatternsScene.js: 21-33 ..\function-builder\js\test\view\testImageFunctions.js: 12-24 21 │ 12 │ var Erase = require( 'FUNCTION_BUILDER/patterns/model/functions/Erase' ); 22 │ 13 │ var Grayscale = require( 'FUNCTION_BUILDER/patterns/model/functions/Grayscale' ); 23 │ 14 │ var Identity = require( 'FUNCTION_BUILDER/patterns/model/functions/Identity' ); 24 │ 15 │ var InvertRGB = require( 'FUNCTION_BUILDER/patterns/model/functions/InvertRGB' ); 25 │ 16 │ var Mirror = require( 'FUNCTION_BUILDER/patterns/model/functions/Mirror' ); 26 │ 17 │ var MysteryA = require( 'FUNCTION_BUILDER/patterns/model/functions/MysteryA' ); 27 │ 18 │ var MysteryB = require( 'FUNCTION_BUILDER/patterns/model/functions/MysteryB' ); 28 │ 19 │ var MysteryC = require( 'FUNCTION_BUILDER/patterns/model/functions/MysteryC' ); 29 │ 20 │ var Rotate90 = require( 'FUNCTION_BUILDER/patterns/model/functions/Rotate90' ); 30 │ 21 │ var Rotate180 = require( 'FUNCTION_BUILDER/patterns/model/functions/Rotate180' ); 31 │ 22 │ var Shrink = require( 'FUNCTION_BUILDER/patterns/model/functions/Shrink' ); 32 │ 23 │ var Warhol = require( 'FUNCTION_BUILDER/patterns/model/functions/Warhol' ); 33 │ 24 │ - ..\function-builder\js\patterns\model\PatternsScene.js: 35-49 ..\function-builder\js\test\view\testImageFunctions.js: 42-56 35 │ 42 │ var beakerImage = require( 'image!FUNCTION_BUILDER/cards/beaker.png' ); 36 │ 43 │ var butterflyImage = require( 'image!FUNCTION_BUILDER/cards/butterfly.png' ); 37 │ 44 │ var cherriesImage = require( 'image!FUNCTION_BUILDER/cards/cherries.png' ); 38 │ 45 │ var circleImage = require( 'image!FUNCTION_BUILDER/cards/circle.png' ); 39 │ 46 │ var feetImage = require( 'image!FUNCTION_BUILDER/cards/feet.png' ); 40 │ 47 │ var planetImage = require( 'image!FUNCTION_BUILDER/cards/planet.png' ); 41 │ 48 │ var rectangleImage = require( 'image!FUNCTION_BUILDER/cards/rectangle.png' ); 42 │ 49 │ var snowflakeImage = require( 'image!FUNCTION_BUILDER/cards/snowflake.png' ); 43 │ 50 │ var starImage = require( 'image!FUNCTION_BUILDER/cards/star.png' ); 44 │ 51 │ var stickFigureImage = require( 'image!FUNCTION_BUILDER/cards/stickFigure.png' ); 45 │ 52 │ var sunImage = require( 'image!FUNCTION_BUILDER/cards/sun.png' ); 46 │ 53 │ var triangleImage = require( 'image!FUNCTION_BUILDER/cards/triangle.png' ); 47 │ 54 │ 48 │ 55 │ /** 49 │ 56 │ * @param {Object} [options] - ..\gene-expression-essentials\js\common\model\MobileBiomolecule.js: 278-293 ..\gene-expression-essentials\js\common\model\Ribosome.js: 195-210 278 │ 195 │ centeredShape: function( shape, mvt ) { 279 │ 196 │ var viewShape = mvt.modelToViewShape( shape ); 280 │ 197 │ var shapeBounds = viewShape.bounds; 281 │ 198 │ var xOffset = shapeBounds.getCenterX(); 282 │ 199 │ var yOffset = shapeBounds.getCenterY(); 283 │ 200 │ var transform = Matrix3.translation( -xOffset, -yOffset ); 284 │ 201 │ var transformedShape = viewShape.transformed( transform ); 285 │ 202 │ return transformedShape; 286 │ 203 │ } 287 │ 204 │ 288 │ 205 │ 289 │ 206 │ } ); 290 │ 207 │ 291 │ 208 │ 292 │ 209 │ } ); 293 │ 210 │ - ..\gene-expression-essentials\js\common\model\BioShapeUtils.js: 94-101 ..\gene-expression-essentials\js\common\model\ShapeUtils.js: 32-39 94 │ 32 │ path.moveToPoint( points[ 0 ] ); 95 │ 33 │ for ( var i = 0; i < points.length; i++ ) { 96 │ 34 │ var segmentStartPoint = points[ i ]; 97 │ 35 │ var segmentEndPoint = points[ ( i + 1 ) % points.length ]; 98 │ 36 │ var previousPoint = points[ i - 1 >= 0 ? i - 1 : points.length - 1 ]; 99 │ 37 │ var nextPoint = points[ ( i + 2 ) % points.length ]; 100 │ 38 │ var controlPoint1 = ShapeUtils.extrapolateControlPoint( previousPoint, segmentStartPoint, segmentEndPoint ); 101 │ 39 │ var controlPoint2 = ShapeUtils.extrapolateControlPoint( nextPoint, segmentEndPoint, segmentStartPoint ); - ..\gene-expression-essentials\js\common\model\WindingBiomolecule.js: 71-87 ..\gene-expression-essentials\js\common\model\WindingBiomolecule.js: 384-400 71 │ 384 │ runSpringAlgorithm: function( firstPoint, lastPoint, bounds ) { 72 │ 385 │ 73 │ 386 │ if ( firstPoint === null ) { 74 │ 387 │ 75 │ 388 │ // Defensive programming. 76 │ 389 │ return; 77 │ 390 │ } 78 │ 391 │ 79 │ 392 │ // Position the first point at the upper left. 80 │ 393 │ firstPoint.setPosition( bounds.getMinX(), bounds.getMinY() + bounds.getHeight() ); 81 │ 394 │ if ( firstPoint === lastPoint ) { 82 │ 395 │ // Nothing more to do. 83 │ 396 │ return; 84 │ 397 │ } 85 │ 398 │ 86 │ 399 │ // Position the last point at the lower right. 87 │ 400 │ lastPoint.setPosition( bounds.getMaxX(), bounds.getMinY() ); - ..\gene-expression-essentials\js\manualgeneexpression\model\ProteinB.js: 44-82 ..\gene-expression-essentials\js\manualgeneexpression\model\ProteinC.js: 45-83 44 │ 45 │ return this.createShape( growthFactor ); 45 │ 46 │ }, 46 │ 47 │ 47 │ 48 │ /** 48 │ 49 │ * @param {Vector2} attachmentPointLocation 49 │ 50 │ */ 50 │ 51 │ setAttachmentPointPosition: function( attachmentPointLocation ) { 51 │ 52 │ // Note: This is specific to this protein's shape, and will need to be 52 │ 53 │ // adjusted if the protein's shape algorithm changes. 53 │ 54 │ this.setAttachmentPointPositionXY( attachmentPointLocation.x, attachmentPointLocation.y ); 54 │ 55 │ }, 55 │ 56 │ 56 │ 57 │ /** 57 │ 58 │ * 58 │ 59 │ * @param {number} attachmentPointLocationX 59 │ 60 │ * @param {number} attachmentPointLocationY 60 │ 61 │ */ 61 │ 62 │ setAttachmentPointPositionXY: function( attachmentPointLocationX, attachmentPointLocationY ) { 62 │ 63 │ // Note: This is specific to this protein's shape, and will need to be 63 │ 64 │ // adjusted if the protein's shape algorithm changes. 64 │ 65 │ this.setPosition( new Vector2( attachmentPointLocationX + FULL_GROWN_WIDTH * 0.12 * this.getFullSizeProportion(), 65 │ 66 │ attachmentPointLocationY + FULL_GROWN_WIDTH * 0.45 * this.getFullSizeProportion() ) ); 66 │ 67 │ }, 67 │ 68 │ /** 68 │ 69 │ * @returns {Shape} 69 │ 70 │ */ 70 │ 71 │ createInitialShape: function() { 71 │ 72 │ return this.createShape( 0 ); 72 │ 73 │ }, 73 │ 74 │ 74 │ 75 │ /** 75 │ 76 │ * @param {number} growthFactor 76 │ 77 │ * @returns {Shape} 77 │ 78 │ */ 78 │ 79 │ createShape: function( growthFactor ) { 79 │ 80 │ var currentWidth = Util.clamp( growthFactor, 0.01, 1 ) * FULL_GROWN_WIDTH; 80 │ 81 │ var path = new Shape(); 81 │ 82 │ var vector = new Vector2( -currentWidth / 2, 0 ); 82 │ 83 │ path.moveTo( vector.x, vector.y ); - ..\gene-expression-essentials\js\manualgeneexpression\view\ManualGeneExpressionScreenView.js: 68-83 ..\gene-expression-essentials\js\mrnaproduction\view\MessengerRnaProductionScreenView.js: 74-89 68 │ 74 │ self.addChild( this.modelRootNode ); 69 │ 75 │ 70 │ 76 │ 71 │ 77 │ // Add some layers for enforcing some z-order relationships needed in 72 │ 78 │ // order to keep things looking good. 73 │ 79 │ var dnaLayer = new Node(); 74 │ 80 │ this.modelRootNode.addChild( dnaLayer ); 75 │ 81 │ var biomoleculeToolBoxLayer = new Node(); 76 │ 82 │ this.modelRootNode.addChild( biomoleculeToolBoxLayer ); 77 │ 83 │ var messengerRnaLayer = new Node(); 78 │ 84 │ this.modelRootNode.addChild( messengerRnaLayer ); 79 │ 85 │ var topBiomoleculeLayer = new Node(); 80 │ 86 │ this.modelRootNode.addChild( topBiomoleculeLayer ); 81 │ 87 │ var placementHintLayer = new Node(); 82 │ 88 │ this.modelRootNode.addChild( placementHintLayer ); 83 │ 89 │ - ..\graphing-lines\js\common\view\manipulator\SlopeManipulator.js: 4-23 ..\graphing-lines\js\common\view\manipulator\X1Y1Manipulator.js: 4-23 4 │ 4 │ * 5 │ 5 │ * @author Chris Malley (PixelZoom, Inc.) 6 │ 6 │ */ 7 │ 7 │ define( function( require ) { 8 │ 8 │ 'use strict'; 9 │ 9 │ 10 │ 10 │ // modules 11 │ 11 │ var GLColors = require( 'GRAPHING_LINES/common/GLColors' ); 12 │ 12 │ var graphingLines = require( 'GRAPHING_LINES/graphingLines' ); 13 │ 13 │ var inherit = require( 'PHET_CORE/inherit' ); 14 │ 14 │ var Line = require( 'GRAPHING_LINES/common/model/Line' ); 15 │ 15 │ var Manipulator = require( 'GRAPHING_LINES/common/view/manipulator/Manipulator' ); 16 │ 16 │ var SimpleDragHandler = require( 'SCENERY/input/SimpleDragHandler' ); 17 │ 17 │ var Util = require( 'DOT/Util' ); 18 │ 18 │ var Vector2 = require( 'DOT/Vector2' ); 19 │ 19 │ 20 │ 20 │ /** 21 │ 21 │ * @param {number} radius 22 │ 22 │ * @param {Property.} lineProperty 23 │ 23 │ * @param {Property.} riseRangeProperty - ..\graphing-lines\js\common\view\manipulator\SlopeManipulator.js: 4-23 ..\graphing-lines\js\common\view\manipulator\X2Y2Manipulator.js: 4-23 4 │ 4 │ * 5 │ 5 │ * @author Chris Malley (PixelZoom, Inc.) 6 │ 6 │ */ 7 │ 7 │ define( function( require ) { 8 │ 8 │ 'use strict'; 9 │ 9 │ 10 │ 10 │ // modules 11 │ 11 │ var GLColors = require( 'GRAPHING_LINES/common/GLColors' ); 12 │ 12 │ var graphingLines = require( 'GRAPHING_LINES/graphingLines' ); 13 │ 13 │ var inherit = require( 'PHET_CORE/inherit' ); 14 │ 14 │ var Line = require( 'GRAPHING_LINES/common/model/Line' ); 15 │ 15 │ var Manipulator = require( 'GRAPHING_LINES/common/view/manipulator/Manipulator' ); 16 │ 16 │ var SimpleDragHandler = require( 'SCENERY/input/SimpleDragHandler' ); 17 │ 17 │ var Util = require( 'DOT/Util' ); 18 │ 18 │ var Vector2 = require( 'DOT/Vector2' ); 19 │ 19 │ 20 │ 20 │ /** 21 │ 21 │ * @param {number} radius 22 │ 22 │ * @param {Property.} lineProperty 23 │ 23 │ * @param {Property.} riseRangeProperty - ..\graphing-lines\js\common\view\manipulator\SlopeManipulator.js: 55-69 ..\graphing-lines\js\common\view\manipulator\X2Y2Manipulator.js: 55-69 55 │ 55 │ SimpleDragHandler.call( this, { 56 │ 56 │ 57 │ 57 │ allowTouchSnag: true, 58 │ 58 │ 59 │ 59 │ // note where the drag started 60 │ 60 │ start: function( event ) { 61 │ 61 │ var line = lineProperty.get(); 62 │ 62 │ var location = modelViewTransform.modelToViewXY( line.x2, line.y2 ); 63 │ 63 │ startOffset = event.currentTarget.globalToParentPoint( event.pointer.point ).minus( location ); 64 │ 64 │ }, 65 │ 65 │ 66 │ 66 │ drag: function( event ) { 67 │ 67 │ var parentPoint = event.currentTarget.globalToParentPoint( event.pointer.point ).minus( startOffset ); 68 │ 68 │ var location = modelViewTransform.viewToModelPosition( parentPoint ); 69 │ 69 │ // constrain to dynamic range, snap to grid - ..\graphing-lines\js\common\view\manipulator\SlopeManipulator.js: 4-23 ..\graphing-lines\js\common\view\manipulator\YInterceptManipulator.js: 5-24 4 │ 5 │ * 5 │ 6 │ * @author Chris Malley (PixelZoom, Inc.) 6 │ 7 │ */ 7 │ 8 │ define( function( require ) { 8 │ 9 │ 'use strict'; 9 │ 10 │ 10 │ 11 │ // modules 11 │ 12 │ var GLColors = require( 'GRAPHING_LINES/common/GLColors' ); 12 │ 13 │ var graphingLines = require( 'GRAPHING_LINES/graphingLines' ); 13 │ 14 │ var inherit = require( 'PHET_CORE/inherit' ); 14 │ 15 │ var Line = require( 'GRAPHING_LINES/common/model/Line' ); 15 │ 16 │ var Manipulator = require( 'GRAPHING_LINES/common/view/manipulator/Manipulator' ); 16 │ 17 │ var SimpleDragHandler = require( 'SCENERY/input/SimpleDragHandler' ); 17 │ 18 │ var Util = require( 'DOT/Util' ); 18 │ 19 │ var Vector2 = require( 'DOT/Vector2' ); 19 │ 20 │ 20 │ 21 │ /** 21 │ 22 │ * @param {number} radius 22 │ 23 │ * @param {Property.} lineProperty 23 │ 24 │ * @param {Property.} riseRangeProperty - ..\graphing-lines\js\common\view\manipulator\X1Y1Manipulator.js: 57-75 ..\graphing-lines\js\common\view\manipulator\YInterceptManipulator.js: 54-72 57 │ 54 │ SimpleDragHandler.call( this, { 58 │ 55 │ 59 │ 56 │ allowTouchSnag: true, 60 │ 57 │ 61 │ 58 │ // note where the drag started 62 │ 59 │ start: function( event ) { 63 │ 60 │ var line = lineProperty.get(); 64 │ 61 │ var location = modelViewTransform.modelToViewXY( line.x1, line.y1 ); 65 │ 62 │ startOffset = event.currentTarget.globalToParentPoint( event.pointer.point ).minus( location ); 66 │ 63 │ }, 67 │ 64 │ 68 │ 65 │ drag: function( event ) { 69 │ 66 │ 70 │ 67 │ var parentPoint = event.currentTarget.globalToParentPoint( event.pointer.point ).minus( startOffset ); 71 │ 68 │ var location = modelViewTransform.viewToModelPosition( parentPoint ); 72 │ 69 │ 73 │ 70 │ // constrain to range, snap to grid 74 │ 71 │ var x1 = Util.roundSymmetric( Util.clamp( location.x, x1RangeProperty.get().min, x1RangeProperty.get().max ) ); 75 │ 72 │ var y1 = Util.roundSymmetric( Util.clamp( location.y, y1RangeProperty.get().min, y1RangeProperty.get().max ) ); - ..\area-builder\js\area-builder-config.js: 10-39 ..\graphing-lines\js\graphing-lines-config.js: 11-40 10 │ 11 │ deps: [ 'area-builder-main' ], 11 │ 12 │ 12 │ 13 │ paths: { 13 │ 14 │ 14 │ 15 │ // third-party libs 15 │ 16 │ text: '../../sherpa/lib/text-2.0.12', 16 │ 17 │ 17 │ 18 │ // PhET plugins 18 │ 19 │ audio: '../../chipper/js/requirejs-plugins/audio', 19 │ 20 │ image: '../../chipper/js/requirejs-plugins/image', 20 │ 21 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 21 │ 22 │ string: '../../chipper/js/requirejs-plugins/string', 22 │ 23 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 23 │ 24 │ 24 │ 25 │ // PhET libs, uppercase names to identify them in require.js imports 25 │ 26 │ AXON: '../../axon/js', 26 │ 27 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 27 │ 28 │ DOT: '../../dot/js', 28 │ 29 │ JOIST: '../../joist/js', 29 │ 30 │ KITE: '../../kite/js', 30 │ 31 │ PHET_CORE: '../../phet-core/js', 31 │ 32 │ PHET_IO: '../../phet-io/js', 32 │ 33 │ PHETCOMMON: '../../phetcommon/js', 33 │ 34 │ REPOSITORY: '..', 34 │ 35 │ SCENERY: '../../scenery/js', 35 │ 36 │ SCENERY_PHET: '../../scenery-phet/js', 36 │ 37 │ SHERPA: '../../sherpa', 37 │ 38 │ SUN: '../../sun/js', 38 │ 39 │ TANDEM: '../../tandem/js', 39 │ 40 │ VIBE: '../../vibe/js', - ..\graphing-lines\js\linegame\model\ChallengeFactory1.js: 5-22 ..\graphing-lines\js\linegame\model\ChallengeFactory2.js: 6-23 5 │ 6 │ * 6 │ 7 │ * @author Chris Malley (PixelZoom, Inc.) 7 │ 8 │ */ 8 │ 9 │ define( function( require ) { 9 │ 10 │ 'use strict'; 10 │ 11 │ 11 │ 12 │ // modules 12 │ 13 │ var ChallengeFactory = require( 'GRAPHING_LINES/linegame/model/ChallengeFactory' ); 13 │ 14 │ var EquationForm = require( 'GRAPHING_LINES/linegame/model/EquationForm' ); 14 │ 15 │ var Fraction = require( 'PHETCOMMON/model/Fraction' ); 15 │ 16 │ var graphingLines = require( 'GRAPHING_LINES/graphingLines' ); 16 │ 17 │ var GraphTheLine = require( 'GRAPHING_LINES/linegame/model/GraphTheLine' ); 17 │ 18 │ var inherit = require( 'PHET_CORE/inherit' ); 18 │ 19 │ var Line = require( 'GRAPHING_LINES/common/model/Line' ); 19 │ 20 │ var MakeTheEquation = require( 'GRAPHING_LINES/linegame/model/MakeTheEquation' ); 20 │ 21 │ var ManipulationMode = require( 'GRAPHING_LINES/linegame/model/ManipulationMode' ); 21 │ 22 │ var RangeWithValue = require( 'DOT/RangeWithValue' ); 22 │ 23 │ var RandomChooser = require( 'GRAPHING_LINES/linegame/model/RandomChooser' ); - ..\graphing-lines\js\linegame\model\ChallengeFactory1.js: 114-130 ..\graphing-lines\js\linegame\model\ChallengeFactory2.js: 132-148 114 │ 132 │ yIntercept = RandomChooser.chooseFromArrays( yInterceptArrays ); // unique y-intercept 115 │ 133 │ challenges.push( new GraphTheLine( '1 of 3 required slopes', 116 │ 134 │ Line.createSlopeIntercept( slope.numerator, slope.denominator, yIntercept ), 117 │ 135 │ EquationForm.SLOPE_INTERCEPT, ManipulationMode.SLOPE, xRange, yRange ) ); 118 │ 136 │ 119 │ 137 │ // Graph-the-Line, slope-intercept form, intercept variable 120 │ 138 │ slope = RandomChooser.chooseFromArrays( slopeArrays ); // unique slope 121 │ 139 │ yIntercept = RandomChooser.chooseFromArrays( yInterceptArrays, yInterceptArrayIndices ); // first required y-intercept, unique 122 │ 140 │ challenges.push( new GraphTheLine( '1 of 2 required y-intercepts', 123 │ 141 │ Line.createSlopeIntercept( slope.numerator, slope.denominator, yIntercept ), 124 │ 142 │ EquationForm.SLOPE_INTERCEPT, ManipulationMode.INTERCEPT, xRange, yRange ) ); 125 │ 143 │ 126 │ 144 │ // Make-the-Equation, slope-intercept form, slope variable 127 │ 145 │ slope = RandomChooser.chooseFromArrays( slopeArrays, slopeArrayIndices ); // second required slope, unique 128 │ 146 │ yIntercept = RandomChooser.chooseFromArrays( yInterceptArrays ); // unique y-intercept 129 │ 147 │ challenges.push( new MakeTheEquation( '2 of 3 required slopes', 130 │ 148 │ Line.createSlopeIntercept( slope.numerator, slope.denominator, yIntercept ), - ..\graphing-lines\js\linegame\model\ChallengeFactory1.js: 129-146 ..\graphing-lines\js\linegame\model\ChallengeFactory2.js: 147-164 129 │ 147 │ challenges.push( new MakeTheEquation( '2 of 3 required slopes', 130 │ 148 │ Line.createSlopeIntercept( slope.numerator, slope.denominator, yIntercept ), 131 │ 149 │ EquationForm.SLOPE_INTERCEPT, ManipulationMode.SLOPE, xRange, yRange ) ); 132 │ 150 │ 133 │ 151 │ // Make-the-Equation, slope-intercept form, intercept variable 134 │ 152 │ slope = RandomChooser.chooseFromArrays( slopeArrays ); // unique slope 135 │ 153 │ yIntercept = RandomChooser.chooseFromArrays( yInterceptArrays, yInterceptArrayIndices ); // second required y-intercept, unique 136 │ 154 │ challenges.push( new MakeTheEquation( '2 of 2 required y-intercepts', 137 │ 155 │ Line.createSlopeIntercept( slope.numerator, slope.denominator, yIntercept ), 138 │ 156 │ EquationForm.SLOPE_INTERCEPT, ManipulationMode.INTERCEPT, xRange, yRange ) ); 139 │ 157 │ 140 │ 158 │ // Graph-the-Line, point-slope form, point or slope variable (random choice) 141 │ 159 │ { 142 │ 160 │ // manipulation mode 143 │ 161 │ manipulationMode = RandomChooser.choose( pointSlopeManipulationModes ); 144 │ 162 │ 145 │ 163 │ if ( manipulationMode === ManipulationMode.SLOPE ) { 146 │ 164 │ point = RandomChooser.chooseFromArrays( pointArrays ); // unique point - ..\graphing-lines\js\linegame\model\ChallengeFactory2.js: 118-126 ..\graphing-lines\js\linegame\model\ChallengeFactory3.js: 55-63 118 │ 55 │ slopeArrayIndices = RandomChooser.rangeToArray( new RangeWithValue( 0, slopeArrays.length - 1 ) ); 119 │ 56 │ 120 │ 57 │ // for y-intercept manipulation challenges, one must be positive, one negative 121 │ 58 │ yInterceptArrays = [ 122 │ 59 │ RandomChooser.rangeToArray( new RangeWithValue( yRange.min, -1 ) ), 123 │ 60 │ RandomChooser.rangeToArray( new RangeWithValue( 1, yRange.max ) ) 124 │ 61 │ ]; 125 │ 62 │ yInterceptArrayIndices = RandomChooser.rangeToArray( new RangeWithValue( 0, yInterceptArrays.length - 1 ) ); 126 │ 63 │ - ..\graphing-lines\js\linegame\model\ChallengeFactory2.js: 13-26 ..\graphing-lines\js\linegame\model\ChallengeFactory4.js: 12-25 13 │ 12 │ var ChallengeFactory = require( 'GRAPHING_LINES/linegame/model/ChallengeFactory' ); 14 │ 13 │ var EquationForm = require( 'GRAPHING_LINES/linegame/model/EquationForm' ); 15 │ 14 │ var Fraction = require( 'PHETCOMMON/model/Fraction' ); 16 │ 15 │ var graphingLines = require( 'GRAPHING_LINES/graphingLines' ); 17 │ 16 │ var GraphTheLine = require( 'GRAPHING_LINES/linegame/model/GraphTheLine' ); 18 │ 17 │ var inherit = require( 'PHET_CORE/inherit' ); 19 │ 18 │ var Line = require( 'GRAPHING_LINES/common/model/Line' ); 20 │ 19 │ var MakeTheEquation = require( 'GRAPHING_LINES/linegame/model/MakeTheEquation' ); 21 │ 20 │ var ManipulationMode = require( 'GRAPHING_LINES/linegame/model/ManipulationMode' ); 22 │ 21 │ var RandomChooser = require( 'GRAPHING_LINES/linegame/model/RandomChooser' ); 23 │ 22 │ var RangeWithValue = require( 'DOT/RangeWithValue' ); 24 │ 23 │ 25 │ 24 │ function ChallengeFactory2() { 26 │ 25 │ ChallengeFactory.call( this ); - ..\graphing-lines\js\linegame\model\ChallengeFactory2.js: 114-129 ..\graphing-lines\js\linegame\model\ChallengeFactory4.js: 53-68 114 │ 53 │ var manipulationMode; 115 │ 54 │ 116 │ 55 │ // for slope manipulation challenges, 1 slope must come from each list 117 │ 56 │ slopeArrays = ChallengeFactory2.createSlopeArrays(); 118 │ 57 │ slopeArrayIndices = RandomChooser.rangeToArray( new RangeWithValue( 0, slopeArrays.length - 1 ) ); 119 │ 58 │ 120 │ 59 │ // for y-intercept manipulation challenges, one must be positive, one negative 121 │ 60 │ yInterceptArrays = [ 122 │ 61 │ RandomChooser.rangeToArray( new RangeWithValue( yRange.min, -1 ) ), 123 │ 62 │ RandomChooser.rangeToArray( new RangeWithValue( 1, yRange.max ) ) 124 │ 63 │ ]; 125 │ 64 │ yInterceptArrayIndices = RandomChooser.rangeToArray( new RangeWithValue( 0, yInterceptArrays.length - 1 ) ); 126 │ 65 │ 127 │ 66 │ // for point-slope form, one of each manipulation mode 128 │ 67 │ pointSlopeManipulationModes = [ ManipulationMode.POINT, ManipulationMode.SLOPE ]; 129 │ 68 │ - ..\graphing-lines\js\linegame\model\ChallengeFactory5.js: 140-152 ..\graphing-lines\js\linegame\model\ChallengeFactory6.js: 86-98 140 │ 86 │ y1 = RandomChooser.choose( yList ); 141 │ 87 │ x2 = RandomChooser.choose( xList ); 142 │ 88 │ if ( x2 === x1 ) { 143 │ 89 │ x2 = RandomChooser.choose( xList ); // prevent undefined slope 144 │ 90 │ } 145 │ 91 │ y2 = RandomChooser.choose( yList ); 146 │ 92 │ 147 │ 93 │ // exclude slopes of +1 and -1 148 │ 94 │ slope = ( y2 - y1 ) / ( x2 - x1 ); 149 │ 95 │ if ( slope === 1 || slope === -1 ) { 150 │ 96 │ y2 = RandomChooser.choose( yList ); 151 │ 97 │ } 152 │ 98 │ - ..\graphing-lines\js\pointslope\view\PointSlopeEquationNode.js: 10-33 ..\graphing-lines\js\slopeintercept\view\SlopeInterceptEquationNode.js: 13-36 10 │ 13 │ * 11 │ 14 │ * @author Chris Malley (PixelZoom, Inc.) 12 │ 15 │ */ 13 │ 16 │ define( function( require ) { 14 │ 17 │ 'use strict'; 15 │ 18 │ 16 │ 19 │ // modules 17 │ 20 │ var DynamicValueNode = require( 'GRAPHING_LINES/common/view/DynamicValueNode' ); 18 │ 21 │ var GLColors = require( 'GRAPHING_LINES/common/GLColors' ); 19 │ 22 │ var GLConstants = require( 'GRAPHING_LINES/common/GLConstants' ); 20 │ 23 │ var GLFont = require( 'GRAPHING_LINES/common/GLFont' ); 21 │ 24 │ var graphingLines = require( 'GRAPHING_LINES/graphingLines' ); 22 │ 25 │ var inherit = require( 'PHET_CORE/inherit' ); 23 │ 26 │ var EquationNode = require( 'GRAPHING_LINES/common/view/EquationNode' ); 24 │ 27 │ var Line = require( 'GRAPHING_LINES/common/model/Line' ); 25 │ 28 │ var MinusNode = require( 'SCENERY_PHET/MinusNode' ); 26 │ 29 │ var NumberPicker = require( 'SCENERY_PHET/NumberPicker' ); 27 │ 30 │ var PlusNode = require( 'SCENERY_PHET/PlusNode' ); 28 │ 31 │ var Property = require( 'AXON/Property' ); 29 │ 32 │ var scenery = { Line: require( 'SCENERY/nodes/Line' ) }; // scenery.Line, workaround for name collision with graphing-lines.Line 30 │ 33 │ var SlopePicker = require( 'GRAPHING_LINES/common/view/picker/SlopePicker' ); 31 │ 34 │ var StringUtils = require( 'PHETCOMMON/util/StringUtils' ); 32 │ 35 │ var SubSupText = require( 'SCENERY_PHET/SubSupText' ); 33 │ 36 │ var Text = require( 'SCENERY/nodes/Text' ); - ..\graphing-lines\js\pointslope\view\PointSlopeEquationNode.js: 68-76 ..\graphing-lines\js\slopeintercept\view\SlopeInterceptEquationNode.js: 70-78 68 │ 70 │ var fullyInteractive = ( options.interactivePoint && options.interactiveSlope ); 69 │ 71 │ var interactiveFont = new GLFont( { size: options.fontSize, weight: 'bold' } ); 70 │ 72 │ var staticFont = new GLFont( { size: options.fontSize, weight: 'bold' } ); 71 │ 73 │ var staticOptions = { font: staticFont, fill: options.staticColor }; 72 │ 74 │ var fractionLineOptions = { stroke: options.staticColor, lineWidth: self.fractionLineThickness }; 73 │ 75 │ 74 │ 76 │ // internal properties that are connected to pickers 75 │ 77 │ var x1Property = new Property( lineProperty.get().x1 ); 76 │ 78 │ var y1Property = new Property( lineProperty.get().y1 ); - ..\graphing-lines\js\pointslope\view\PointSlopeEquationNode.js: 106-119 ..\graphing-lines\js\slopeintercept\view\SlopeInterceptEquationNode.js: 97-110 106 │ 97 │ var equalsNode = new Text( '=', staticOptions ); 107 │ 98 │ var slopeMinusSignNode = new MinusNode( _.extend( { size: self.signLineSize }, staticOptions ) ); 108 │ 99 │ var riseNode; 109 │ 100 │ var runNode; 110 │ 101 │ if ( options.interactiveSlope ) { 111 │ 102 │ riseNode = new SlopePicker( riseProperty, runProperty, options.riseRangeProperty, { font: interactiveFont } ); 112 │ 103 │ runNode = new SlopePicker( runProperty, riseProperty, options.runRangeProperty, { font: interactiveFont } ); 113 │ 104 │ } 114 │ 105 │ else { 115 │ 106 │ riseNode = new DynamicValueNode( riseProperty, _.extend( { absoluteValue: true }, staticOptions ) ); 116 │ 107 │ runNode = new DynamicValueNode( runProperty, _.extend( { absoluteValue: true }, staticOptions ) ); 117 │ 108 │ } 118 │ 109 │ var fractionLineNode = new scenery.Line( 0, 0, maxSlopePickerWidth, 0, fractionLineOptions ); 119 │ 110 │ var xLeftParenNode = new Text( '(', staticOptions ); - ..\graphing-lines\js\pointslope\view\PointSlopeEquationNode.js: 148-164 ..\graphing-lines\js\slopeintercept\view\SlopeInterceptEquationNode.js: 137-153 148 │ 137 │ var interactive = options.interactivePoint || options.interactiveSlope; 149 │ 138 │ var lineColor = line.color; 150 │ 139 │ 151 │ 140 │ // start with all children invisible 152 │ 141 │ var len = self.children.length; 153 │ 142 │ for ( var i = 0; i < len; i++ ) { 154 │ 143 │ self.children[ i ].visible = false; 155 │ 144 │ } 156 │ 145 │ 157 │ 146 │ if ( line.undefinedSlope() && !interactive ) { 158 │ 147 │ // slope is undefined and nothing is interactive 159 │ 148 │ slopeUndefinedNode.visible = true; 160 │ 149 │ slopeUndefinedNode.fill = lineColor; 161 │ 150 │ slopeUndefinedNode.text = StringUtils.format( slopeUndefinedString, symbolXString, line.x1 ); 162 │ 151 │ return; 163 │ 152 │ } 164 │ 153 │ else if ( !interactive && line.same( Line.Y_EQUALS_X_LINE ) ) { - ..\graphing-lines\js\pointslope\view\PointSlopeEquationNode.js: 262-278 ..\graphing-lines\js\slopeintercept\view\SlopeInterceptEquationNode.js: 193-209 262 │ 193 │ if ( positiveSlope || zeroSlope ) { 263 │ 194 │ // no sign 264 │ 195 │ previousNode = equalsNode; 265 │ 196 │ previousXOffset = self.relationalOperatorXSpacing; 266 │ 197 │ } 267 │ 198 │ else { 268 │ 199 │ // - 269 │ 200 │ slopeMinusSignNode.visible = true; 270 │ 201 │ slopeMinusSignNode.fill = lineColor; 271 │ 202 │ slopeMinusSignNode.left = equalsNode.right + self.relationalOperatorXSpacing; 272 │ 203 │ slopeMinusSignNode.centerY = equalsNode.centerY + self.slopeSignYFudgeFactor + self.slopeSignYOffset; 273 │ 204 │ previousNode = slopeMinusSignNode; 274 │ 205 │ previousXOffset = ( fractionalSlope ? self.fractionSignXSpacing : self.integerSignXSpacing ); 275 │ 206 │ } 276 │ 207 │ 277 │ 208 │ if ( line.undefinedSlope() || fractionalSlope ) { 278 │ 209 │ // rise/run - ..\graphing-lines\js\pointslope\view\PointSlopeEquationNode.js: 361-379 ..\graphing-lines\js\slopeintercept\view\SlopeInterceptEquationNode.js: 378-396 361 │ 378 │ } 362 │ 379 │ updatingControls = false; 363 │ 380 │ 364 │ 381 │ // Fully-interactive equations have a constant form, no need to update layout when line changes. 365 │ 382 │ if ( !fullyInteractive ) { updateLayout( line ); } 366 │ 383 │ } ); 367 │ 384 │ 368 │ 385 │ // For fully-interactive equations ... 369 │ 386 │ if ( fullyInteractive ) { 370 │ 387 │ 371 │ 388 │ // update layout once 372 │ 389 │ updateLayout( lineProperty.get() ); 373 │ 390 │ 374 │ 391 │ // add undefinedSlopeIndicator 375 │ 392 │ var undefinedSlopeIndicator = new UndefinedSlopeIndicator( self.width, self.height, staticOptions ); 376 │ 393 │ self.addChild( undefinedSlopeIndicator ); 377 │ 394 │ undefinedSlopeIndicator.centerX = self.centerX; 378 │ 395 │ undefinedSlopeIndicator.centerY = fractionLineNode.centerY - self.undefinedSlopeYFudgeFactor; 379 │ 396 │ lineProperty.link( function( line ) { - ..\area-builder\js\area-builder-config.js: 10-43 ..\graphing-quadratics\js\graphing-quadratics-config.js: 11-44 10 │ 11 │ deps: [ 'area-builder-main' ], 11 │ 12 │ 12 │ 13 │ paths: { 13 │ 14 │ 14 │ 15 │ // third-party libs 15 │ 16 │ text: '../../sherpa/lib/text-2.0.12', 16 │ 17 │ 17 │ 18 │ // PhET plugins 18 │ 19 │ audio: '../../chipper/js/requirejs-plugins/audio', 19 │ 20 │ image: '../../chipper/js/requirejs-plugins/image', 20 │ 21 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 21 │ 22 │ string: '../../chipper/js/requirejs-plugins/string', 22 │ 23 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 23 │ 24 │ 24 │ 25 │ // PhET libs, uppercase names to identify them in require.js imports 25 │ 26 │ AXON: '../../axon/js', 26 │ 27 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 27 │ 28 │ DOT: '../../dot/js', 28 │ 29 │ JOIST: '../../joist/js', 29 │ 30 │ KITE: '../../kite/js', 30 │ 31 │ PHET_CORE: '../../phet-core/js', 31 │ 32 │ PHET_IO: '../../phet-io/js', 32 │ 33 │ PHETCOMMON: '../../phetcommon/js', 33 │ 34 │ REPOSITORY: '..', 34 │ 35 │ SCENERY: '../../scenery/js', 35 │ 36 │ SCENERY_PHET: '../../scenery-phet/js', 36 │ 37 │ SHERPA: '../../sherpa', 37 │ 38 │ SUN: '../../sun/js', 38 │ 39 │ TANDEM: '../../tandem/js', 39 │ 40 │ VIBE: '../../vibe/js', 40 │ 41 │ VEGAS: '../../vegas/js', 41 │ 42 │ 42 │ 43 │ // this sim 43 │ 44 │ AREA_BUILDER: '.' - ..\graphing-quadratics\js\decimals\view\DecimalsView.js: 4-21 ..\graphing-quadratics\js\integers\view\IntegersView.js: 4-21 4 │ 4 │ * 5 │ 5 │ * @author Chris Malley (PixelZoom, Inc.) 6 │ 6 │ */ 7 │ 7 │ define( function( require ) { 8 │ 8 │ 'use strict'; 9 │ 9 │ 10 │ 10 │ // modules 11 │ 11 │ var GQConstants = require( 'GRAPHING_QUADRATICS/common/GQConstants' ); 12 │ 12 │ var GQFont = require( 'GRAPHING_QUADRATICS/common/GQFont' ); 13 │ 13 │ var graphingQuadratics = require( 'GRAPHING_QUADRATICS/graphingQuadratics' ); 14 │ 14 │ var inherit = require( 'PHET_CORE/inherit' ); 15 │ 15 │ var Node = require( 'SCENERY/nodes/Node' ); 16 │ 16 │ var ResetAllButton = require( 'SCENERY_PHET/buttons/ResetAllButton' ); 17 │ 17 │ var ScreenView = require( 'JOIST/ScreenView' ); 18 │ 18 │ var Text = require( 'SCENERY/nodes/Text' ); 19 │ 19 │ 20 │ 20 │ /** 21 │ 21 │ * @param {DecimalsModel} model - ..\graphing-quadratics\js\decimals\view\DecimalsView.js: 4-21 ..\graphing-quadratics\js\vertexform\view\VertexFormView.js: 4-21 4 │ 4 │ * 5 │ 5 │ * @author Chris Malley (PixelZoom, Inc.) 6 │ 6 │ */ 7 │ 7 │ define( function( require ) { 8 │ 8 │ 'use strict'; 9 │ 9 │ 10 │ 10 │ // modules 11 │ 11 │ var GQConstants = require( 'GRAPHING_QUADRATICS/common/GQConstants' ); 12 │ 12 │ var GQFont = require( 'GRAPHING_QUADRATICS/common/GQFont' ); 13 │ 13 │ var graphingQuadratics = require( 'GRAPHING_QUADRATICS/graphingQuadratics' ); 14 │ 14 │ var inherit = require( 'PHET_CORE/inherit' ); 15 │ 15 │ var Node = require( 'SCENERY/nodes/Node' ); 16 │ 16 │ var ResetAllButton = require( 'SCENERY_PHET/buttons/ResetAllButton' ); 17 │ 17 │ var ScreenView = require( 'JOIST/ScreenView' ); 18 │ 18 │ var Text = require( 'SCENERY/nodes/Text' ); 19 │ 19 │ 20 │ 20 │ /** 21 │ 21 │ * @param {DecimalsModel} model - ..\gravity-and-orbits\js\common\module\ModeList.js: 365-377 ..\gravity-and-orbits\js\common\module\ModeList.js: 392-404 365 │ 392 │ EARTH_MASS, EARTH_RADIUS, EARTH_PERIHELION, 0, 0, EARTH_ORBITAL_SPEED_AT_PERIHELION ); 366 │ 393 │ this.timeScale = 1; 367 │ 394 │ ModeConfig.call( this, 1.25 ); 368 │ 395 │ this.initialMeasuringTapeLocation = new Line( 369 │ 396 │ (this.sun.x + this.earth.x) / 3, 370 │ 397 │ -this.earth.x / 2, 371 │ 398 │ (this.sun.x + this.earth.x) / 3 + milesToMeters( 50000000 ), 372 │ 399 │ -this.earth.x / 2 ); 373 │ 400 │ this.forceScale = FORCE_SCALE * 120; 374 │ 401 │ } 375 │ 402 │ 376 │ 403 │ inherit( ModeConfig, SunEarthModeConfig, { 377 │ 404 │ - ..\build-an-atom\js\build-an-atom-config.js: 5-33 ..\gravity-force-lab\js\gravity-force-lab-config.js: 10-38 5 │ 10 │ deps: [ 'build-an-atom-main' ], 6 │ 11 │ 7 │ 12 │ paths: { 8 │ 13 │ 9 │ 14 │ // third party libs 10 │ 15 │ text: '../../sherpa/lib/text-2.0.12', 11 │ 16 │ 12 │ 17 │ // plugins 13 │ 18 │ audio: '../../chipper/js/requirejs-plugins/audio', 14 │ 19 │ image: '../../chipper/js/requirejs-plugins/image', 15 │ 20 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 16 │ 21 │ string: '../../chipper/js/requirejs-plugins/string', 17 │ 22 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 18 │ 23 │ 19 │ 24 │ // PhET libs, uppercase names to identify them in require.js imports 20 │ 25 │ AXON: '../../axon/js', 21 │ 26 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 22 │ 27 │ DOT: '../../dot/js', 23 │ 28 │ JOIST: '../../joist/js', 24 │ 29 │ KITE: '../../kite/js', 25 │ 30 │ PHET_CORE: '../../phet-core/js', 26 │ 31 │ PHET_IO: '../../phet-io/js', 27 │ 32 │ PHETCOMMON: '../../phetcommon/js', 28 │ 33 │ REPOSITORY: '..', 29 │ 34 │ SCENERY: '../../scenery/js', 30 │ 35 │ SCENERY_PHET: '../../scenery-phet/js', 31 │ 36 │ SHERPA: '../../sherpa', 32 │ 37 │ SHRED: '../../shred/js', 33 │ 38 │ SUN: '../../sun/js', - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-44 ..\gravity-force-lab-basics\js\gravity-force-lab-basics-config.js: 11-44 11 │ 11 │ deps: [ 'area-model-multiplication-main' ], 12 │ 12 │ 13 │ 13 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 14 │ 15 │ 15 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 16 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 17 │ paths: { 18 │ 18 │ 19 │ 19 │ // third-party libs 20 │ 20 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 21 │ 22 │ 22 │ // PhET plugins 23 │ 23 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 24 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 25 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 26 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 27 │ 28 │ 28 │ // common directories, uppercase names to identify them in require imports 29 │ 29 │ AXON: '../../axon/js', 30 │ 30 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 31 │ DOT: '../../dot/js', 32 │ 32 │ JOIST: '../../joist/js', 33 │ 33 │ KITE: '../../kite/js', 34 │ 34 │ PHET_CORE: '../../phet-core/js', 35 │ 35 │ PHET_IO: '../../phet-io/js', 36 │ 36 │ PHETCOMMON: '../../phetcommon/js', 37 │ 37 │ REPOSITORY: '..', 38 │ 38 │ SCENERY: '../../scenery/js', 39 │ 39 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 40 │ SUN: '../../sun/js', 41 │ 41 │ TANDEM: '../../tandem/js', 42 │ 42 │ 43 │ 43 │ // this sim 44 │ 44 │ AREA_MODEL_MULTIPLICATION: '.' - ..\balancing-act\js\balancing-act-config.js: 25-45 ..\griddle\js\griddle-config.js: 12-32 25 │ 12 │ image: '../../chipper/js/requirejs-plugins/image', 26 │ 13 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 27 │ 14 │ string: '../../chipper/js/requirejs-plugins/string', 28 │ 15 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 29 │ 16 │ 30 │ 17 │ // PhET libs, uppercase names to identify them in require.js imports 31 │ 18 │ AXON: '../../axon/js', 32 │ 19 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 33 │ 20 │ DOT: '../../dot/js', 34 │ 21 │ JOIST: '../../joist/js', 35 │ 22 │ KITE: '../../kite/js', 36 │ 23 │ PHETCOMMON: '../../phetcommon/js', 37 │ 24 │ REPOSITORY: '..', 38 │ 25 │ PHET_CORE: '../../phet-core/js', 39 │ 26 │ PHET_IO: '../../phet-io/js', 40 │ 27 │ SCENERY: '../../scenery/js', 41 │ 28 │ SCENERY_PHET: '../../scenery-phet/js', 42 │ 29 │ SHERPA: '../../sherpa', 43 │ 30 │ SUN: '../../sun/js', 44 │ 31 │ TANDEM: '../../tandem/js', 45 │ 32 │ VEGAS: '../../vegas/js', - ..\hookes-law\js\common\view\AppliedForceControl.js: 4-22 ..\hookes-law\js\common\view\DisplacementControl.js: 4-22 4 │ 4 │ * 5 │ 5 │ * @author Chris Malley (PixelZoom, Inc.) 6 │ 6 │ */ 7 │ 7 │ define( function( require ) { 8 │ 8 │ 'use strict'; 9 │ 9 │ 10 │ 10 │ // modules 11 │ 11 │ var hookesLaw = require( 'HOOKES_LAW/hookesLaw' ); 12 │ 12 │ var HookesLawColors = require( 'HOOKES_LAW/common/HookesLawColors' ); 13 │ 13 │ var HookesLawConstants = require( 'HOOKES_LAW/common/HookesLawConstants' ); 14 │ 14 │ var inherit = require( 'PHET_CORE/inherit' ); 15 │ 15 │ var NumberControl = require( 'SCENERY_PHET/NumberControl' ); 16 │ 16 │ var StringUtils = require( 'PHETCOMMON/util/StringUtils' ); 17 │ 17 │ var Text = require( 'SCENERY/nodes/Text' ); 18 │ 18 │ var Util = require( 'DOT/Util' ); 19 │ 19 │ 20 │ 20 │ // strings 21 │ 21 │ var appliedForceColonString = require( 'string!HOOKES_LAW/appliedForceColon' ); 22 │ 22 │ var newtonsString = require( 'string!HOOKES_LAW/newtons' ); - ..\hookes-law\js\common\view\DisplacementVectorNode.js: 77-90 ..\hookes-law\js\common\view\ForceVectorNode.js: 93-106 77 │ 93 │ // resize the background behind the value 78 │ 94 │ backgroundNode.setRect( 0, 0, 1.1 * valueNode.width, 1.1 * valueNode.height, 5, 5 ); 79 │ 95 │ backgroundNode.center = valueNode.center; 80 │ 96 │ } ); 81 │ 97 │ 82 │ 98 │ options.valueVisibleProperty.link( function( visible ) { 83 │ 99 │ valueNode.visible = backgroundNode.visible = visible; 84 │ 100 │ } ); 85 │ 101 │ 86 │ 102 │ Node.call( this, options ); 87 │ 103 │ } 88 │ 104 │ 89 │ 105 │ hookesLaw.register( 'DisplacementVectorNode', DisplacementVectorNode ); 90 │ 106 │ - ..\hookes-law\js\common\view\AppliedForceControl.js: 4-22 ..\hookes-law\js\common\view\SpringConstantControl.js: 4-22 4 │ 4 │ * 5 │ 5 │ * @author Chris Malley (PixelZoom, Inc.) 6 │ 6 │ */ 7 │ 7 │ define( function( require ) { 8 │ 8 │ 'use strict'; 9 │ 9 │ 10 │ 10 │ // modules 11 │ 11 │ var hookesLaw = require( 'HOOKES_LAW/hookesLaw' ); 12 │ 12 │ var HookesLawColors = require( 'HOOKES_LAW/common/HookesLawColors' ); 13 │ 13 │ var HookesLawConstants = require( 'HOOKES_LAW/common/HookesLawConstants' ); 14 │ 14 │ var inherit = require( 'PHET_CORE/inherit' ); 15 │ 15 │ var NumberControl = require( 'SCENERY_PHET/NumberControl' ); 16 │ 16 │ var StringUtils = require( 'PHETCOMMON/util/StringUtils' ); 17 │ 17 │ var Text = require( 'SCENERY/nodes/Text' ); 18 │ 18 │ var Util = require( 'DOT/Util' ); 19 │ 19 │ 20 │ 20 │ // strings 21 │ 21 │ var appliedForceColonString = require( 'string!HOOKES_LAW/appliedForceColon' ); 22 │ 22 │ var newtonsString = require( 'string!HOOKES_LAW/newtons' ); - ..\hookes-law\js\common\view\DisplacementControl.js: 50-59 ..\hookes-law\js\common\view\SpringConstantControl.js: 48-57 50 │ 48 │ }, options ); 51 │ 49 │ 52 │ 50 │ // major ticks 53 │ 51 │ if ( options.majorTickValues ) { 54 │ 52 │ options.majorTicks = []; 55 │ 53 │ for ( var i = 0; i < options.majorTickValues.length; i++ ) { 56 │ 54 │ options.majorTicks.push( { 57 │ 55 │ value: options.majorTickValues[ i ], 58 │ 56 │ label: new Text( Util.toFixed( options.majorTickValues[ i ], 0 ), HookesLawConstants.MAJOR_TICK_LABEL_OPTIONS ) 59 │ 57 │ } ); - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-44 ..\hookes-law\js\hookes-law-config.js: 11-44 11 │ 11 │ deps: [ 'area-model-multiplication-main' ], 12 │ 12 │ 13 │ 13 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 14 │ 15 │ 15 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 16 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 17 │ paths: { 18 │ 18 │ 19 │ 19 │ // third-party libs 20 │ 20 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 21 │ 22 │ 22 │ // PhET plugins 23 │ 23 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 24 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 25 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 26 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 27 │ 28 │ 28 │ // common directories, uppercase names to identify them in require imports 29 │ 29 │ AXON: '../../axon/js', 30 │ 30 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 31 │ DOT: '../../dot/js', 32 │ 32 │ JOIST: '../../joist/js', 33 │ 33 │ KITE: '../../kite/js', 34 │ 34 │ PHET_CORE: '../../phet-core/js', 35 │ 35 │ PHET_IO: '../../phet-io/js', 36 │ 36 │ PHETCOMMON: '../../phetcommon/js', 37 │ 37 │ REPOSITORY: '..', 38 │ 38 │ SCENERY: '../../scenery/js', 39 │ 39 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 40 │ SUN: '../../sun/js', 41 │ 41 │ TANDEM: '../../tandem/js', 42 │ 42 │ 43 │ 43 │ // this sim 44 │ 44 │ AREA_MODEL_MULTIPLICATION: '.' - ..\hookes-law\js\energy\view\EnergySystemNode.js: 15-27 ..\hookes-law\js\intro\view\IntroSystemNode.js: 14-26 15 │ 14 │ var EnergySpringControls = require( 'HOOKES_LAW/energy/view/EnergySpringControls' ); 16 │ 15 │ var EquilibriumPositionNode = require( 'HOOKES_LAW/common/view/EquilibriumPositionNode' ); 17 │ 16 │ var hookesLaw = require( 'HOOKES_LAW/hookesLaw' ); 18 │ 17 │ var HookesLawColors = require( 'HOOKES_LAW/common/HookesLawColors' ); 19 │ 18 │ var HookesLawConstants = require( 'HOOKES_LAW/common/HookesLawConstants' ); 20 │ 19 │ var HookesLawSpringNode = require( 'HOOKES_LAW/common/view/HookesLawSpringNode' ); 21 │ 20 │ var inherit = require( 'PHET_CORE/inherit' ); 22 │ 21 │ var NibNode = require( 'HOOKES_LAW/common/view/NibNode' ); 23 │ 22 │ var Node = require( 'SCENERY/nodes/Node' ); 24 │ 23 │ var Property = require( 'AXON/Property' ); 25 │ 24 │ var RoboticArmNode = require( 'HOOKES_LAW/common/view/RoboticArmNode' ); 26 │ 25 │ var Util = require( 'DOT/Util' ); 27 │ 26 │ var WallNode = require( 'HOOKES_LAW/common/view/WallNode' ); - ..\hookes-law\js\energy\view\EnergySystemNode.js: 75-90 ..\hookes-law\js\intro\view\IntroSystemNode.js: 78-93 75 │ 78 │ centerY: yOrigin 76 │ 79 │ } ); 77 │ 80 │ 78 │ 81 │ var roboticArmNode = new RoboticArmNode( roboticArm, spring.rightRangeProperty, numberOfInteractionsInProgressProperty, { 79 │ 82 │ unitDisplacementLength: options.unitDisplacementLength, 80 │ 83 │ x: options.unitDisplacementLength * roboticArm.right, 81 │ 84 │ y: yOrigin 82 │ 85 │ } ); 83 │ 86 │ 84 │ 87 │ var equilibriumPositionNode = new EquilibriumPositionNode( wallNode.height, { 85 │ 88 │ centerX: options.unitDisplacementLength * spring.equilibriumXProperty.get(), 86 │ 89 │ centerY: yOrigin 87 │ 90 │ } ); 88 │ 91 │ 89 │ 92 │ var appliedForceVectorNode = new AppliedForceVectorNode( spring.appliedForceProperty, { 90 │ 93 │ unitLength: HookesLawConstants.ENERGY_UNIT_FORCE_X, // view length of a 1N force vector - ..\hookes-law\js\energy\view\EnergySystemNode.js: 125-140 ..\hookes-law\js\intro\view\IntroSystemNode.js: 135-150 125 │ 135 │ appliedForceVectorNode.x = nibNode.x = ( options.unitDisplacementLength * right ); 126 │ 136 │ } ); 127 │ 137 │ 128 │ 138 │ // Open pincers when displacement is zero and no user interactions affecting displacement are talking place. 129 │ 139 │ Property.multilink( [ numberOfInteractionsInProgressProperty, spring.displacementProperty ], 130 │ 140 │ function( numberOfInteractions, displacement ) { 131 │ 141 │ assert && assert( numberOfInteractions >= 0 ); 132 │ 142 │ var fixedDisplacement = Util.toFixedNumber( displacement, HookesLawConstants.DISPLACEMENT_DECIMAL_PLACES ); 133 │ 143 │ roboticArmNode.setPincersOpen( numberOfInteractions === 0 && fixedDisplacement === 0 ); 134 │ 144 │ } ); 135 │ 145 │ 136 │ 146 │ Node.call( this, options ); 137 │ 147 │ } 138 │ 148 │ 139 │ 149 │ hookesLaw.register( 'EnergySystemNode', EnergySystemNode ); 140 │ 150 │ - ..\hookes-law\js\systems\view\ParallelSpringControls.js: 73-88 ..\hookes-law\js\systems\view\SeriesSpringControls.js: 70-85 73 │ 70 │ ] 74 │ 71 │ } ); 75 │ 72 │ 76 │ 73 │ var appliedForceControl = new AppliedForceControl( 77 │ 74 │ system.equivalentSpring.appliedForceProperty, system.equivalentSpring.appliedForceRange, numberOfInteractionsInProgressProperty ); 78 │ 75 │ 79 │ 76 │ options.spacing = 10; 80 │ 77 │ options.children = [ 81 │ 78 │ new Panel( springControls, HookesLawConstants.SPRING_PANEL_OPTIONS ), 82 │ 79 │ new Panel( appliedForceControl, HookesLawConstants.SPRING_PANEL_OPTIONS ) 83 │ 80 │ ]; 84 │ 81 │ HBox.call( this, options ); 85 │ 82 │ } 86 │ 83 │ 87 │ 84 │ hookesLaw.register( 'ParallelSpringControls', ParallelSpringControls ); 88 │ 85 │ - ..\hookes-law\js\intro\view\IntroSystemNode.js: 5-26 ..\hookes-law\js\systems\view\SeriesSystemNode.js: 4-25 5 │ 4 │ * Origin is at the point where the spring attaches to the wall. 6 │ 5 │ * 7 │ 6 │ * @author Chris Malley (PixelZoom, Inc.) 8 │ 7 │ */ 9 │ 8 │ define( function( require ) { 10 │ 9 │ 'use strict'; 11 │ 10 │ 12 │ 11 │ // modules 13 │ 12 │ var AppliedForceVectorNode = require( 'HOOKES_LAW/common/view/AppliedForceVectorNode' ); 14 │ 13 │ var DisplacementVectorNode = require( 'HOOKES_LAW/common/view/DisplacementVectorNode' ); 15 │ 14 │ var EquilibriumPositionNode = require( 'HOOKES_LAW/common/view/EquilibriumPositionNode' ); 16 │ 15 │ var hookesLaw = require( 'HOOKES_LAW/hookesLaw' ); 17 │ 16 │ var HookesLawColors = require( 'HOOKES_LAW/common/HookesLawColors' ); 18 │ 17 │ var HookesLawConstants = require( 'HOOKES_LAW/common/HookesLawConstants' ); 19 │ 18 │ var HookesLawSpringNode = require( 'HOOKES_LAW/common/view/HookesLawSpringNode' ); 20 │ 19 │ var inherit = require( 'PHET_CORE/inherit' ); 21 │ 20 │ var NibNode = require( 'HOOKES_LAW/common/view/NibNode' ); 22 │ 21 │ var Node = require( 'SCENERY/nodes/Node' ); 23 │ 22 │ var Property = require( 'AXON/Property' ); 24 │ 23 │ var RoboticArmNode = require( 'HOOKES_LAW/common/view/RoboticArmNode' ); 25 │ 24 │ var IntroSpringControls = require( 'HOOKES_LAW/intro/view/IntroSpringControls' ); 26 │ 25 │ var SpringForceVectorNode = require( 'HOOKES_LAW/common/view/SpringForceVectorNode' ); - ..\hookes-law\js\systems\view\ParallelSystemNode.js: 188-203 ..\hookes-law\js\systems\view\SeriesSystemNode.js: 189-204 188 │ 189 │ bottomSpringForceVectorNode.x = options.unitDisplacementLength * right; 189 │ 190 │ } ); 190 │ 191 │ 191 │ 192 │ // Open pincers when displacement is zero and no user interactions affecting displacement are talking place. 192 │ 193 │ Property.multilink( [ numberOfInteractionsInProgressProperty, equivalentSpring.displacementProperty ], 193 │ 194 │ function( numberOfInteractions, displacement ) { 194 │ 195 │ assert && assert( numberOfInteractions >= 0 ); 195 │ 196 │ var fixedDisplacement = Util.toFixedNumber( displacement, HookesLawConstants.DISPLACEMENT_DECIMAL_PLACES ); 196 │ 197 │ roboticArmNode.setPincersOpen( numberOfInteractions === 0 && fixedDisplacement === 0 ); 197 │ 198 │ } ); 198 │ 199 │ 199 │ 200 │ Node.call( this, options ); 200 │ 201 │ } 201 │ 202 │ 202 │ 203 │ hookesLaw.register( 'ParallelSystemNode', ParallelSystemNode ); 203 │ 204 │ - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-41 ..\isotopes-and-atomic-mass\js\isotopes-and-atomic-mass-config.js: 10-40 11 │ 10 │ deps: [ 'area-model-multiplication-main' ], 12 │ 11 │ 13 │ 12 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 13 │ 15 │ 14 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 15 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 16 │ paths: { 18 │ 17 │ 19 │ 18 │ // third-party libs 20 │ 19 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 20 │ 22 │ 21 │ // PhET plugins 23 │ 22 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 23 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 24 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 25 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 26 │ 28 │ 27 │ // common directories, uppercase names to identify them in require imports 29 │ 28 │ AXON: '../../axon/js', 30 │ 29 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 30 │ DOT: '../../dot/js', 32 │ 31 │ JOIST: '../../joist/js', 33 │ 32 │ KITE: '../../kite/js', 34 │ 33 │ PHET_CORE: '../../phet-core/js', 35 │ 34 │ PHET_IO: '../../phet-io/js', 36 │ 35 │ PHETCOMMON: '../../phetcommon/js', 37 │ 36 │ REPOSITORY: '..', 38 │ 37 │ SCENERY: '../../scenery/js', 39 │ 38 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 39 │ SUN: '../../sun/js', 41 │ 40 │ TANDEM: '../../tandem/js', - ..\build-an-atom\js\common\model\BuildAnAtomModel.js: 41-46 ..\isotopes-and-atomic-mass\js\make-isotopes\model\MakeIsotopesModel.js: 34-39 41 │ 34 │ var BUCKET_Y_OFFSET = -205; 42 │ 35 │ var NUCLEUS_JUMP_PERIOD = 0.1; // In seconds 43 │ 36 │ var MAX_NUCLEUS_JUMP = ShredConstants.NUCLEON_RADIUS * 0.5; 44 │ 37 │ var JUMP_ANGLES = [ Math.PI * 0.1, Math.PI * 1.6, Math.PI * 0.7, Math.PI * 1.1, Math.PI * 0.3 ]; 45 │ 38 │ var JUMP_DISTANCES = [ MAX_NUCLEUS_JUMP * 0.4, MAX_NUCLEUS_JUMP * 0.8, MAX_NUCLEUS_JUMP * 0.2, MAX_NUCLEUS_JUMP * 0.9 ]; 46 │ 39 │ - ..\build-an-atom\js\common\view\AtomView.js: 121-131 ..\isotopes-and-atomic-mass\js\make-isotopes\view\InteractiveIsotopeNode.js: 89-99 121 │ 89 │ if ( particleView.particle === nucleon ) { 122 │ 90 │ onCorrectLayer = true; 123 │ 91 │ } 124 │ 92 │ } ); 125 │ 93 │ 126 │ 94 │ if ( !onCorrectLayer ) { 127 │ 95 │ 128 │ 96 │ // Remove particle view from its current layer. 129 │ 97 │ var particleView = null; 130 │ 98 │ for ( var layerIndex = 0; layerIndex < nucleonLayers.length && particleView === null; layerIndex++ ) { 131 │ 99 │ for ( var childIndex = 0; childIndex < nucleonLayers[ layerIndex ].children.length; childIndex++ ) { - ..\isotopes-and-atomic-mass\js\mix-isotopes\model\MixIsotopesModel.js: 397-410 ..\isotopes-and-atomic-mass\js\mix-isotopes\model\MixIsotopesModel.js: 409-422 397 │ 409 │ } else { 398 │ 410 │ // Clean up any previous isotopes. 399 │ 411 │ this.removeAllIsotopesFromTestChamberAndModel(); 400 │ 412 │ 401 │ 413 │ this.prototypeIsotope.protonCountProperty.set( atom.protonCountProperty.get() ); 402 │ 414 │ this.prototypeIsotope.neutronCountProperty.set( atom.neutronCountProperty.get() ); 403 │ 415 │ this.prototypeIsotope.electronCountProperty.set( atom.electronCountProperty.get() ); 404 │ 416 │ this.updatePossibleIsotopesList(); 405 │ 417 │ 406 │ 418 │ // Set all model elements for the first time this element's user mix is shown. 407 │ 419 │ this.setUpInitialUsersMix(); 408 │ 420 │ } 409 │ 421 │ } else { 410 │ 422 │ // Clean up any previous isotopes. - ..\balloons-and-static-electricity\js\balloons-and-static-electricity\view\MinusChargeNode.js: 29-42 ..\john-travoltage\js\john-travoltage\view\ElectronNode.js: 31-44 29 │ 31 │ fill: new RadialGradient( 2, -3, 2, 2, -3, 7 ) 30 │ 32 │ .addColorStop( 0, '#4fcfff' ) 31 │ 33 │ .addColorStop( 0.5, '#2cbef5' ) 32 │ 34 │ .addColorStop( 1, '#00a9e8' ) 33 │ 35 │ } ), 34 │ 36 │ 35 │ 37 │ new Rectangle( 0, 0, 11, 2, { 36 │ 38 │ fill: 'white', 37 │ 39 │ centerX: 0, 38 │ 40 │ centerY: 0 39 │ 41 │ } ) 40 │ 42 │ ], scale: scale 41 │ 43 │ } ); 42 │ 44 │ - ..\john-travoltage\js\john-travoltage\view\ElectronNode.js: 146-156 ..\john-travoltage\js\john-travoltage\view\ElectronNode.js: 169-179 146 │ 169 │ if ( inLegCount === history.length ) { 147 │ 170 │ self.setTranslation( dr.x, dr.y ); 148 │ 171 │ } 149 │ 172 │ else { 150 │ 173 │ a.setXY( dr.x, dr.y ); 151 │ 174 │ b.setXY( position.x, position.y ); 152 │ 175 │ c = a.blend( b, inBodyCount / history.length ); 153 │ 176 │ self.setTranslation( c.x, c.y ); 154 │ 177 │ } 155 │ 178 │ } 156 │ 179 │ - ..\griddle\js\griddle-config.js: 4-32 ..\joist\js\joist-config.js: 4-32 4 │ 4 │ deps: [ 'griddle-main' ], 5 │ 5 │ 6 │ 6 │ paths: { 7 │ 7 │ 8 │ 8 │ // third party libs 9 │ 9 │ text: '../../sherpa/lib/text-2.0.12', 10 │ 10 │ 11 │ 11 │ // plugins 12 │ 12 │ image: '../../chipper/js/requirejs-plugins/image', 13 │ 13 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 14 │ 14 │ string: '../../chipper/js/requirejs-plugins/string', 15 │ 15 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 16 │ 16 │ 17 │ 17 │ // PhET libs, uppercase names to identify them in require.js imports 18 │ 18 │ AXON: '../../axon/js', 19 │ 19 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 20 │ 20 │ DOT: '../../dot/js', 21 │ 21 │ JOIST: '../../joist/js', 22 │ 22 │ KITE: '../../kite/js', 23 │ 23 │ PHETCOMMON: '../../phetcommon/js', 24 │ 24 │ REPOSITORY: '..', 25 │ 25 │ PHET_CORE: '../../phet-core/js', 26 │ 26 │ PHET_IO: '../../phet-io/js', 27 │ 27 │ SCENERY: '../../scenery/js', 28 │ 28 │ SCENERY_PHET: '../../scenery-phet/js', 29 │ 29 │ SHERPA: '../../sherpa', 30 │ 30 │ SUN: '../../sun/js', 31 │ 31 │ TANDEM: '../../tandem/js', 32 │ 32 │ - ..\kite\js\segments\Arc.js: 45-103 ..\kite\js\segments\EllipticalArc.js: 54-112 45 │ 54 │ inherit( Segment, Arc, { 46 │ 55 │ 47 │ 56 │ /** 48 │ 57 │ * Returns the position parametrically, with 0 <= t <= 1. 49 │ 58 │ * @public 50 │ 59 │ * 51 │ 60 │ * NOTE: positionAt( 0 ) will return the start of the segment, and positionAt( 1 ) will return the end of the 52 │ 61 │ * segment. 53 │ 62 │ * 54 │ 63 │ * This method is part of the Segment API. See Segment.js's constructor for more API documentation. 55 │ 64 │ * 56 │ 65 │ * @param {number} t 57 │ 66 │ * @returns {Vector2} 58 │ 67 │ */ 59 │ 68 │ positionAt: function( t ) { 60 │ 69 │ assert && assert( t >= 0, 'positionAt t should be non-negative' ); 61 │ 70 │ assert && assert( t <= 1, 'positionAt t should be no greater than 1' ); 62 │ 71 │ 63 │ 72 │ return this.positionAtAngle( this.angleAt( t ) ); 64 │ 73 │ }, 65 │ 74 │ 66 │ 75 │ /** 67 │ 76 │ * Returns the non-normalized tangent (dx/dt, dy/dt) of this segment at the parametric value of t, with 0 <= t <= 1. 68 │ 77 │ * @public 69 │ 78 │ * 70 │ 79 │ * NOTE: tangentAt( 0 ) will return the tangent at the start of the segment, and tangentAt( 1 ) will return the 71 │ 80 │ * tangent at the end of the segment. 72 │ 81 │ * 73 │ 82 │ * This method is part of the Segment API. See Segment.js's constructor for more API documentation. 74 │ 83 │ * 75 │ 84 │ * @param {number} t 76 │ 85 │ * @returns {Vector2} 77 │ 86 │ */ 78 │ 87 │ tangentAt: function( t ) { 79 │ 88 │ assert && assert( t >= 0, 'tangentAt t should be non-negative' ); 80 │ 89 │ assert && assert( t <= 1, 'tangentAt t should be no greater than 1' ); 81 │ 90 │ 82 │ 91 │ return this.tangentAtAngle( this.angleAt( t ) ); 83 │ 92 │ }, 84 │ 93 │ 85 │ 94 │ /** 86 │ 95 │ * Returns the signed curvature of the segment at the parametric value t, where 0 <= t <= 1. 87 │ 96 │ * @public 88 │ 97 │ * 89 │ 98 │ * The curvature will be positive for visual clockwise / mathematical counterclockwise curves, negative for opposite 90 │ 99 │ * curvature, and 0 for no curvature. 91 │ 100 │ * 92 │ 101 │ * NOTE: curvatureAt( 0 ) will return the curvature at the start of the segment, and curvatureAt( 1 ) will return 93 │ 102 │ * the curvature at the end of the segment. 94 │ 103 │ * 95 │ 104 │ * This method is part of the Segment API. See Segment.js's constructor for more API documentation. 96 │ 105 │ * 97 │ 106 │ * @param {number} t 98 │ 107 │ * @returns {number} 99 │ 108 │ */ 100 │ 109 │ curvatureAt: function( t ) { 101 │ 110 │ assert && assert( t >= 0, 'curvatureAt t should be non-negative' ); 102 │ 111 │ assert && assert( t <= 1, 'curvatureAt t should be no greater than 1' ); 103 │ 112 │ - ..\kite\js\segments\Arc.js: 105-133 ..\kite\js\segments\EllipticalArc.js: 118-146 105 │ 118 │ return ( this._anticlockwise ? -1 : 1 ) / this._radius; 106 │ 119 │ }, 107 │ 120 │ 108 │ 121 │ /** 109 │ 122 │ * Returns an array with up to 2 sub-segments, split at the parametric t value. Together (in order) they should make 110 │ 123 │ * up the same shape as the current segment. 111 │ 124 │ * @public 112 │ 125 │ * 113 │ 126 │ * This method is part of the Segment API. See Segment.js's constructor for more API documentation. 114 │ 127 │ * 115 │ 128 │ * @param {number} t 116 │ 129 │ * @returns {Array.} 117 │ 130 │ */ 118 │ 131 │ subdivided: function( t ) { 119 │ 132 │ assert && assert( t >= 0, 'subdivided t should be non-negative' ); 120 │ 133 │ assert && assert( t <= 1, 'subdivided t should be no greater than 1' ); 121 │ 134 │ 122 │ 135 │ // If t is 0 or 1, we only need to return 1 segment 123 │ 136 │ if ( t === 0 || t === 1 ) { 124 │ 137 │ return [ this ]; 125 │ 138 │ } 126 │ 139 │ 127 │ 140 │ // TODO: verify that we don't need to switch anticlockwise here, or subtract 2pi off any angles 128 │ 141 │ var angle0 = this.angleAt( 0 ); 129 │ 142 │ var angleT = this.angleAt( t ); 130 │ 143 │ var angle1 = this.angleAt( 1 ); 131 │ 144 │ return [ 132 │ 145 │ new kite.Arc( this._center, this._radius, angle0, angleT, this._anticlockwise ), 133 │ 146 │ new kite.Arc( this._center, this._radius, angleT, angle1, this._anticlockwise ) - ..\kite\js\segments\Arc.js: 231-270 ..\kite\js\segments\EllipticalArc.js: 270-309 231 │ 270 │ * @returns {number} 232 │ 271 │ */ 233 │ 272 │ getActualEndAngle: function() { 234 │ 273 │ if ( this._actualEndAngle === null ) { 235 │ 274 │ // compute an actual end angle so that we can smoothly go from this._startAngle to this._actualEndAngle 236 │ 275 │ if ( this._anticlockwise ) { 237 │ 276 │ // angle is 'decreasing' 238 │ 277 │ // -2pi <= end - start < 2pi 239 │ 278 │ if ( this._startAngle > this._endAngle ) { 240 │ 279 │ this._actualEndAngle = this._endAngle; 241 │ 280 │ } 242 │ 281 │ else if ( this._startAngle < this._endAngle ) { 243 │ 282 │ this._actualEndAngle = this._endAngle - 2 * Math.PI; 244 │ 283 │ } 245 │ 284 │ else { 246 │ 285 │ // equal 247 │ 286 │ this._actualEndAngle = this._startAngle; 248 │ 287 │ } 249 │ 288 │ } 250 │ 289 │ else { 251 │ 290 │ // angle is 'increasing' 252 │ 291 │ // -2pi < end - start <= 2pi 253 │ 292 │ if ( this._startAngle < this._endAngle ) { 254 │ 293 │ this._actualEndAngle = this._endAngle; 255 │ 294 │ } 256 │ 295 │ else if ( this._startAngle > this._endAngle ) { 257 │ 296 │ this._actualEndAngle = this._endAngle + Math.PI * 2; 258 │ 297 │ } 259 │ 298 │ else { 260 │ 299 │ // equal 261 │ 300 │ this._actualEndAngle = this._startAngle; 262 │ 301 │ } 263 │ 302 │ } 264 │ 303 │ } 265 │ 304 │ return this._actualEndAngle; 266 │ 305 │ }, 267 │ 306 │ get actualEndAngle() { return this.getActualEndAngle(); }, 268 │ 307 │ 269 │ 308 │ /** 270 │ 309 │ * Returns a boolean value that indicates if the arc wraps up by more than two Pi. - ..\kite\js\segments\Arc.js: 273-284 ..\kite\js\segments\EllipticalArc.js: 310-321 273 │ 310 │ * @returns {boolean} 274 │ 311 │ */ 275 │ 312 │ getIsFullPerimeter: function() { 276 │ 313 │ if ( this._isFullPerimeter === null ) { 277 │ 314 │ this._isFullPerimeter = ( !this._anticlockwise && this._endAngle - this._startAngle >= Math.PI * 2 ) || ( this._anticlockwise && this._startAngle - this._endAngle >= Math.PI * 2 ); 278 │ 315 │ } 279 │ 316 │ return this._isFullPerimeter; 280 │ 317 │ }, 281 │ 318 │ get isFullPerimeter() { return this.getIsFullPerimeter(); }, 282 │ 319 │ 283 │ 320 │ /** 284 │ 321 │ * Returns an angle difference that represents how "much" of the circle our arc covers. - ..\kite\js\segments\Arc.js: 289-305 ..\kite\js\segments\EllipticalArc.js: 324-340 289 │ 324 │ * @returns {number} 290 │ 325 │ */ 291 │ 326 │ getAngleDifference: function() { 292 │ 327 │ if ( this._angleDifference === null ) { 293 │ 328 │ // compute an angle difference that represents how "much" of the circle our arc covers 294 │ 329 │ this._angleDifference = this._anticlockwise ? this._startAngle - this._endAngle : this._endAngle - this._startAngle; 295 │ 330 │ if ( this._angleDifference < 0 ) { 296 │ 331 │ this._angleDifference += Math.PI * 2; 297 │ 332 │ } 298 │ 333 │ assert && assert( this._angleDifference >= 0 ); // now it should always be zero or positive 299 │ 334 │ } 300 │ 335 │ return this._angleDifference; 301 │ 336 │ }, 302 │ 337 │ get angleDifference() { return this.getAngleDifference(); }, 303 │ 338 │ 304 │ 339 │ /** 305 │ 340 │ * Returns the bounds of this segment. - ..\kite\js\segments\Arc.js: 510-530 ..\kite\js\segments\EllipticalArc.js: 564-584 510 │ 564 │ if ( self.containsAngle( angle ) ) { 511 │ 565 │ var t = self.tAtAngle( angle ); 512 │ 566 │ var epsilon = 0.0000000001; // TODO: general kite epsilon? 513 │ 567 │ if ( t > epsilon && t < 1 - epsilon ) { 514 │ 568 │ result.push( t ); 515 │ 569 │ } 516 │ 570 │ } 517 │ 571 │ } ); 518 │ 572 │ return result.sort(); // modifies original, which is OK 519 │ 573 │ }, 520 │ 574 │ 521 │ 575 │ /** 522 │ 576 │ * Hit-tests this segment with the ray. An array of all intersections of the ray with this segment will be returned. 523 │ 577 │ * For details, see the documentation in Segment.js 524 │ 578 │ * @public 525 │ 579 │ * 526 │ 580 │ * @param {Ray2} ray 527 │ 581 │ * @returns {Array.} - See Segment.js for details 528 │ 582 │ */ 529 │ 583 │ intersection: function( ray ) { 530 │ 584 │ var result = []; // hits in order - ..\kite\js\segments\Cubic.js: 138-146 ..\kite\js\segments\Quadratic.js: 116-124 138 │ 116 │ var p2 = isZero ? this._control2 : this._control1; 139 │ 117 │ var d10 = p1.minus( p0 ); 140 │ 118 │ var a = d10.magnitude(); 141 │ 119 │ var h = ( isZero ? -1 : 1 ) * d10.perpendicular().normalized().dot( p2.minus( p1 ) ); 142 │ 120 │ return ( h * ( this.degree - 1 ) ) / ( this.degree * a * a ); 143 │ 121 │ } 144 │ 122 │ else { 145 │ 123 │ return this.subdivided( t )[ 0 ].curvatureAt( 1 ); 146 │ 124 │ } - ..\kite\js\segments\Cubic.js: 145-169 ..\kite\js\segments\Quadratic.js: 123-147 145 │ 123 │ return this.subdivided( t )[ 0 ].curvatureAt( 1 ); 146 │ 124 │ } 147 │ 125 │ }, 148 │ 126 │ 149 │ 127 │ /** 150 │ 128 │ * Returns an array with up to 2 sub-segments, split at the parametric t value. Together (in order) they should make 151 │ 129 │ * up the same shape as the current segment. 152 │ 130 │ * @public 153 │ 131 │ * 154 │ 132 │ * This method is part of the Segment API. See Segment.js's constructor for more API documentation. 155 │ 133 │ * 156 │ 134 │ * @param {number} t 157 │ 135 │ * @returns {Array.} 158 │ 136 │ */ 159 │ 137 │ subdivided: function( t ) { 160 │ 138 │ assert && assert( t >= 0, 'subdivided t should be non-negative' ); 161 │ 139 │ assert && assert( t <= 1, 'subdivided t should be no greater than 1' ); 162 │ 140 │ 163 │ 141 │ // If t is 0 or 1, we only need to return 1 segment 164 │ 142 │ if ( t === 0 || t === 1 ) { 165 │ 143 │ return [ this ]; 166 │ 144 │ } 167 │ 145 │ 168 │ 146 │ // de Casteljau method 169 │ 147 │ // TODO: add a 'bisect' or 'between' method for vectors? - ..\kite\js\segments\Cubic.js: 623-643 ..\kite\js\segments\Quadratic.js: 426-446 623 │ 426 │ return result.sort(); 624 │ 427 │ }, 625 │ 428 │ 626 │ 429 │ 627 │ 430 │ /** 628 │ 431 │ * Hit-tests this segment with the ray. An array of all intersections of the ray with this segment will be returned. 629 │ 432 │ * For details, see the documentation in Segment.js 630 │ 433 │ * @public 631 │ 434 │ * 632 │ 435 │ * @param {Ray2} ray 633 │ 436 │ * @returns {Array.} - See Segment.js for details 634 │ 437 │ */ 635 │ 438 │ intersection: function( ray ) { 636 │ 439 │ var self = this; 637 │ 440 │ var result = []; 638 │ 441 │ 639 │ 442 │ // find the rotation that will put our ray in the direction of the x-axis so we can only solve for y=0 for intersections 640 │ 443 │ var inverseMatrix = Matrix3.rotation2( -ray.direction.angle() ).timesMatrix( Matrix3.translation( -ray.position.x, -ray.position.y ) ); 641 │ 444 │ 642 │ 445 │ var p0 = inverseMatrix.timesVector2( this._start ); 643 │ 446 │ var p1 = inverseMatrix.timesVector2( this._control1 ); - ..\kite\js\segments\Cubic.js: 653-696 ..\kite\js\segments\Quadratic.js: 453-496 653 │ 453 │ var ts = solveCubicRootsReal( a, b, c, d ); 654 │ 454 │ 655 │ 455 │ _.each( ts, function( t ) { 656 │ 456 │ if ( t >= 0 && t <= 1 ) { 657 │ 457 │ var hitPoint = self.positionAt( t ); 658 │ 458 │ var unitTangent = self.tangentAt( t ).normalized(); 659 │ 459 │ var perp = unitTangent.perpendicular(); 660 │ 460 │ var toHit = hitPoint.minus( ray.position ); 661 │ 461 │ 662 │ 462 │ // make sure it's not behind the ray 663 │ 463 │ if ( toHit.dot( ray.direction ) > 0 ) { 664 │ 464 │ result.push( { 665 │ 465 │ distance: toHit.magnitude(), 666 │ 466 │ point: hitPoint, 667 │ 467 │ normal: perp.dot( ray.direction ) > 0 ? perp.negated() : perp, 668 │ 468 │ wind: ray.direction.perpendicular().dot( unitTangent ) < 0 ? 1 : -1 669 │ 469 │ } ); 670 │ 470 │ } 671 │ 471 │ } 672 │ 472 │ } ); 673 │ 473 │ return result; 674 │ 474 │ }, 675 │ 475 │ 676 │ 476 │ /** 677 │ 477 │ * Returns the winding number for intersection with a ray 678 │ 478 │ * @param {Ray2} ray 679 │ 479 │ * @returns {number} 680 │ 480 │ */ 681 │ 481 │ windingIntersection: function( ray ) { 682 │ 482 │ var wind = 0; 683 │ 483 │ var hits = this.intersection( ray ); 684 │ 484 │ _.each( hits, function( hit ) { 685 │ 485 │ wind += hit.wind; 686 │ 486 │ } ); 687 │ 487 │ return wind; 688 │ 488 │ }, 689 │ 489 │ 690 │ 490 │ /** 691 │ 491 │ * Draws the segment to the 2D Canvas context, assuming the context's current location is already at the start point 692 │ 492 │ * @param {CanvasRenderingContext2D} context 693 │ 493 │ */ 694 │ 494 │ writeToContext: function( context ) { 695 │ 495 │ context.bezierCurveTo( this._control1.x, this._control1.y, this._control2.x, this._control2.y, this._end.x, this._end.y ); 696 │ 496 │ }, - ..\kite\js\Shape.js: 478-494 ..\kite\js\Shape.js: 535-551 478 │ 535 │ var endPoint = arc.getEnd(); 479 │ 536 │ 480 │ 537 │ // if there is already a point on the subpath, and it is different than our starting point, draw a line between them 481 │ 538 │ if ( this.hasSubpaths() && this.getLastSubpath().getLength() > 0 && !startPoint.equals( this.getLastSubpath().getLastPoint(), 0 ) ) { 482 │ 539 │ this.addSegmentAndBounds( new Line( this.getLastSubpath().getLastPoint(), startPoint ) ); 483 │ 540 │ } 484 │ 541 │ 485 │ 542 │ if ( !this.hasSubpaths() ) { 486 │ 543 │ this.addSubpath( new Subpath() ); 487 │ 544 │ } 488 │ 545 │ 489 │ 546 │ // technically the Canvas spec says to add the start point, so we do this even though it is probably completely unnecessary (there is no conditional) 490 │ 547 │ this.getLastSubpath().addPoint( startPoint ); 491 │ 548 │ this.getLastSubpath().addPoint( endPoint ); 492 │ 549 │ 493 │ 550 │ this.addSegmentAndBounds( arc ); 494 │ 551 │ this.resetControlPoints(); - ..\build-a-molecule\tests\qunit\unit-tests.js: 3-16 ..\kite\tests\qunit\unit-tests.js: 3-16 3 │ 3 │ function runBuildAMoleculeTests( pathToTestBase ) { 4 │ 4 │ function loadTestFile( src ) { 5 │ 5 │ var script = document.createElement( 'script' ); 6 │ 6 │ script.type = 'text/javascript'; 7 │ 7 │ script.async = false; 8 │ 8 │ 9 │ 9 │ // make sure things aren't cached, just in case 10 │ 10 │ script.src = pathToTestBase + '/' + src + '?random=' + Math.random().toFixed( 10 ); 11 │ 11 │ 12 │ 12 │ document.getElementsByTagName( 'head' )[ 0 ].appendChild( script ); 13 │ 13 │ } 14 │ 14 │ 15 │ 15 │ loadTestFile( 'js/model.js' ); 16 │ 16 │ }; - ..\graphing-lines\js\common\view\GraphNode.js: 97-134 ..\least-squares-regression\js\least-squares-regression\view\GraphAxesNode.js: 96-133 97 │ 96 │ inherit( Line, GridLineNode ); 98 │ 97 │ 99 │ 98 │ //---------------------------------------------------------------------------------------- 100 │ 99 │ // major tick with label, orientation is vertical or horizontal 101 │ 100 │ //---------------------------------------------------------------------------------------- 102 │ 101 │ 103 │ 102 │ // Tick is placed at (x,y) and is either vertical or horizontal. 104 │ 103 │ function MajorTickNode( x, y, value, isVertical ) { 105 │ 104 │ 106 │ 105 │ Node.call( this ); 107 │ 106 │ 108 │ 107 │ // tick line 109 │ 108 │ var tickLineNode = new Path( isVertical ? 110 │ 109 │ Shape.lineSegment( x, y - MAJOR_TICK_LENGTH, x, y + MAJOR_TICK_LENGTH ) : 111 │ 110 │ Shape.lineSegment( x - MAJOR_TICK_LENGTH, y, x + MAJOR_TICK_LENGTH, y ), { 112 │ 111 │ stroke: MAJOR_TICK_COLOR, 113 │ 112 │ lineWidth: MAJOR_TICK_LINE_WIDTH 114 │ 113 │ } ); 115 │ 114 │ this.addChild( tickLineNode ); 116 │ 115 │ 117 │ 116 │ // tick label 118 │ 117 │ var tickLabelNode = new Text( value, { font: MAJOR_TICK_FONT, fill: MAJOR_TICK_COLOR } ); 119 │ 118 │ this.addChild( tickLabelNode ); 120 │ 119 │ 121 │ 120 │ // label position 122 │ 121 │ if ( isVertical ) { 123 │ 122 │ // center label under line, compensate for minus sign 124 │ 123 │ var signXOffset = ( value < 0 ) ? -( MINUS_SIGN_WIDTH / 2 ) : 0; 125 │ 124 │ tickLabelNode.left = tickLineNode.centerX - ( tickLabelNode.width / 2 ) + signXOffset; 126 │ 125 │ tickLabelNode.top = tickLineNode.bottom + TICK_LABEL_SPACING; 127 │ 126 │ } 128 │ 127 │ else { 129 │ 128 │ // center label to left of line 130 │ 129 │ tickLabelNode.right = tickLineNode.left - TICK_LABEL_SPACING; 131 │ 130 │ tickLabelNode.centerY = tickLineNode.centerY; 132 │ 131 │ } 133 │ 132 │ } 134 │ 133 │ - ..\graphing-lines\js\common\view\GraphNode.js: 135-151 ..\least-squares-regression\js\least-squares-regression\view\GraphAxesNode.js: 133-149 135 │ 133 │ graphingLines.register( 'GraphNode.MajorTickNode', MajorTickNode ); 136 │ 134 │ 137 │ 135 │ inherit( Node, MajorTickNode ); 138 │ 136 │ 139 │ 137 │ //---------------------------------------------------------------------------------------- 140 │ 138 │ // minor tick mark, no label, orientation is vertical or horizontal 141 │ 139 │ //---------------------------------------------------------------------------------------- 142 │ 140 │ 143 │ 141 │ // Tick is placed at (x,y) and is either vertical or horizontal 144 │ 142 │ function MinorTickNode( x, y, isVertical ) { 145 │ 143 │ Path.call( this, isVertical ? 146 │ 144 │ Shape.lineSegment( x, y - MINOR_TICK_LENGTH, x, y + MINOR_TICK_LENGTH ) : 147 │ 145 │ Shape.lineSegment( x - MINOR_TICK_LENGTH, y, x + MINOR_TICK_LENGTH, y ), { 148 │ 146 │ lineWidth: MINOR_TICK_LINE_WIDTH, 149 │ 147 │ stroke: MINOR_TICK_COLOR 150 │ 148 │ } ); 151 │ 149 │ } - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-44 ..\least-squares-regression\js\least-squares-regression-config.js: 10-43 11 │ 10 │ deps: [ 'area-model-multiplication-main' ], 12 │ 11 │ 13 │ 12 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 13 │ 15 │ 14 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 15 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 16 │ paths: { 18 │ 17 │ 19 │ 18 │ // third-party libs 20 │ 19 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 20 │ 22 │ 21 │ // PhET plugins 23 │ 22 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 23 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 24 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 25 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 26 │ 28 │ 27 │ // common directories, uppercase names to identify them in require imports 29 │ 28 │ AXON: '../../axon/js', 30 │ 29 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 30 │ DOT: '../../dot/js', 32 │ 31 │ JOIST: '../../joist/js', 33 │ 32 │ KITE: '../../kite/js', 34 │ 33 │ PHET_CORE: '../../phet-core/js', 35 │ 34 │ PHET_IO: '../../phet-io/js', 36 │ 35 │ PHETCOMMON: '../../phetcommon/js', 37 │ 36 │ REPOSITORY: '..', 38 │ 37 │ SCENERY: '../../scenery/js', 39 │ 38 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 39 │ SUN: '../../sun/js', 41 │ 40 │ TANDEM: '../../tandem/js', 42 │ 41 │ 43 │ 42 │ // this sim 44 │ 43 │ AREA_MODEL_MULTIPLICATION: '.' - ..\make-a-ten\js\make-a-ten\game\view\MakeATenRewardNode.js: 37-44 ..\make-a-ten\js\make-a-ten\game\view\MakeATenRewardNode.js: 38-45 37 │ 38 │ new StarNode(), 38 │ 39 │ new FaceNode( 40, { headStroke: 'black' } ), 39 │ 40 │ new FaceNode( 40, { headStroke: 'black' } ), 40 │ 41 │ new FaceNode( 40, { headStroke: 'black' } ), 41 │ 42 │ new FaceNode( 40, { headStroke: 'black' } ), 42 │ 43 │ new FaceNode( 40, { headStroke: 'black' } ), 43 │ 44 │ new FaceNode( 40, { headStroke: 'black' } ), 44 │ 45 │ new FaceNode( 40, { headStroke: 'black' } ), - ..\expression-exchange\js\expression-exchange-config.js: 10-43 ..\make-a-ten\js\make-a-ten-config.js: 10-43 10 │ 10 │ deps: [ 'expression-exchange-main' ], 11 │ 11 │ 12 │ 12 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 13 │ 13 │ 14 │ 14 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 15 │ 15 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 16 │ 16 │ paths: { 17 │ 17 │ 18 │ 18 │ // third-party libs 19 │ 19 │ text: '../../sherpa/lib/text-2.0.12', 20 │ 20 │ 21 │ 21 │ // PhET plugins 22 │ 22 │ audio: '../../chipper/js/requirejs-plugins/audio', 23 │ 23 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 24 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 25 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 26 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 27 │ 28 │ 28 │ // common directories, uppercase names to identify them in require imports 29 │ 29 │ AXON: '../../axon/js', 30 │ 30 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 31 │ DOT: '../../dot/js', 32 │ 32 │ JOIST: '../../joist/js', 33 │ 33 │ KITE: '../../kite/js', 34 │ 34 │ PHET_CORE: '../../phet-core/js', 35 │ 35 │ PHET_IO: '../../phet-io/js', 36 │ 36 │ PHETCOMMON: '../../phetcommon/js', 37 │ 37 │ REPOSITORY: '..', 38 │ 38 │ SCENERY: '../../scenery/js', 39 │ 39 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 40 │ SUN: '../../sun/js', 41 │ 41 │ TANDEM: '../../tandem/js', 42 │ 42 │ VEGAS: '../../vegas/js', 43 │ 43 │ VIBE: '../../vibe/js', - ..\mobius\js\Cylinder.js: 90-141 ..\mobius\js\Quad.js: 74-125 90 │ 74 │ gl.bindBuffer( gl.ARRAY_BUFFER, this.normalBuffer ); 91 │ 75 │ gl.bufferData( gl.ARRAY_BUFFER, new Float32Array( normalData ), gl.STATIC_DRAW ); 92 │ 76 │ this.normalBuffer.itemSize = 3; 93 │ 77 │ this.normalBuffer.numItems = normalData.length / 3; 94 │ 78 │ 95 │ 79 │ gl.bindBuffer( gl.ARRAY_BUFFER, this.textureBuffer ); 96 │ 80 │ gl.bufferData( gl.ARRAY_BUFFER, new Float32Array( textureData ), gl.STATIC_DRAW ); 97 │ 81 │ this.textureBuffer.itemSize = 2; 98 │ 82 │ this.textureBuffer.numItems = textureData.length / 2; 99 │ 83 │ 100 │ 84 │ gl.bindBuffer( gl.ARRAY_BUFFER, this.positionBuffer ); 101 │ 85 │ gl.bufferData( gl.ARRAY_BUFFER, new Float32Array( positionData ), gl.STATIC_DRAW ); 102 │ 86 │ this.positionBuffer.itemSize = 3; 103 │ 87 │ this.positionBuffer.numItems = positionData.length / 3; 104 │ 88 │ 105 │ 89 │ gl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer ); 106 │ 90 │ gl.bufferData( gl.ELEMENT_ARRAY_BUFFER, new Uint16Array( indexData ), gl.STREAM_DRAW ); 107 │ 91 │ this.indexBuffer.itemSize = 3; 108 │ 92 │ this.indexBuffer.numItems = indexData.length; 109 │ 93 │ }, 110 │ 94 │ 111 │ 95 │ renderSelf: function( args ) { 112 │ 96 │ var gl = this.gl; 113 │ 97 │ 114 │ 98 │ gl.bindBuffer( gl.ARRAY_BUFFER, this.positionBuffer ); 115 │ 99 │ gl.vertexAttribPointer( args.positionAttribute, this.positionBuffer.itemSize, gl.FLOAT, false, 0, 0 ); 116 │ 100 │ 117 │ 101 │ if ( args.textureCoordinateAttribute !== null ) { 118 │ 102 │ gl.bindBuffer( gl.ARRAY_BUFFER, this.textureBuffer ); 119 │ 103 │ gl.vertexAttribPointer( args.textureCoordinateAttribute, this.textureBuffer.itemSize, gl.FLOAT, false, 0, 0 ); 120 │ 104 │ } 121 │ 105 │ 122 │ 106 │ if ( args.normalAttribute !== null ) { 123 │ 107 │ gl.bindBuffer( gl.ARRAY_BUFFER, this.normalBuffer ); 124 │ 108 │ gl.vertexAttribPointer( args.normalAttribute, this.normalBuffer.itemSize, gl.FLOAT, false, 0, 0 ); 125 │ 109 │ } 126 │ 110 │ 127 │ 111 │ if ( args.transformAttribute !== null ) { 128 │ 112 │ gl.uniformMatrix4fv( args.transformAttribute, false, args.transform.getMatrix().entries ); 129 │ 113 │ } 130 │ 114 │ 131 │ 115 │ if ( args.inverseTransposeAttribute !== null ) { 132 │ 116 │ gl.uniformMatrix4fv( args.inverseTransposeAttribute, false, args.transform.getInverseTransposed().entries ); 133 │ 117 │ } 134 │ 118 │ 135 │ 119 │ gl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer ); 136 │ 120 │ gl.drawElements( gl.TRIANGLES, this.indexBuffer.numItems, gl.UNSIGNED_SHORT, 0 ); 137 │ 121 │ } 138 │ 122 │ } ); 139 │ 123 │ } ); 140 │ 124 │ - ..\mobius\js\Cylinder.js: 85-138 ..\mobius\js\Sphere.js: 91-144 85 │ 91 │ indexData.push( baseA + axisIndex ); 86 │ 92 │ } 87 │ 93 │ } 88 │ 94 │ } 89 │ 95 │ 90 │ 96 │ gl.bindBuffer( gl.ARRAY_BUFFER, this.normalBuffer ); 91 │ 97 │ gl.bufferData( gl.ARRAY_BUFFER, new Float32Array( normalData ), gl.STATIC_DRAW ); 92 │ 98 │ this.normalBuffer.itemSize = 3; 93 │ 99 │ this.normalBuffer.numItems = normalData.length / 3; 94 │ 100 │ 95 │ 101 │ gl.bindBuffer( gl.ARRAY_BUFFER, this.textureBuffer ); 96 │ 102 │ gl.bufferData( gl.ARRAY_BUFFER, new Float32Array( textureData ), gl.STATIC_DRAW ); 97 │ 103 │ this.textureBuffer.itemSize = 2; 98 │ 104 │ this.textureBuffer.numItems = textureData.length / 2; 99 │ 105 │ 100 │ 106 │ gl.bindBuffer( gl.ARRAY_BUFFER, this.positionBuffer ); 101 │ 107 │ gl.bufferData( gl.ARRAY_BUFFER, new Float32Array( positionData ), gl.STATIC_DRAW ); 102 │ 108 │ this.positionBuffer.itemSize = 3; 103 │ 109 │ this.positionBuffer.numItems = positionData.length / 3; 104 │ 110 │ 105 │ 111 │ gl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer ); 106 │ 112 │ gl.bufferData( gl.ELEMENT_ARRAY_BUFFER, new Uint16Array( indexData ), gl.STREAM_DRAW ); 107 │ 113 │ this.indexBuffer.itemSize = 3; 108 │ 114 │ this.indexBuffer.numItems = indexData.length; 109 │ 115 │ }, 110 │ 116 │ 111 │ 117 │ renderSelf: function( args ) { 112 │ 118 │ var gl = this.gl; 113 │ 119 │ 114 │ 120 │ gl.bindBuffer( gl.ARRAY_BUFFER, this.positionBuffer ); 115 │ 121 │ gl.vertexAttribPointer( args.positionAttribute, this.positionBuffer.itemSize, gl.FLOAT, false, 0, 0 ); 116 │ 122 │ 117 │ 123 │ if ( args.textureCoordinateAttribute !== null ) { 118 │ 124 │ gl.bindBuffer( gl.ARRAY_BUFFER, this.textureBuffer ); 119 │ 125 │ gl.vertexAttribPointer( args.textureCoordinateAttribute, this.textureBuffer.itemSize, gl.FLOAT, false, 0, 0 ); 120 │ 126 │ } 121 │ 127 │ 122 │ 128 │ if ( args.normalAttribute !== null ) { 123 │ 129 │ gl.bindBuffer( gl.ARRAY_BUFFER, this.normalBuffer ); 124 │ 130 │ gl.vertexAttribPointer( args.normalAttribute, this.normalBuffer.itemSize, gl.FLOAT, false, 0, 0 ); 125 │ 131 │ } 126 │ 132 │ 127 │ 133 │ if ( args.transformAttribute !== null ) { 128 │ 134 │ gl.uniformMatrix4fv( args.transformAttribute, false, args.transform.getMatrix().entries ); 129 │ 135 │ } 130 │ 136 │ 131 │ 137 │ if ( args.inverseTransposeAttribute !== null ) { 132 │ 138 │ gl.uniformMatrix4fv( args.inverseTransposeAttribute, false, args.transform.getInverseTransposed().entries ); 133 │ 139 │ } 134 │ 140 │ 135 │ 141 │ gl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer ); 136 │ 142 │ gl.drawElements( gl.TRIANGLES, this.indexBuffer.numItems, gl.UNSIGNED_SHORT, 0 ); 137 │ 143 │ } 138 │ 144 │ } ); - ..\dot\js\Util.js: 231-278 ..\mobius\js\Sphere.js: 158-205 231 │ 158 │ var det = 4 * tmp * tmp - 4 * ( centerToRayDistSq - radius * radius ); 232 │ 159 │ if ( det < epsilon ) { 233 │ 160 │ // ray misses sphere entirely 234 │ 161 │ return null; 235 │ 162 │ } 236 │ 163 │ 237 │ 164 │ var base = rayDir.dot( center ) - rayDir.dot( pos ); 238 │ 165 │ var sqt = Math.sqrt( det ) / 2; 239 │ 166 │ 240 │ 167 │ // the "first" entry point distance into the sphere. if we are inside the sphere, it is behind us 241 │ 168 │ var ta = base - sqt; 242 │ 169 │ 243 │ 170 │ // the "second" entry point distance 244 │ 171 │ var tb = base + sqt; 245 │ 172 │ 246 │ 173 │ if ( tb < epsilon ) { 247 │ 174 │ // sphere is behind ray, so don't return an intersection 248 │ 175 │ return null; 249 │ 176 │ } 250 │ 177 │ 251 │ 178 │ var hitPositionB = ray.pointAtDistance( tb ); 252 │ 179 │ var normalB = hitPositionB.minus( center ).normalized(); 253 │ 180 │ 254 │ 181 │ if ( ta < epsilon ) { 255 │ 182 │ // we are inside the sphere 256 │ 183 │ // in => out 257 │ 184 │ return { 258 │ 185 │ distance: tb, 259 │ 186 │ hitPoint: hitPositionB, 260 │ 187 │ normal: normalB.negated(), 261 │ 188 │ fromOutside: false 262 │ 189 │ }; 263 │ 190 │ } 264 │ 191 │ else { 265 │ 192 │ // two possible hits 266 │ 193 │ var hitPositionA = ray.pointAtDistance( ta ); 267 │ 194 │ var normalA = hitPositionA.minus( center ).normalized(); 268 │ 195 │ 269 │ 196 │ // close hit, we have out => in 270 │ 197 │ return { 271 │ 198 │ distance: ta, 272 │ 199 │ hitPoint: hitPositionA, 273 │ 200 │ normal: normalA, 274 │ 201 │ fromOutside: true 275 │ 202 │ }; 276 │ 203 │ } 277 │ 204 │ }, 278 │ 205 │ - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-44 ..\models-of-the-hydrogen-atom\js\models-of-the-hydrogen-atom-config.js: 11-44 11 │ 11 │ deps: [ 'area-model-multiplication-main' ], 12 │ 12 │ 13 │ 13 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 14 │ 15 │ 15 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 16 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 17 │ paths: { 18 │ 18 │ 19 │ 19 │ // third-party libs 20 │ 20 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 21 │ 22 │ 22 │ // PhET plugins 23 │ 23 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 24 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 25 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 26 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 27 │ 28 │ 28 │ // common directories, uppercase names to identify them in require imports 29 │ 29 │ AXON: '../../axon/js', 30 │ 30 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 31 │ DOT: '../../dot/js', 32 │ 32 │ JOIST: '../../joist/js', 33 │ 33 │ KITE: '../../kite/js', 34 │ 34 │ PHET_CORE: '../../phet-core/js', 35 │ 35 │ PHET_IO: '../../phet-io/js', 36 │ 36 │ PHETCOMMON: '../../phetcommon/js', 37 │ 37 │ REPOSITORY: '..', 38 │ 38 │ SCENERY: '../../scenery/js', 39 │ 39 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 40 │ SUN: '../../sun/js', 41 │ 41 │ TANDEM: '../../tandem/js', 42 │ 42 │ 43 │ 43 │ // this sim 44 │ 44 │ AREA_MODEL_MULTIPLICATION: '.' - ..\beers-law-lab\js\concentration\view\SaturatedIndicator.js: 32-47 ..\molarity\js\molarity\view\SaturatedIndicator.js: 30-45 32 │ 30 │ var label = new Text( saturatedString, { font: new PhetFont( 20 ), maxWidth: 400 } ); 33 │ 31 │ 34 │ 32 │ // translucent light-gray background, so this shows up on all solution colors 35 │ 33 │ var background = new Rectangle( 0, 0, 1.2 * label.width, 1.2 * label.height, 8, 8, 36 │ 34 │ { fill: 'rgba( 240, 240, 240, 0.6 )' } ); 37 │ 35 │ 38 │ 36 │ // rendering order 39 │ 37 │ this.addChild( background ); 40 │ 38 │ this.addChild( label ); 41 │ 39 │ 42 │ 40 │ // layout 43 │ 41 │ label.centerX = background.centerX; 44 │ 42 │ label.centerY = background.centerY; 45 │ 43 │ 46 │ 44 │ // make this node visible when the solution is saturated 47 │ 45 │ solution.saturatedProperty.link( function( saturated ) { - ..\beers-law-lab\js\concentration\view\SoluteComboBox.js: 64-72 ..\molarity\js\molarity\view\SoluteComboBox.js: 60-68 64 │ 60 │ stroke: solute.colorScheme.maxColor.darkerColor() 65 │ 61 │ } ); 66 │ 62 │ var textNode = new Text( solute.name, { font: new PhetFont( 20 ) } ); 67 │ 63 │ node.addChild( colorNode ); 68 │ 64 │ node.addChild( textNode ); 69 │ 65 │ textNode.left = colorNode.right + 5; 70 │ 66 │ textNode.centerY = colorNode.centerY; 71 │ 67 │ 72 │ 68 │ return ComboBox.createItem( node, solute, {tandemName: solute.tandemName} ); - ..\beers-law-lab\js\beers-law-lab-config.js: 11-39 ..\molarity\js\molarity-config.js: 10-38 11 │ 10 │ deps: [ 'beers-law-lab-main' ], 12 │ 11 │ 13 │ 12 │ paths: { 14 │ 13 │ 15 │ 14 │ // third-party libs 16 │ 15 │ text: '../../sherpa/lib/text-2.0.12', 17 │ 16 │ 18 │ 17 │ // PhET plugins 19 │ 18 │ image: '../../chipper/js/requirejs-plugins/image', 20 │ 19 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 21 │ 20 │ string: '../../chipper/js/requirejs-plugins/string', 22 │ 21 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 23 │ 22 │ 24 │ 23 │ // PhET libs, uppercase names to identify them in require.js imports 25 │ 24 │ AXON: '../../axon/js', 26 │ 25 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 27 │ 26 │ DOT: '../../dot/js', 28 │ 27 │ JOIST: '../../joist/js', 29 │ 28 │ KITE: '../../kite/js', 30 │ 29 │ NITROGLYCERIN: '../../nitroglycerin/js', 31 │ 30 │ PHET_CORE: '../../phet-core/js', 32 │ 31 │ PHET_IO: '../../phet-io/js', 33 │ 32 │ PHETCOMMON: '../../phetcommon/js', 34 │ 33 │ REPOSITORY: '..', 35 │ 34 │ SCENERY: '../../scenery/js', 36 │ 35 │ SCENERY_PHET: '../../scenery-phet/js', 37 │ 36 │ SUN: '../../sun/js', 38 │ 37 │ TANDEM: '../../tandem/js', 39 │ 38 │ - ..\beers-law-lab\js\beers-law-lab-config.js: 11-41 ..\molecule-polarity\js\molecule-polarity-config.js: 10-40 11 │ 10 │ deps: [ 'beers-law-lab-main' ], 12 │ 11 │ 13 │ 12 │ paths: { 14 │ 13 │ 15 │ 14 │ // third-party libs 16 │ 15 │ text: '../../sherpa/lib/text-2.0.12', 17 │ 16 │ 18 │ 17 │ // PhET plugins 19 │ 18 │ image: '../../chipper/js/requirejs-plugins/image', 20 │ 19 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 21 │ 20 │ string: '../../chipper/js/requirejs-plugins/string', 22 │ 21 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 23 │ 22 │ 24 │ 23 │ // PhET libs, uppercase names to identify them in require.js imports 25 │ 24 │ AXON: '../../axon/js', 26 │ 25 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 27 │ 26 │ DOT: '../../dot/js', 28 │ 27 │ JOIST: '../../joist/js', 29 │ 28 │ KITE: '../../kite/js', 30 │ 29 │ NITROGLYCERIN: '../../nitroglycerin/js', 31 │ 30 │ PHET_CORE: '../../phet-core/js', 32 │ 31 │ PHET_IO: '../../phet-io/js', 33 │ 32 │ PHETCOMMON: '../../phetcommon/js', 34 │ 33 │ REPOSITORY: '..', 35 │ 34 │ SCENERY: '../../scenery/js', 36 │ 35 │ SCENERY_PHET: '../../scenery-phet/js', 37 │ 36 │ SUN: '../../sun/js', 38 │ 37 │ TANDEM: '../../tandem/js', 39 │ 38 │ 40 │ 39 │ // this sim 41 │ 40 │ BEERS_LAW_LAB: '.' - ..\litmus\js\RealMoleculesView.js: 14-48 ..\molecule-polarity\js\realmolecules\view\RealMoleculesView.js: 15-49 14 │ 15 │ var JSmolViewerNode = require( 'LITMUS/JSmolViewerNode' ); 15 │ 16 │ var MPColors = require( 'MOLECULE_POLARITY/common/MPColors' ); 16 │ 17 │ var MPConstants = require( 'MOLECULE_POLARITY/common/MPConstants' ); 17 │ 18 │ var Node = require( 'SCENERY/nodes/Node' ); 18 │ 19 │ var RealMoleculesComboBox = require( 'MOLECULE_POLARITY/realmolecules/view/RealMoleculesComboBox' ); 19 │ 20 │ var RealMoleculesControlPanel = require( 'MOLECULE_POLARITY/realmolecules/view/RealMoleculesControlPanel' ); 20 │ 21 │ var RealMoleculesViewProperties = require( 'MOLECULE_POLARITY/realmolecules/view/RealMoleculesViewProperties' ); 21 │ 22 │ var ResetAllButton = require( 'SCENERY_PHET/buttons/ResetAllButton' ); 22 │ 23 │ var ScreenView = require( 'JOIST/ScreenView' ); 23 │ 24 │ var SurfaceColorKey = require( 'MOLECULE_POLARITY/common/view/SurfaceColorKey' ); 24 │ 25 │ var SurfaceType = require( 'MOLECULE_POLARITY/common/view/SurfaceType' ); 25 │ 26 │ 26 │ 27 │ /** 27 │ 28 │ * @param {TwoAtomsModel} model 28 │ 29 │ * @constructor 29 │ 30 │ */ 30 │ 31 │ function RealMoleculesView( model ) { 31 │ 32 │ 32 │ 33 │ ScreenView.call( this, MPConstants.SCREEN_VIEW_OPTIONS ); 33 │ 34 │ 34 │ 35 │ // view-specific properties 35 │ 36 │ var viewProperties = new RealMoleculesViewProperties(); 36 │ 37 │ 37 │ 38 │ // @private 38 │ 39 │ this.jsmolViewerNode = new JSmolViewerNode( model.moleculeProperty, viewProperties, { 39 │ 40 │ viewerFill: MPColors.SCREEN_BACKGROUND, 40 │ 41 │ viewerSize: new Dimension2( 450, 450 ) 41 │ 42 │ } ); 42 │ 43 │ 43 │ 44 │ var electronegativityTableNode = new ElectronegativityTableNode( this.jsmolViewerNode ); 44 │ 45 │ var comboBoxListParent = new Node(); 45 │ 46 │ var moleculesComboBox = new RealMoleculesComboBox( model.molecules, model.moleculeProperty, comboBoxListParent ); 46 │ 47 │ var electrostaticPotentialRWBColorKey = SurfaceColorKey.createElectrostaticPotentialRWBColorKey(); 47 │ 48 │ var electrostaticPotentialROYGBColorKey = SurfaceColorKey.createElectrostaticPotentialROYGBColorKey(); 48 │ 49 │ var electronDensityColorKey = SurfaceColorKey.createElectronDensityColorKey(); - ..\litmus\js\RealMoleculesView.js: 47-67 ..\molecule-polarity\js\realmolecules\view\RealMoleculesView.js: 57-77 47 │ 57 │ var electrostaticPotentialROYGBColorKey = SurfaceColorKey.createElectrostaticPotentialROYGBColorKey(); 48 │ 58 │ var electronDensityColorKey = SurfaceColorKey.createElectronDensityColorKey(); 49 │ 59 │ var controlPanel = new RealMoleculesControlPanel( viewProperties ); 50 │ 60 │ var resetAllButton = new ResetAllButton( { 51 │ 61 │ listener: function() { 52 │ 62 │ model.reset(); 53 │ 63 │ viewProperties.reset(); 54 │ 64 │ }, 55 │ 65 │ scale: 1.32 56 │ 66 │ } ); 57 │ 67 │ 58 │ 68 │ // Parent for all nodes added to this screen 59 │ 69 │ var rootNode = new Node( { 60 │ 70 │ children: [ 61 │ 71 │ // nodes are rendered in this order 62 │ 72 │ this.jsmolViewerNode, 63 │ 73 │ electronegativityTableNode, 64 │ 74 │ moleculesComboBox, 65 │ 75 │ controlPanel, 66 │ 76 │ electrostaticPotentialRWBColorKey, 67 │ 77 │ electrostaticPotentialROYGBColorKey, - ..\litmus\js\RealMoleculesView.js: 88-109 ..\molecule-polarity\js\realmolecules\view\RealMoleculesView.js: 98-119 88 │ 98 │ this.jsmolViewerNode.top = electrostaticPotentialRWBColorKey.bottom + 15; 89 │ 99 │ 90 │ 100 │ // centered below viewer 91 │ 101 │ moleculesComboBox.centerX = this.jsmolViewerNode.centerX; 92 │ 102 │ moleculesComboBox.top = this.jsmolViewerNode.bottom + 15; 93 │ 103 │ 94 │ 104 │ // right of viewer 95 │ 105 │ controlPanel.left = this.jsmolViewerNode.right + 100; 96 │ 106 │ controlPanel.centerY = this.layoutBounds.centerY; 97 │ 107 │ 98 │ 108 │ // bottom-right corner of the screen 99 │ 109 │ resetAllButton.right = this.layoutBounds.right - 40; 100 │ 110 │ resetAllButton.bottom = this.layoutBounds.bottom - 20; 101 │ 111 │ 102 │ 112 │ // synchronization with view properties ------------------------------ 103 │ 113 │ 104 │ 114 │ viewProperties.atomElectronegativitiesVisibleProperty.link( function( visible ) { 105 │ 115 │ electronegativityTableNode.visible = visible; 106 │ 116 │ } ); 107 │ 117 │ 108 │ 118 │ viewProperties.surfaceTypeProperty.link( function( surfaceType ) { 109 │ 119 │ electrostaticPotentialRWBColorKey.visible = ( surfaceType === SurfaceType.ELECTROSTATIC_POTENTIAL_RWB ); - ..\molecule-polarity\js\threeatoms\model\TriatomicMolecule.js: 4-20 ..\molecule-polarity\js\twoatoms\model\DiatomicMolecule.js: 4-20 4 │ 4 │ * Variables are named based on the English labels applied to the atoms. 5 │ 5 │ * 6 │ 6 │ * @author Chris Malley (PixelZoom, Inc.) 7 │ 7 │ */ 8 │ 8 │ define( function( require ) { 9 │ 9 │ 'use strict'; 10 │ 10 │ 11 │ 11 │ // modules 12 │ 12 │ var Atom = require( 'MOLECULE_POLARITY/common/model/Atom' ); 13 │ 13 │ var Bond = require( 'MOLECULE_POLARITY/common/model/Bond' ); 14 │ 14 │ var inherit = require( 'PHET_CORE/inherit' ); 15 │ 15 │ var Molecule = require( 'MOLECULE_POLARITY/common/model/Molecule' ); 16 │ 16 │ var moleculePolarity = require( 'MOLECULE_POLARITY/moleculePolarity' ); 17 │ 17 │ var MPColors = require( 'MOLECULE_POLARITY/common/MPColors' ); 18 │ 18 │ var MPConstants = require( 'MOLECULE_POLARITY/common/MPConstants' ); 19 │ 19 │ var Property = require( 'AXON/Property' ); 20 │ 20 │ var Vector2 = require( 'DOT/Vector2' ); - ..\molecule-polarity\js\twoatoms\view\ElectronDensityNode.js: 5-35 ..\molecule-polarity\js\twoatoms\view\ElectrostaticPotentialNode.js: 5-35 5 │ 5 │ * This node's look is similar to the corresponding Jmol isosurface. 6 │ 6 │ * Shapes are created in world coordinates, so this node's offset should be (0,0). 7 │ 7 │ * 8 │ 8 │ * @author Chris Malley (PixelZoom, Inc.) 9 │ 9 │ */ 10 │ 10 │ define( function( require ) { 11 │ 11 │ 'use strict'; 12 │ 12 │ 13 │ 13 │ // modules 14 │ 14 │ var inherit = require( 'PHET_CORE/inherit' ); 15 │ 15 │ var LinearGradient = require( 'SCENERY/util/LinearGradient' ); 16 │ 16 │ var MoleculeAngleHandler = require( 'MOLECULE_POLARITY/common/view/MoleculeAngleHandler' ); 17 │ 17 │ var moleculePolarity = require( 'MOLECULE_POLARITY/moleculePolarity' ); 18 │ 18 │ var MPColors = require( 'MOLECULE_POLARITY/common/MPColors' ); 19 │ 19 │ var MPConstants = require( 'MOLECULE_POLARITY/common/MPConstants' ); 20 │ 20 │ var Node = require( 'SCENERY/nodes/Node' ); 21 │ 21 │ var Path = require( 'SCENERY/nodes/Path' ); 22 │ 22 │ var Shape = require( 'KITE/Shape' ); 23 │ 23 │ var Util = require( 'DOT/Util' ); 24 │ 24 │ var Vector2 = require( 'DOT/Vector2' ); 25 │ 25 │ 26 │ 26 │ // constants 27 │ 27 │ var DIAMETER_SCALE = 2.25; // multiply atom diameters by this scale when computing surface size 28 │ 28 │ var GRADIENT_WIDTH_MULTIPLIER = 5; // smaller values result in a more noticeable change as the EN sliders are dragged 29 │ 29 │ 30 │ 30 │ /** 31 │ 31 │ * @param {Molecule} molecule 32 │ 32 │ * @constructor 33 │ 33 │ */ 34 │ 34 │ function ElectronDensityNode( molecule ) { 35 │ 35 │ - ..\molecule-polarity\js\twoatoms\view\ElectronDensityNode.js: 47-76 ..\molecule-polarity\js\twoatoms\view\ElectrostaticPotentialNode.js: 47-76 47 │ 47 │ // each atom is surrounded with a 'cloud' (circle) 48 │ 48 │ var radius = this.molecule.atomA.diameter * DIAMETER_SCALE / 2; 49 │ 49 │ this.path = new Path( new Shape() 50 │ 50 │ .arc( molecule.location.x - this.molecule.atomB.locationProperty.get().x, molecule.location.y - this.molecule.atomB.locationProperty.get().y, radius, Math.PI / 4, 7 * Math.PI / 4 ) 51 │ 51 │ .arc( molecule.location.x - this.molecule.atomA.locationProperty.get().x, molecule.location.y - this.molecule.atomA.locationProperty.get().y, radius, 5 * Math.PI / 4, 3 * Math.PI / 4 ) 52 │ 52 │ ); 53 │ 53 │ this.addChild( this.path ); 54 │ 54 │ 55 │ 55 │ // update surface when atoms move or electronegativity changes 56 │ 56 │ var update = function() { 57 │ 57 │ if ( self.visible ) { 58 │ 58 │ self.updateFill(); 59 │ 59 │ } 60 │ 60 │ }; 61 │ 61 │ molecule.atoms.forEach( function( atom ) { 62 │ 62 │ atom.electronegativityProperty.link( update ); 63 │ 63 │ } ); 64 │ 64 │ 65 │ 65 │ molecule.angleProperty.link( function( angle ) { 66 │ 66 │ if ( self.visible ) { 67 │ 67 │ self.matrix = molecule.createTransformMatrix(); 68 │ 68 │ } 69 │ 69 │ } ); 70 │ 70 │ 71 │ 71 │ this.cursor = 'pointer'; 72 │ 72 │ this.addInputListener( new MoleculeAngleHandler( molecule, this ) ); 73 │ 73 │ } 74 │ 74 │ 75 │ 75 │ moleculePolarity.register( 'ElectronDensityNode', ElectronDensityNode ); 76 │ 76 │ - ..\molecule-polarity\js\twoatoms\view\ElectronDensityNode.js: 77-96 ..\molecule-polarity\js\twoatoms\view\ElectrostaticPotentialNode.js: 77-96 77 │ 77 │ return inherit( Node, ElectronDensityNode, { 78 │ 78 │ 79 │ 79 │ // @override 80 │ 80 │ setVisible: function( visible ) { 81 │ 81 │ Node.prototype.setVisible.call( this, visible ); 82 │ 82 │ if ( visible ) { 83 │ 83 │ this.matrix = this.molecule.createTransformMatrix(); 84 │ 84 │ this.updateFill(); 85 │ 85 │ } 86 │ 86 │ }, 87 │ 87 │ 88 │ 88 │ /* 89 │ 89 │ * Updates the surface fill. Width of the gradient expands as the difference in EN approaches zero. 90 │ 90 │ * @private 91 │ 91 │ */ 92 │ 92 │ updateFill: function() { 93 │ 93 │ // scale varies from 1 to 0, approaches zero as EN difference approaches zero. 94 │ 94 │ var deltaEN = this.molecule.getDeltaEN(); 95 │ 95 │ if ( deltaEN === 0 ) { 96 │ 96 │ // no difference, use neutral color that's halfway between "more" and "less" colors - ..\molecule-polarity\js\twoatoms\view\ElectronDensityNode.js: 97-107 ..\molecule-polarity\js\twoatoms\view\ElectrostaticPotentialNode.js: 96-106 97 │ 96 │ this.path.fill = MPColors.NEUTRAL_GRAY; 98 │ 97 │ } 99 │ 98 │ else { 100 │ 99 │ var scale = Math.abs( deltaEN / this.electronegativityRange.getLength() ); 101 │ 100 │ 102 │ 101 │ // width of the surface 103 │ 102 │ var surfaceWidth = this.molecule.bond.getLength() + ( DIAMETER_SCALE * this.molecule.atomA.diameter / 2 ) + ( DIAMETER_SCALE * this.molecule.atomB.diameter / 2 ); 104 │ 103 │ 105 │ 104 │ // compute the gradient width 106 │ 105 │ var gradientWidth = Util.linear( 1, 0, surfaceWidth, surfaceWidth * GRADIENT_WIDTH_MULTIPLIER, scale ); 107 │ 106 │ - ..\molecule-polarity\js\threeatoms\view\ThreeAtomsControlPanel.js: 79-96 ..\molecule-polarity\js\twoatoms\view\TwoAtomsControlPanel.js: 94-111 79 │ 94 │ children.splice( children.indexOf( eFieldTitleNode ), 0, new HSeparator( separatorWidth ) ); 80 │ 95 │ 81 │ 96 │ // vertical panel 82 │ 97 │ Panel.call( this, new LayoutBox( { 83 │ 98 │ children: children, 84 │ 99 │ orientation: 'vertical', 85 │ 100 │ align: 'left', 86 │ 101 │ spacing: 15 87 │ 102 │ } ), { 88 │ 103 │ // panel options 89 │ 104 │ fill: 'rgb(238,238,238)', 90 │ 105 │ xMargin: 20, 91 │ 106 │ yMargin: 15 92 │ 107 │ } ); 93 │ 108 │ } 94 │ 109 │ 95 │ 110 │ moleculePolarity.register( 'ThreeAtomsControlPanel', ThreeAtomsControlPanel ); 96 │ 111 │ - ..\molecule-shapes\js\common\view\3d\BondAngleFallbackView.js: 87-101 ..\molecule-shapes\js\common\view\3d\BondAngleWebGLView.js: 180-194 87 │ 180 │ MoleculeShapesGlobals.linkColor( this.arcMaterial, MoleculeShapesColorProfile.bondAngleArcProperty ); 88 │ 181 │ 89 │ 182 │ this.sectorView = new THREE.Mesh( this.sectorGeometry, this.sectorMaterial ); // @private {THREE.Mesh} 90 │ 183 │ this.arcView = new THREE.Line( this.arcGeometry, this.arcMaterial ); // @private {THREE.Mesh} 91 │ 184 │ 92 │ 185 │ // render the bond angle views on top of everything (but still depth-testing), with arcs on top 93 │ 186 │ this.sectorView.renderDepth = 10; 94 │ 187 │ this.arcView.renderDepth = 11; 95 │ 188 │ 96 │ 189 │ this.add( this.sectorView ); 97 │ 190 │ this.add( this.arcView ); 98 │ 191 │ } 99 │ 192 │ 100 │ 193 │ moleculeShapes.register( 'BondAngleFallbackView', BondAngleFallbackView ); 101 │ 194 │ - ..\molecule-shapes\js\common\model\VSEPRConfiguration.js: 22-35 ..\molecule-shapes\js\common\view\GeometryNamePanel.js: 34-47 22 │ 34 │ var shapeEmptyString = require( 'string!MOLECULE_SHAPES/shape.empty' ); 23 │ 35 │ var shapeDiatomicString = require( 'string!MOLECULE_SHAPES/shape.diatomic' ); 24 │ 36 │ var shapeLinearString = require( 'string!MOLECULE_SHAPES/shape.linear' ); 25 │ 37 │ var shapeBentString = require( 'string!MOLECULE_SHAPES/shape.bent' ); 26 │ 38 │ var shapeTrigonalPlanarString = require( 'string!MOLECULE_SHAPES/shape.trigonalPlanar' ); 27 │ 39 │ var shapeTrigonalPyramidalString = require( 'string!MOLECULE_SHAPES/shape.trigonalPyramidal' ); 28 │ 40 │ var shapeTShapedString = require( 'string!MOLECULE_SHAPES/shape.tShaped' ); 29 │ 41 │ var shapeTetrahedralString = require( 'string!MOLECULE_SHAPES/shape.tetrahedral' ); 30 │ 42 │ var shapeSeesawString = require( 'string!MOLECULE_SHAPES/shape.seesaw' ); 31 │ 43 │ var shapeSquarePlanarString = require( 'string!MOLECULE_SHAPES/shape.squarePlanar' ); 32 │ 44 │ var shapeTrigonalBipyramidalString = require( 'string!MOLECULE_SHAPES/shape.trigonalBipyramidal' ); 33 │ 45 │ var shapeSquarePyramidalString = require( 'string!MOLECULE_SHAPES/shape.squarePyramidal' ); 34 │ 46 │ var shapeOctahedralString = require( 'string!MOLECULE_SHAPES/shape.octahedral' ); 35 │ 47 │ - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-42 ..\molecule-shapes\js\molecule-shapes-config.js: 11-42 11 │ 11 │ deps: [ 'area-model-multiplication-main' ], 12 │ 12 │ 13 │ 13 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 14 │ 15 │ 15 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 16 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 17 │ paths: { 18 │ 18 │ 19 │ 19 │ // third-party libs 20 │ 20 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 21 │ 22 │ 22 │ // PhET plugins 23 │ 23 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 24 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 25 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 26 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 27 │ 28 │ 28 │ // common directories, uppercase names to identify them in require imports 29 │ 29 │ AXON: '../../axon/js', 30 │ 30 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 31 │ DOT: '../../dot/js', 32 │ 32 │ JOIST: '../../joist/js', 33 │ 33 │ KITE: '../../kite/js', 34 │ 34 │ PHET_CORE: '../../phet-core/js', 35 │ 35 │ PHET_IO: '../../phet-io/js', 36 │ 36 │ PHETCOMMON: '../../phetcommon/js', 37 │ 37 │ REPOSITORY: '..', 38 │ 38 │ SCENERY: '../../scenery/js', 39 │ 39 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 40 │ SUN: '../../sun/js', 41 │ 41 │ TANDEM: '../../tandem/js', 42 │ 42 │ - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-53 ..\molecule-shapes\js\molecule-shapes-dev-config.js: 11-53 11 │ 11 │ deps: [ 'area-model-multiplication-main' ], 12 │ 12 │ 13 │ 13 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 14 │ 15 │ 15 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 16 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 17 │ paths: { 18 │ 18 │ 19 │ 19 │ // third-party libs 20 │ 20 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 21 │ 22 │ 22 │ // PhET plugins 23 │ 23 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 24 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 25 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 26 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 27 │ 28 │ 28 │ // common directories, uppercase names to identify them in require imports 29 │ 29 │ AXON: '../../axon/js', 30 │ 30 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 31 │ DOT: '../../dot/js', 32 │ 32 │ JOIST: '../../joist/js', 33 │ 33 │ KITE: '../../kite/js', 34 │ 34 │ PHET_CORE: '../../phet-core/js', 35 │ 35 │ PHET_IO: '../../phet-io/js', 36 │ 36 │ PHETCOMMON: '../../phetcommon/js', 37 │ 37 │ REPOSITORY: '..', 38 │ 38 │ SCENERY: '../../scenery/js', 39 │ 39 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 40 │ SUN: '../../sun/js', 41 │ 41 │ TANDEM: '../../tandem/js', 42 │ 42 │ 43 │ 43 │ // this sim 44 │ 44 │ AREA_MODEL_MULTIPLICATION: '.' 45 │ 45 │ }, 46 │ 46 │ 47 │ 47 │ // optional cache buster to make browser refresh load all included scripts, can be disabled with ?cacheBuster=false 48 │ 48 │ urlArgs: phet.chipper.getCacheBusterArgs() 49 │ 49 │ } ); - ..\build-a-molecule\tests\qunit\unit-tests.js: 3-16 ..\molecule-shapes\tests\qunit\unit-tests.js: 3-16 3 │ 3 │ function runBuildAMoleculeTests( pathToTestBase ) { 4 │ 4 │ function loadTestFile( src ) { 5 │ 5 │ var script = document.createElement( 'script' ); 6 │ 6 │ script.type = 'text/javascript'; 7 │ 7 │ script.async = false; 8 │ 8 │ 9 │ 9 │ // make sure things aren't cached, just in case 10 │ 10 │ script.src = pathToTestBase + '/' + src + '?random=' + Math.random().toFixed( 10 ); 11 │ 11 │ 12 │ 12 │ document.getElementsByTagName( 'head' )[ 0 ].appendChild( script ); 13 │ 13 │ } 14 │ 14 │ 15 │ 15 │ loadTestFile( 'js/model.js' ); 16 │ 16 │ }; - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-45 ..\molecule-shapes-basics\js\molecule-shapes-basics-config.js: 11-45 11 │ 11 │ deps: [ 'area-model-multiplication-main' ], 12 │ 12 │ 13 │ 13 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 14 │ 15 │ 15 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 16 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 17 │ paths: { 18 │ 18 │ 19 │ 19 │ // third-party libs 20 │ 20 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 21 │ 22 │ 22 │ // PhET plugins 23 │ 23 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 24 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 25 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 26 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 27 │ 28 │ 28 │ // common directories, uppercase names to identify them in require imports 29 │ 29 │ AXON: '../../axon/js', 30 │ 30 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 31 │ DOT: '../../dot/js', 32 │ 32 │ JOIST: '../../joist/js', 33 │ 33 │ KITE: '../../kite/js', 34 │ 34 │ PHET_CORE: '../../phet-core/js', 35 │ 35 │ PHET_IO: '../../phet-io/js', 36 │ 36 │ PHETCOMMON: '../../phetcommon/js', 37 │ 37 │ REPOSITORY: '..', 38 │ 38 │ SCENERY: '../../scenery/js', 39 │ 39 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 40 │ SUN: '../../sun/js', 41 │ 41 │ TANDEM: '../../tandem/js', 42 │ 42 │ 43 │ 43 │ // this sim 44 │ 44 │ AREA_MODEL_MULTIPLICATION: '.' 45 │ 45 │ }, - ..\molecule-shapes\js\molecule-shapes-main.js: 2-23 ..\molecule-shapes-basics\js\molecule-shapes-basics-main.js: 2-23 2 │ 2 │ /** 3 │ 3 │ * Main entry point for the sim. 4 │ 4 │ * 5 │ 5 │ * @author Jonathan Olson 6 │ 6 │ */ 7 │ 7 │ define( function( require ) { 8 │ 8 │ 'use strict'; 9 │ 9 │ 10 │ 10 │ // modules 11 │ 11 │ var ModelMoleculesScreen = require( 'MOLECULE_SHAPES/model/ModelMoleculesScreen' ); 12 │ 12 │ var RealMoleculesScreen = require( 'MOLECULE_SHAPES/real/RealMoleculesScreen' ); 13 │ 13 │ var MoleculeShapesColorProfile = require( 'MOLECULE_SHAPES/common/view/MoleculeShapesColorProfile' ); 14 │ 14 │ var MoleculeShapesGlobals = require( 'MOLECULE_SHAPES/common/MoleculeShapesGlobals' ); 15 │ 15 │ var GlobalOptionsNode = require( 'MOLECULE_SHAPES/common/view/GlobalOptionsNode' ); 16 │ 16 │ var CanvasWarningNode = require( 'SCENERY_PHET/CanvasWarningNode' ); 17 │ 17 │ var IE11StencilWarningNode = require( 'SCENERY_PHET/IE11StencilWarningNode' ); 18 │ 18 │ var Sim = require( 'JOIST/Sim' ); 19 │ 19 │ var SimLauncher = require( 'JOIST/SimLauncher' ); 20 │ 20 │ 21 │ 21 │ // strings 22 │ 22 │ var moleculeShapesTitleString = require( 'string!MOLECULE_SHAPES/molecule-shapes.title' ); 23 │ 23 │ - ..\molecule-shapes\js\molecule-shapes-main.js: 24-45 ..\molecule-shapes-basics\js\molecule-shapes-basics-main.js: 24-45 24 │ 24 │ var isBasicsVersion = false; 25 │ 25 │ 26 │ 26 │ var simOptions = { 27 │ 27 │ credits: { 28 │ 28 │ leadDesign: 'Emily B. Moore', 29 │ 29 │ softwareDevelopment: 'Jonathan Olson', 30 │ 30 │ team: 'Julia Chamberlain, Kelly Lancaster, Ariel Paul, Kathy Perkins', 31 │ 31 │ qualityAssurance: 'Oliver Orejola, Bryan Yoelin' 32 │ 32 │ }, 33 │ 33 │ optionsNode: new GlobalOptionsNode( isBasicsVersion ), 34 │ 34 │ homeScreenWarningNode: MoleculeShapesGlobals.useWebGL ? 35 │ 35 │ null : 36 │ 36 │ ( MoleculeShapesGlobals.hasBasicWebGLSupport ? 37 │ 37 │ new IE11StencilWarningNode() : // if we have basic support, we failed due to IE-specific reasons 38 │ 38 │ new CanvasWarningNode() ) 39 │ 39 │ }; 40 │ 40 │ 41 │ 41 │ // NOTE: ?webgl=false will trigger Canvas rendering with a reduced poly-count 42 │ 42 │ 43 │ 43 │ MoleculeShapesGlobals.projectorColorsProperty.link( function( useProjectorColors ) { 44 │ 44 │ MoleculeShapesColorProfile.profileNameProperty.set( useProjectorColors ? 'projector' : 'default' ); 45 │ 45 │ } ); - ..\molecules-and-light\js\photon-absorption\model\molecules\CO.js: 4-22 ..\molecules-and-light\js\photon-absorption\model\molecules\H2O.js: 4-22 4 │ 4 │ * 5 │ 5 │ * @author John Blanco 6 │ 6 │ * @author Jesse Greenberg 7 │ 7 │ */ 8 │ 8 │ 9 │ 9 │ define( function( require ) { 10 │ 10 │ 'use strict'; 11 │ 11 │ 12 │ 12 │ // modules 13 │ 13 │ var inherit = require( 'PHET_CORE/inherit' ); 14 │ 14 │ var Vector2 = require( 'DOT/Vector2' ); 15 │ 15 │ var Molecule = require( 'MOLECULES_AND_LIGHT/photon-absorption/model/Molecule' ); 16 │ 16 │ var RotationStrategy = require( 'MOLECULES_AND_LIGHT/photon-absorption/model/RotationStrategy' ); 17 │ 17 │ var VibrationStrategy = require( 'MOLECULES_AND_LIGHT/photon-absorption/model/VibrationStrategy' ); 18 │ 18 │ var WavelengthConstants = require( 'MOLECULES_AND_LIGHT/photon-absorption/model/WavelengthConstants' ); 19 │ 19 │ var AtomicBond = require( 'MOLECULES_AND_LIGHT/photon-absorption/model/atoms/AtomicBond' ); 20 │ 20 │ var Atom = require( 'MOLECULES_AND_LIGHT/photon-absorption/model/atoms/Atom' ); 21 │ 21 │ var moleculesAndLight = require( 'MOLECULES_AND_LIGHT/moleculesAndLight' ); 22 │ 22 │ - ..\molecules-and-light\js\photon-absorption\model\molecules\NO2.js: 166-178 ..\molecules-and-light\js\photon-absorption\model\molecules\O3.js: 160-172 166 │ 160 │ nitrogenMonoxideMolecule.velocity.set( new Vector2( BREAK_APART_VELOCITY * 0.33 * Math.cos( breakApartAngle ), BREAK_APART_VELOCITY * 0.33 * Math.sin( breakApartAngle ) ) ); 167 │ 161 │ singleOxygenMolecule.velocity.set( new Vector2( -BREAK_APART_VELOCITY * 0.67 * Math.cos( breakApartAngle ), -BREAK_APART_VELOCITY * 0.67 * Math.sin( breakApartAngle ) ) ); 168 │ 162 │ } 169 │ 163 │ } ); 170 │ 164 │ } ); 171 │ 165 │ 172 │ 166 │ - ..\molecules-and-light\js\photon-absorption\view\AtomicBondNode.js: 144-152 ..\molecules-and-light\js\photon-absorption\view\AtomicBondNode.js: 162-170 144 │ 162 │ transformedRadius = this.modelViewTransform.modelToViewDeltaX( Math.min( this.atomicBond.atom1.radius, 145 │ 163 │ this.atomicBond.atom2.radius ) ); 146 │ 164 │ // Get the center points of the two atoms. 147 │ 165 │ p1 = this.modelViewTransform.modelToViewPosition( this.atomicBond.atom1.position ); 148 │ 166 │ p2 = this.modelViewTransform.modelToViewPosition( this.atomicBond.atom2.position ); 149 │ 167 │ angle = Math.atan2( p1.x - p2.x, p1.y - p2.y ); 150 │ 168 │ // Create a vector that will act as the offset from the center point to the origin of the bond line. 151 │ 169 │ offsetVector = Vector2.createPolar( transformedRadius / 3, angle ); 152 │ 170 │ - ..\neuron\js\neuron\model\ModifiedHodgkinHuxleyModel.js: 92-97 ..\neuron\js\neuron\model\ModifiedHodgkinHuxleyModel.js: 126-131 92 │ 126 │ this.ah = 0.07 * Math.exp( this.v / 20 ); 93 │ 127 │ this.bm = 4 * Math.exp( this.v / 18 ); 94 │ 128 │ this.am = 0.1 * (this.v + 25) / (Math.exp( (this.v + 25) / 10 ) - 1); 95 │ 129 │ this.bn = 0.125 * Math.exp( this.v / 80 ); 96 │ 130 │ this.an = 0.01 * (this.v + 10) / (Math.exp( (this.v + 10) / 10 ) - 1); 97 │ 131 │ - ..\neuron\js\neuron\model\DualGateChannelTraversalMotionStrategy.js: 247-254 ..\neuron\js\neuron\model\TraverseChannelAndFadeMotionStrategy.js: 189-196 247 │ 189 │ if ( this.currentDestinationIndex < this.traversalPoints.length ) { 248 │ 190 │ var dest = this.traversalPoints[ this.currentDestinationIndex ]; 249 │ 191 │ this.velocityVector.setXY( dest.x - currentLocationX, dest.y - currentLocationY ); 250 │ 192 │ var scaleFactor = this.maxVelocity / this.velocityVector.magnitude(); 251 │ 193 │ this.velocityVector.multiplyScalar( scaleFactor ); 252 │ 194 │ } 253 │ 195 │ else { 254 │ 196 │ // All points have been traversed. The behavior at this point depends on whether the channel has an - ..\neuron\js\neuron\view\ParticlesCanvasNode.js: 68-77 ..\neuron\js\neuron\view\ParticlesCanvasNode.js: 86-95 68 │ 86 │ var transformedRadius = this.modelViewTransform.modelToViewDeltaX( particles[ 0 ].getRadius() ); 69 │ 87 │ context.lineWidth = 0.3; 70 │ 88 │ context.strokeStyle = 'black'; 71 │ 89 │ particles.forEach( function( particle ) { 72 │ 90 │ context.globalAlpha = particle.getOpacity(); 73 │ 91 │ context.beginPath(); 74 │ 92 │ var x = self.modelViewTransform.modelToViewX( particle.getPositionX() ); 75 │ 93 │ var y = self.modelViewTransform.modelToViewY( particle.getPositionY() ); 76 │ 94 │ context.arc( x, y, transformedRadius, 0, 2 * Math.PI, true ); 77 │ 95 │ context.closePath(); - ..\gene-expression-essentials\js\gene-expression-essentials-config.js: 20-45 ..\neuron\js\neuron-config.js: 17-42 20 │ 17 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 18 │ 22 │ 19 │ // PhET plugins 23 │ 20 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 21 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 22 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 23 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 24 │ 28 │ 25 │ // common directories, uppercase names to identify them in require imports 29 │ 26 │ AXON: '../../axon/js', 30 │ 27 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 28 │ DOT: '../../dot/js', 32 │ 29 │ GRIDDLE: '../../griddle/js', 33 │ 30 │ JOIST: '../../joist/js', 34 │ 31 │ KITE: '../../kite/js', 35 │ 32 │ PHET_CORE: '../../phet-core/js', 36 │ 33 │ PHET_IO: '../../phet-io/js', 37 │ 34 │ PHETCOMMON: '../../phetcommon/js', 38 │ 35 │ REPOSITORY: '..', 39 │ 36 │ SCENERY: '../../scenery/js', 40 │ 37 │ SCENERY_PHET: '../../scenery-phet/js', 41 │ 38 │ SUN: '../../sun/js', 42 │ 39 │ TANDEM: '../../tandem/js', 43 │ 40 │ 44 │ 41 │ // this sim 45 │ 42 │ GENE_EXPRESSION_ESSENTIALS: '.' - ..\nitroglycerin\js\nodes\C2H5ClNode.js: 23-54 ..\nitroglycerin\js\nodes\C2H5OHNode.js: 23-54 23 │ 23 │ function C2H5ClNode( options ) { 24 │ 24 │ 25 │ 25 │ options = _.extend( { atomOptions: {} }, options ); 26 │ 26 │ 27 │ 27 │ // atoms 28 │ 28 │ var leftNode = new AtomNode( Element.C, options.atomOptions ); 29 │ 29 │ var centerNode = new AtomNode( Element.C, _.extend( { 30 │ 30 │ centerX: leftNode.right + ( 0.25 * leftNode.width ), 31 │ 31 │ centerY: leftNode.centerY 32 │ 32 │ }, options.atomOptions ) ); 33 │ 33 │ var smallTopLeftNode = new AtomNode( Element.H, _.extend( { 34 │ 34 │ centerX: leftNode.centerX, 35 │ 35 │ centerY: leftNode.top 36 │ 36 │ }, options.atomOptions ) ); 37 │ 37 │ var smallBottomLeftNode = new AtomNode( Element.H, _.extend( { 38 │ 38 │ centerX: smallTopLeftNode.centerX, 39 │ 39 │ centerY: leftNode.bottom 40 │ 40 │ }, options.atomOptions ) ); 41 │ 41 │ var smallLeftNode = new AtomNode( Element.H, _.extend( { 42 │ 42 │ centerX: leftNode.left, 43 │ 43 │ centerY: leftNode.centerY 44 │ 44 │ }, options.atomOptions ) ); 45 │ 45 │ var smallTopRightNode = new AtomNode( Element.H, _.extend( { 46 │ 46 │ centerX: centerNode.centerX, 47 │ 47 │ centerY: centerNode.top 48 │ 48 │ }, options.atomOptions ) ); 49 │ 49 │ var smallBottomRightNode = new AtomNode( Element.H, _.extend( { 50 │ 50 │ centerX: centerNode.centerX, 51 │ 51 │ centerY: centerNode.bottom 52 │ 52 │ }, options.atomOptions ) ); 53 │ 53 │ var rightNode = new AtomNode( Element.Cl, _.extend( { 54 │ 54 │ left: centerNode.centerX + ( 0.11 * leftNode.width ), - ..\nitroglycerin\js\nodes\C2H5ClNode.js: 29-47 ..\nitroglycerin\js\nodes\C2H6Node.js: 28-46 29 │ 28 │ var centerNode = new AtomNode( Element.C, _.extend( { 30 │ 29 │ centerX: leftNode.right + ( 0.25 * leftNode.width ), 31 │ 30 │ centerY: leftNode.centerY 32 │ 31 │ }, options.atomOptions ) ); 33 │ 32 │ var smallTopLeftNode = new AtomNode( Element.H, _.extend( { 34 │ 33 │ centerX: leftNode.centerX, 35 │ 34 │ centerY: leftNode.top 36 │ 35 │ }, options.atomOptions ) ); 37 │ 36 │ var smallBottomLeftNode = new AtomNode( Element.H, _.extend( { 38 │ 37 │ centerX: smallTopLeftNode.centerX, 39 │ 38 │ centerY: leftNode.bottom 40 │ 39 │ }, options.atomOptions ) ); 41 │ 40 │ var smallLeftNode = new AtomNode( Element.H, _.extend( { 42 │ 41 │ centerX: leftNode.left, 43 │ 42 │ centerY: leftNode.centerY 44 │ 43 │ }, options.atomOptions ) ); 45 │ 44 │ var smallTopRightNode = new AtomNode( Element.H, _.extend( { 46 │ 45 │ centerX: centerNode.centerX, 47 │ 46 │ centerY: centerNode.top - ..\nitroglycerin\js\nodes\H2ONode.js: 27-45 ..\nitroglycerin\js\nodes\H2SNode.js: 27-45 27 │ 27 │ var bigNode = new AtomNode( Element.O, options.atomOptions ); 28 │ 28 │ var smallLeftNode = new AtomNode( Element.H, _.extend( { 29 │ 29 │ centerX: bigNode.left, 30 │ 30 │ centerY: bigNode.bottom - ( 0.25 * bigNode.height ) 31 │ 31 │ }, options.atomOptions ) ); 32 │ 32 │ var smallRightNode = new AtomNode( Element.H, _.extend( { 33 │ 33 │ centerX: bigNode.right, 34 │ 34 │ centerY: smallLeftNode.centerY 35 │ 35 │ }, options.atomOptions ) ); 36 │ 36 │ 37 │ 37 │ options.children = [ new Node( { 38 │ 38 │ children: [ bigNode, smallLeftNode, smallRightNode ], 39 │ 39 │ center: Vector2.ZERO // origin at geometric center 40 │ 40 │ } ) ]; 41 │ 41 │ Node.call( this, options ); 42 │ 42 │ } 43 │ 43 │ 44 │ 44 │ nitroglycerin.register( 'H2ONode', H2ONode ); 45 │ 45 │ - ..\nitroglycerin\js\nodes\H2ONode.js: 27-36 ..\nitroglycerin\js\nodes\NH3Node.js: 27-36 27 │ 27 │ var bigNode = new AtomNode( Element.O, options.atomOptions ); 28 │ 28 │ var smallLeftNode = new AtomNode( Element.H, _.extend( { 29 │ 29 │ centerX: bigNode.left, 30 │ 30 │ centerY: bigNode.bottom - ( 0.25 * bigNode.height ) 31 │ 31 │ }, options.atomOptions ) ); 32 │ 32 │ var smallRightNode = new AtomNode( Element.H, _.extend( { 33 │ 33 │ centerX: bigNode.right, 34 │ 34 │ centerY: smallLeftNode.centerY 35 │ 35 │ }, options.atomOptions ) ); 36 │ 36 │ - ..\nitroglycerin\js\nodes\PCl3Node.js: 36-49 ..\nitroglycerin\js\nodes\PF3Node.js: 36-49 36 │ 36 │ var bottomNode = new AtomNode( Element.Cl, _.extend( { 37 │ 37 │ centerX: centerNode.centerX, 38 │ 38 │ centerY: centerNode.bottom 39 │ 39 │ }, options.atomOptions ) ); 40 │ 40 │ 41 │ 41 │ options.children = [ new Node( { 42 │ 42 │ children: [ leftNode, rightNode, centerNode, bottomNode ], 43 │ 43 │ center: Vector2.ZERO // origin at geometric center 44 │ 44 │ } ) ]; 45 │ 45 │ Node.call( this, options ); 46 │ 46 │ } 47 │ 47 │ 48 │ 48 │ nitroglycerin.register( 'PCl3Node', PCl3Node ); 49 │ 49 │ - ..\nitroglycerin\js\nodes\H2ONode.js: 27-49 ..\nitroglycerin\js\nodes\PH3Node.js: 27-49 27 │ 27 │ var bigNode = new AtomNode( Element.O, options.atomOptions ); 28 │ 28 │ var smallLeftNode = new AtomNode( Element.H, _.extend( { 29 │ 29 │ centerX: bigNode.left, 30 │ 30 │ centerY: bigNode.bottom - ( 0.25 * bigNode.height ) 31 │ 31 │ }, options.atomOptions ) ); 32 │ 32 │ var smallRightNode = new AtomNode( Element.H, _.extend( { 33 │ 33 │ centerX: bigNode.right, 34 │ 34 │ centerY: smallLeftNode.centerY 35 │ 35 │ }, options.atomOptions ) ); 36 │ 36 │ 37 │ 37 │ options.children = [ new Node( { 38 │ 38 │ children: [ bigNode, smallLeftNode, smallRightNode ], 39 │ 39 │ center: Vector2.ZERO // origin at geometric center 40 │ 40 │ } ) ]; 41 │ 41 │ Node.call( this, options ); 42 │ 42 │ } 43 │ 43 │ 44 │ 44 │ nitroglycerin.register( 'H2ONode', H2ONode ); 45 │ 45 │ 46 │ 46 │ return inherit( Node, H2ONode ); 47 │ 47 │ } ); 48 │ 48 │ - ..\nitroglycerin\js\nodes\SO2Node.js: 22-36 ..\nitroglycerin\js\nodes\SO3Node.js: 22-36 22 │ 22 │ function SO2Node( options ) { 23 │ 23 │ 24 │ 24 │ options = _.extend( { atomOptions: {} }, options ); 25 │ 25 │ 26 │ 26 │ // atoms 27 │ 27 │ var centerNode = new AtomNode( Element.S, options.atomOptions ); 28 │ 28 │ var leftNode = new AtomNode( Element.O, _.extend( { 29 │ 29 │ centerX: centerNode.left, 30 │ 30 │ centerY: centerNode.centerY + ( 0.2 * centerNode.height ) 31 │ 31 │ }, options.atomOptions ) ); 32 │ 32 │ var rightNode = new AtomNode( Element.O, _.extend( { 33 │ 33 │ centerX: centerNode.right, 34 │ 34 │ centerY: centerNode.centerY + ( 0.2 * centerNode.height ) 35 │ 35 │ }, options.atomOptions ) ); 36 │ 36 │ - ..\build-an-atom\js\build-an-atom-config.js: 5-35 ..\ohms-law\js\ohms-law-config.js: 8-38 5 │ 8 │ deps: [ 'build-an-atom-main' ], 6 │ 9 │ 7 │ 10 │ paths: { 8 │ 11 │ 9 │ 12 │ // third party libs 10 │ 13 │ text: '../../sherpa/lib/text-2.0.12', 11 │ 14 │ 12 │ 15 │ // plugins 13 │ 16 │ audio: '../../chipper/js/requirejs-plugins/audio', 14 │ 17 │ image: '../../chipper/js/requirejs-plugins/image', 15 │ 18 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 16 │ 19 │ string: '../../chipper/js/requirejs-plugins/string', 17 │ 20 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 18 │ 21 │ 19 │ 22 │ // PhET libs, uppercase names to identify them in require.js imports 20 │ 23 │ AXON: '../../axon/js', 21 │ 24 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 22 │ 25 │ DOT: '../../dot/js', 23 │ 26 │ JOIST: '../../joist/js', 24 │ 27 │ KITE: '../../kite/js', 25 │ 28 │ PHET_CORE: '../../phet-core/js', 26 │ 29 │ PHET_IO: '../../phet-io/js', 27 │ 30 │ PHETCOMMON: '../../phetcommon/js', 28 │ 31 │ REPOSITORY: '..', 29 │ 32 │ SCENERY: '../../scenery/js', 30 │ 33 │ SCENERY_PHET: '../../scenery-phet/js', 31 │ 34 │ SHERPA: '../../sherpa', 32 │ 35 │ SHRED: '../../shred/js', 33 │ 36 │ SUN: '../../sun/js', 34 │ 37 │ TANDEM: '../../tandem/js', 35 │ 38 │ VEGAS: '../../vegas/js', - ..\optics-lab\js\optics-lab\view\ControlPanel.js: 220-226 ..\optics-lab\js\optics-lab\view\ControlPanel.js: 229-235 220 │ 229 │ radiusSlider = new HSlider( pieceModel.radiusProperty, { min: 200, max: 1600 }, sliderOptions ); 221 │ 230 │ radiusVBox = new VBox( { children: [ radiusSlider, this.radiusText ], align: 'center' } ); 222 │ 231 │ focalPtCheckBox = new CheckBox( this.focalPointsText, piece.showFocalPointsProperty, checkBoxOptions ); 223 │ 232 │ this.content = new HBox( { children: [ fillerBox, diameterVBox, radiusVBox, focalPtCheckBox, focalLengthHBox ], spacing: spacing } ); 224 │ 233 │ break; 225 │ 234 │ case 'plane_mirror': 226 │ 235 │ this.content = new HBox( { children: [ fillerBox, diameterVBox], spacing: spacing } ); - ..\optics-lab\js\optics-lab\view\ControlPanel2.js: 23-49 ..\optics-lab\js\optics-lab\view\ControlPanels.js: 23-49 23 │ 23 │ define( function ( require ) { 24 │ 24 │ 'use strict'; 25 │ 25 │ 26 │ 26 │ // modules 27 │ 27 │ var AquaRadioButton = require('SUN/AquaRadioButton'); 28 │ 28 │ var CheckBox = require('SUN/CheckBox'); 29 │ 29 │ var Dimension2 = require('DOT/Dimension2'); 30 │ 30 │ var ExpandCollapseButton = require('SUN/ExpandCollapseButton'); 31 │ 31 │ var HBox = require('SCENERY/nodes/HBox'); 32 │ 32 │ var HSlider = require('SUN/HSlider'); 33 │ 33 │ //var HStrut = require('SCENERY/nodes/HStrut'); 34 │ 34 │ var inherit = require('PHET_CORE/inherit'); 35 │ 35 │ var Node = require('SCENERY/nodes/Node'); 36 │ 36 │ //var ObservableArray = require('AXON/ObservableArray'); 37 │ 37 │ var Panel = require('SUN/Panel'); 38 │ 38 │ var PhetFont = require('SCENERY_PHET/PhetFont'); 39 │ 39 │ var Property = require('AXON/Property'); 40 │ 40 │ var Text = require('SCENERY/nodes/Text'); 41 │ 41 │ var Util = require('OPTICS_LAB/optics-lab/common/Util'); 42 │ 42 │ var VBox = require('SCENERY/nodes/VBox'); 43 │ 43 │ 44 │ 44 │ // constants 45 │ 45 │ var DISPLAY_FONT = new PhetFont(12); 46 │ 46 │ var TEXT_COLOR = Util.TEXT_COLOR; 47 │ 47 │ //var PANEL_COLOR = Util.PANEL_COLOR; 48 │ 48 │ //var BACKGROUND_COLOR = Util.BACKGROUND_COLOR; 49 │ 49 │ - ..\optics-lab\js\optics-lab\view\ControlPanel2.js: 75-86 ..\optics-lab\js\optics-lab\view\ControlPanels.js: 79-90 75 │ 79 │ var fontInfo = {font: DISPLAY_FONT}; 76 │ 80 │ var whiteText = new Text('white', fontInfo); 77 │ 81 │ var greenText = new Text('green', fontInfo); 78 │ 82 │ var redText = new Text('red', fontInfo); 79 │ 83 │ var yellowText = new Text('yellow', fontInfo); 80 │ 84 │ 81 │ 85 │ fontInfo = {font: DISPLAY_FONT, fill: TEXT_COLOR}; 82 │ 86 │ var nbrOfRaysText = new Text('number of rays', fontInfo); 83 │ 87 │ var focalPointsText = new Text('focal points', fontInfo); 84 │ 88 │ var widthText = new Text('width', fontInfo); 85 │ 89 │ var spreadText = new Text('spread', fontInfo); 86 │ 90 │ var diameterText = new Text('diameter', fontInfo); - ..\optics-lab\js\optics-lab\view\ControlPanel2.js: 88-105 ..\optics-lab\js\optics-lab\view\ControlPanels.js: 92-109 88 │ 92 │ var focalLengthText = new Text('f : ', fontInfo); 89 │ 93 │ this.focalLengthReadoutText = new Text('filler', fontInfo); 90 │ 94 │ var indexText = new Text('refractive index', fontInfo); 91 │ 95 │ 92 │ 96 │ 93 │ 97 │ 94 │ 98 │ // All controls are placed on display node, with visibility set by expand/collapse button 95 │ 99 │ var panelOptions = { 96 │ 100 │ fill: 'white', 97 │ 101 │ stroke: 'black', 98 │ 102 │ lineWidth: 1, // width of the background border 99 │ 103 │ xMargin: 15, 100 │ 104 │ yMargin: 5, 101 │ 105 │ cornerRadius: 5, // radius of the rounded corners on the background 102 │ 106 │ resize: false, // dynamically resize when content bounds change 103 │ 107 │ backgroundPickable: false, 104 │ 108 │ align: 'left', // {string} horizontal of content in the pane, left|center|right 105 │ 109 │ minWidth: 0 // minimum width of the panel - ..\optics-lab\js\optics-lab\view\ControlPanel.js: 246-266 ..\optics-lab\js\optics-lab\view\ControlPanels.js: 362-382 246 │ 362 │ },// end setControlsForSelectedPiece() 247 │ 363 │ setColorRadioButtonsForSourceNode: function( sourceNode ){ 248 │ 364 │ var radioButtonOptions = { radius: 8, fontSize: 12, deselectedColor: 'white' }; 249 │ 365 │ var whiteColorRadioButton = new AquaRadioButton( sourceNode.colorProperty, 'white', this.whiteText, radioButtonOptions ); 250 │ 366 │ var greenColorRadioButton = new AquaRadioButton( sourceNode.colorProperty, 'green', this.greenText, radioButtonOptions ); 251 │ 367 │ var redColorRadioButton = new AquaRadioButton( sourceNode.colorProperty, 'red', this.redText, radioButtonOptions ); 252 │ 368 │ var yellowColorRadioButton = new AquaRadioButton( sourceNode.colorProperty, 'yellow', this.yellowText, radioButtonOptions ); 253 │ 369 │ var spacing = 5; 254 │ 370 │ this.colorVBox1 = new VBox( { children: [ whiteColorRadioButton, greenColorRadioButton ], align: 'left', spacing: spacing } ); 255 │ 371 │ this.colorVBox2 = new VBox( { children: [ redColorRadioButton, yellowColorRadioButton ], align: 'left', spacing: spacing } ); 256 │ 372 │ } 257 │ 373 │ 258 │ 374 │ 259 │ 375 │ }//end inherit 260 │ 376 │ ); 261 │ 377 │ } ); 262 │ 378 │ - ..\optics-lab\js\optics-lab\view\ControlPanels.js: 16-58 ..\optics-lab\js\optics-lab\view\SelectedPieceControlPanel.js: 13-55 16 │ 13 │ * plane_mirror: diameter 17 │ 14 │ * simple_mask: diameter 18 │ 15 │ * slit_mask: diameter/ slit width 19 │ 16 │ * Created by dubson on 7/12/2015. 20 │ 17 │ */ 21 │ 18 │ 22 │ 19 │ 23 │ 20 │ define( function ( require ) { 24 │ 21 │ 'use strict'; 25 │ 22 │ 26 │ 23 │ // modules 27 │ 24 │ var AquaRadioButton = require('SUN/AquaRadioButton'); 28 │ 25 │ var CheckBox = require('SUN/CheckBox'); 29 │ 26 │ var Dimension2 = require('DOT/Dimension2'); 30 │ 27 │ var ExpandCollapseButton = require('SUN/ExpandCollapseButton'); 31 │ 28 │ var HBox = require('SCENERY/nodes/HBox'); 32 │ 29 │ var HSlider = require('SUN/HSlider'); 33 │ 30 │ //var HStrut = require('SCENERY/nodes/HStrut'); 34 │ 31 │ var inherit = require('PHET_CORE/inherit'); 35 │ 32 │ var Node = require('SCENERY/nodes/Node'); 36 │ 33 │ //var ObservableArray = require('AXON/ObservableArray'); 37 │ 34 │ var Panel = require('SUN/Panel'); 38 │ 35 │ var PhetFont = require('SCENERY_PHET/PhetFont'); 39 │ 36 │ var Property = require('AXON/Property'); 40 │ 37 │ var Text = require('SCENERY/nodes/Text'); 41 │ 38 │ var Util = require('OPTICS_LAB/optics-lab/common/Util'); 42 │ 39 │ var VBox = require('SCENERY/nodes/VBox'); 43 │ 40 │ 44 │ 41 │ // constants 45 │ 42 │ var DISPLAY_FONT = new PhetFont(12); 46 │ 43 │ var TEXT_COLOR = Util.TEXT_COLOR; 47 │ 44 │ //var PANEL_COLOR = Util.PANEL_COLOR; 48 │ 45 │ //var BACKGROUND_COLOR = Util.BACKGROUND_COLOR; 49 │ 46 │ 50 │ 47 │ //TODO these were added here because they are undefined and failing lint, see https://github.com/phetsims/optics-lab/issues/6 51 │ 48 │ var focalLengthHBox; 52 │ 49 │ var piece; 53 │ 50 │ var pieceModel; 54 │ 51 │ 55 │ 52 │ /** 56 │ 53 │ * @param mainModel 57 │ 54 │ * @param mainView 58 │ 55 │ * @param selectedPiece - ..\optics-lab\js\optics-lab\view\ControlPanel.js: 76-92 ..\optics-lab\js\optics-lab\view\SelectedPieceControlPanel.js: 66-82 76 │ 66 │ var fontInfo = { font: DISPLAY_FONT } ; 77 │ 67 │ this.whiteText = new Text( 'white', fontInfo ); 78 │ 68 │ this.greenText = new Text( 'green', fontInfo ); 79 │ 69 │ this.redText = new Text( 'red', fontInfo ); 80 │ 70 │ this.yellowText = new Text( 'yellow', fontInfo ); 81 │ 71 │ 82 │ 72 │ fontInfo = { font: DISPLAY_FONT, fill: TEXT_COLOR }; 83 │ 73 │ this.nbrOfRaysText = new Text( 'number of rays', fontInfo ); 84 │ 74 │ this.focalPointsText = new Text( 'focal points', fontInfo ); 85 │ 75 │ this.heightText = new Text( 'height', fontInfo ); 86 │ 76 │ this.spreadText = new Text( 'spread', fontInfo ); 87 │ 77 │ this.diameterText = new Text( 'diameter', fontInfo ); 88 │ 78 │ this.radiusText = new Text( 'radius of curvature', fontInfo ); 89 │ 79 │ this.focalLengthText = new Text( 'f : ', fontInfo ); 90 │ 80 │ this.focalLengthReadoutText = new Text( 'filler', fontInfo ); 91 │ 81 │ this.indexText = new Text( 'refractive index', fontInfo ); 92 │ 82 │ //this.showFocalPointsProperty = new Property( false ); - ..\optics-lab\js\optics-lab\view\ControlPanels.js: 250-274 ..\optics-lab\js\optics-lab\view\SelectedPieceControlPanel.js: 145-169 250 │ 145 │ var fillerBox = new Text(' ', {font: DISPLAY_FONT}); 251 │ 146 │ var nbrOfRaysVBox; 252 │ 147 │ var diameterVBox; 253 │ 148 │ var sliderOptions = { 254 │ 149 │ trackSize: new Dimension2( 120, 5 ), 255 │ 150 │ thumbSize: new Dimension2( 12, 25 ), 256 │ 151 │ thumbTouchAreaXDilation: 6, 257 │ 152 │ thumbTouchAreaYDilation: 6 258 │ 153 │ }; 259 │ 154 │ var vBoxMaker = function( childrenArray ){ 260 │ 155 │ return new VBox( { 261 │ 156 │ children: childrenArray, 262 │ 157 │ align: 'center', 263 │ 158 │ resize: false 264 │ 159 │ }); 265 │ 160 │ }; 266 │ 161 │ var hBoxMaker = function( childrenArray ){ 267 │ 162 │ return new HBox({ 268 │ 163 │ children: childrenArray, 269 │ 164 │ spacing: spacing, 270 │ 165 │ resize: false 271 │ 166 │ }); 272 │ 167 │ }; 273 │ 168 │ if ( type === 'fan_source' || type === 'beam_source' ) { 274 │ 169 │ var maxNbrRays = this.mainModel.maxNbrOfRaysFromASource; - ..\optics-lab\js\optics-lab\view\ControlPanels.js: 282-293 ..\optics-lab\js\optics-lab\view\SelectedPieceControlPanel.js: 178-189 282 │ 178 │ var diameterSlider = new HSlider( this.diameterProperty, {min: 50, max: 250}, sliderOptions); 283 │ 179 │ diameterVBox = vBoxMaker( [ diameterSlider, this.diameterText ] ); 284 │ 180 │ this.focalLengthReadoutText.text = pieceModel.f.toFixed(0); 285 │ 181 │ var self = this; 286 │ 182 │ pieceModel.fProperty.link( function() { 287 │ 183 │ self.focalLengthReadoutText.text = pieceModel.f.toFixed(0); 288 │ 184 │ //console.log( 'focalLength' + focalLength.toFixed(0) ); 289 │ 185 │ }); 290 │ 186 │ } 291 │ 187 │ var panelContent = new Node(); 292 │ 188 │ var checkBoxOptions = {checkBoxColorBackground: 'white'}; 293 │ 189 │ var spacing = 25; - ..\optics-lab\js\optics-lab\view\ControlPanels.js: 292-300 ..\optics-lab\js\optics-lab\view\SelectedPieceControlPanel.js: 188-196 292 │ 188 │ var checkBoxOptions = {checkBoxColorBackground: 'white'}; 293 │ 189 │ var spacing = 25; 294 │ 190 │ //console.log( 'setControlsForSelectedPiece' + piece.type ); 295 │ 191 │ var focalLengthHBox = hBoxMaker( [ this.focalLengthText, this.focalLengthReadoutText ] ); 296 │ 192 │ switch (type) { 297 │ 193 │ case 'fan_source': 298 │ 194 │ var spreadSlider = new HSlider(pieceModel.spreadProperty, {min: 2, max: 180}, sliderOptions); 299 │ 195 │ var spreadVBox = vBoxMaker( [ spreadSlider, this.spreadText ] ); 300 │ 196 │ panelContent = hBoxMaker( [ fillerBox, nbrOfRaysVBox, spreadVBox, this.colorVBox1, this.colorVBox2] ); - ..\optics-lab\js\optics-lab\view\ControlPanels.js: 305-317 ..\optics-lab\js\optics-lab\view\SelectedPieceControlPanel.js: 201-213 305 │ 201 │ panelContent = hBoxMaker( [fillerBox, nbrOfRaysVBox, heightVBox, this.colorVBox1, this.colorVBox2] ); 306 │ 202 │ break; 307 │ 203 │ case 'converging_lens': 308 │ 204 │ //ComponentModel( mainModel, type, diameter, radiusCurvature, focalLength, index ) 309 │ 205 │ //radius of curvature R = 2*f*( n - 1 ) 310 │ 206 │ var radiusSlider = new HSlider(pieceModel.radiusProperty, {min: 100, max: 800}, sliderOptions); 311 │ 207 │ this.hSliders.push(radiusSlider); 312 │ 208 │ var radiusVBox = vBoxMaker( [radiusSlider, this.radiusText] ); 313 │ 209 │ var indexSlider = new HSlider(pieceModel.indexProperty, {min: 1.4, max: 3}, sliderOptions); 314 │ 210 │ this.hSliders.push(indexSlider); 315 │ 211 │ var indexVBox = vBoxMaker( [ indexSlider, this.indexText ] ); 316 │ 212 │ var focalPtCheckBox = new CheckBox(this.focalPointsText, piece.showFocalPointsProperty, checkBoxOptions); 317 │ 213 │ panelContent = hBoxMaker( [ fillerBox, diameterVBox, radiusVBox, indexVBox, focalPtCheckBox, focalLengthHBox ] ); - ..\optics-lab\js\optics-lab\view\ControlPanels.js: 317-329 ..\optics-lab\js\optics-lab\view\SelectedPieceControlPanel.js: 213-225 317 │ 213 │ panelContent = hBoxMaker( [ fillerBox, diameterVBox, radiusVBox, indexVBox, focalPtCheckBox, focalLengthHBox ] ); 318 │ 214 │ break; 319 │ 215 │ case 'diverging_lens': 320 │ 216 │ //ComponentModel( mainModel, type, diameter, radiusCurvature, focalLength, index ) 321 │ 217 │ //radius of curvature R = 2*f*( n - 1 ) 322 │ 218 │ radiusSlider = new HSlider(pieceModel.radiusProperty, {min: -100, max: -800}, sliderOptions); 323 │ 219 │ this.hSliders.push(radiusSlider); 324 │ 220 │ radiusVBox = vBoxMaker( [radiusSlider, this.radiusText] ); 325 │ 221 │ indexSlider = new HSlider(pieceModel.indexProperty, {min: 1.4, max: 3}, sliderOptions); 326 │ 222 │ this.hSliders.push(indexSlider); 327 │ 223 │ indexVBox = vBoxMaker( [ indexSlider, this.indexText ] ); 328 │ 224 │ focalPtCheckBox = new CheckBox(this.focalPointsText, piece.showFocalPointsProperty, checkBoxOptions); 329 │ 225 │ panelContent = hBoxMaker( [ fillerBox, diameterVBox, radiusVBox, indexVBox, focalPtCheckBox, focalLengthHBox ] ); - ..\optics-lab\js\optics-lab\view\ControlPanels.js: 329-336 ..\optics-lab\js\optics-lab\view\SelectedPieceControlPanel.js: 225-232 329 │ 225 │ panelContent = hBoxMaker( [ fillerBox, diameterVBox, radiusVBox, indexVBox, focalPtCheckBox, focalLengthHBox ] ); 330 │ 226 │ break; 331 │ 227 │ case 'converging_mirror': 332 │ 228 │ radiusSlider = new HSlider(pieceModel.radiusProperty, {min: 200, max: 1600}, sliderOptions); 333 │ 229 │ this.hSliders.push(radiusSlider); 334 │ 230 │ radiusVBox = vBoxMaker( [ radiusSlider, this.radiusText ] ); 335 │ 231 │ focalPtCheckBox = new CheckBox(this.focalPointsText, piece.showFocalPointsProperty, checkBoxOptions); 336 │ 232 │ panelContent = hBoxMaker( [fillerBox, diameterVBox, radiusVBox, focalPtCheckBox, focalLengthHBox] ); - ..\optics-lab\js\optics-lab\view\ControlPanels.js: 339-346 ..\optics-lab\js\optics-lab\view\SelectedPieceControlPanel.js: 235-242 339 │ 235 │ panelContent = hBoxMaker( [fillerBox, diameterVBox] ); 340 │ 236 │ break; 341 │ 237 │ case 'diverging_mirror': 342 │ 238 │ radiusSlider = new HSlider(pieceModel.radiusProperty, {min: -200, max: -1600}, sliderOptions); 343 │ 239 │ this.hSliders.push(radiusSlider); 344 │ 240 │ radiusVBox = vBoxMaker( [ radiusSlider, this.radiusText ] ); 345 │ 241 │ focalPtCheckBox = new CheckBox(this.focalPointsText, piece.showFocalPointsProperty, checkBoxOptions); 346 │ 242 │ panelContent = hBoxMaker( [ fillerBox, diameterVBox, radiusVBox, focalPtCheckBox, focalLengthHBox ] ); - ..\optics-lab\js\optics-lab\view\ControlPanel.js: 244-266 ..\optics-lab\js\optics-lab\view\SelectedPieceControlPanel.js: 257-279 244 │ 257 │ this.setControls(); 245 │ 258 │ }//end if (type != null) 246 │ 259 │ },// end setControlsForSelectedPiece() 247 │ 260 │ setColorRadioButtonsForSourceNode: function( sourceNode ){ 248 │ 261 │ var radioButtonOptions = { radius: 8, fontSize: 12, deselectedColor: 'white' }; 249 │ 262 │ var whiteColorRadioButton = new AquaRadioButton( sourceNode.colorProperty, 'white', this.whiteText, radioButtonOptions ); 250 │ 263 │ var greenColorRadioButton = new AquaRadioButton( sourceNode.colorProperty, 'green', this.greenText, radioButtonOptions ); 251 │ 264 │ var redColorRadioButton = new AquaRadioButton( sourceNode.colorProperty, 'red', this.redText, radioButtonOptions ); 252 │ 265 │ var yellowColorRadioButton = new AquaRadioButton( sourceNode.colorProperty, 'yellow', this.yellowText, radioButtonOptions ); 253 │ 266 │ var spacing = 5; 254 │ 267 │ this.colorVBox1 = new VBox( { children: [ whiteColorRadioButton, greenColorRadioButton ], align: 'left', spacing: spacing } ); 255 │ 268 │ this.colorVBox2 = new VBox( { children: [ redColorRadioButton, yellowColorRadioButton ], align: 'left', spacing: spacing } ); 256 │ 269 │ } 257 │ 270 │ 258 │ 271 │ 259 │ 272 │ }//end inherit 260 │ 273 │ ); 261 │ 274 │ } ); 262 │ 275 │ - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-44 ..\optics-lab\js\optics-lab-config.js: 10-43 11 │ 10 │ deps: [ 'area-model-multiplication-main' ], 12 │ 11 │ 13 │ 12 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 13 │ 15 │ 14 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 15 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 16 │ paths: { 18 │ 17 │ 19 │ 18 │ // third-party libs 20 │ 19 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 20 │ 22 │ 21 │ // PhET plugins 23 │ 22 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 23 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 24 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 25 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 26 │ 28 │ 27 │ // common directories, uppercase names to identify them in require imports 29 │ 28 │ AXON: '../../axon/js', 30 │ 29 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 30 │ DOT: '../../dot/js', 32 │ 31 │ JOIST: '../../joist/js', 33 │ 32 │ KITE: '../../kite/js', 34 │ 33 │ PHET_CORE: '../../phet-core/js', 35 │ 34 │ PHET_IO: '../../phet-io/js', 36 │ 35 │ PHETCOMMON: '../../phetcommon/js', 37 │ 36 │ REPOSITORY: '..', 38 │ 37 │ SCENERY: '../../scenery/js', 39 │ 38 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 39 │ SUN: '../../sun/js', 41 │ 40 │ TANDEM: '../../tandem/js', 42 │ 41 │ 43 │ 42 │ // this sim 44 │ 43 │ AREA_MODEL_MULTIPLICATION: '.' - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-44 ..\pendulum-lab\js\pendulum-lab-config.js: 10-43 11 │ 10 │ deps: [ 'area-model-multiplication-main' ], 12 │ 11 │ 13 │ 12 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 13 │ 15 │ 14 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 15 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 16 │ paths: { 18 │ 17 │ 19 │ 18 │ // third-party libs 20 │ 19 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 20 │ 22 │ 21 │ // PhET plugins 23 │ 22 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 23 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 24 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 25 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 26 │ 28 │ 27 │ // common directories, uppercase names to identify them in require imports 29 │ 28 │ AXON: '../../axon/js', 30 │ 29 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 30 │ DOT: '../../dot/js', 32 │ 31 │ JOIST: '../../joist/js', 33 │ 32 │ KITE: '../../kite/js', 34 │ 33 │ PHET_CORE: '../../phet-core/js', 35 │ 34 │ PHET_IO: '../../phet-io/js', 36 │ 35 │ PHETCOMMON: '../../phetcommon/js', 37 │ 36 │ REPOSITORY: '..', 38 │ 37 │ SCENERY: '../../scenery/js', 39 │ 38 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 39 │ SUN: '../../sun/js', 41 │ 40 │ TANDEM: '../../tandem/js', 42 │ 41 │ 43 │ 42 │ // this sim 44 │ 43 │ AREA_MODEL_MULTIPLICATION: '.' - ..\chipper\js\grunt\checkoutShas.js: 20-57 ..\perennial\js\grunt\checkoutShas.js: 18-55 20 │ 18 │ var dependencies = grunt.file.readJSON( ( buildServer ) ? '../chipper/js/build-server/tmp/dependencies.json' : 'dependencies.json' ); 21 │ 19 │ var done = grunt.task.current.async(); 22 │ 20 │ var numToCheckOut = 0; 23 │ 21 │ var numCheckedOut = 0; 24 │ 22 │ for ( var property in dependencies ) { 25 │ 23 │ if ( property !== 'comment' && property !== repositoryName ) { 26 │ 24 │ numToCheckOut++; 27 │ 25 │ } 28 │ 26 │ } 29 │ 27 │ 30 │ 28 │ for ( property in dependencies ) { 31 │ 29 │ if ( property !== 'comment' && property !== repositoryName && dependencies.hasOwnProperty( property ) ) { 32 │ 30 │ 33 │ 31 │ (function( property ) { 34 │ 32 │ 35 │ 33 │ assert( typeof( dependencies[ property ].branch !== 'undefined' ) && typeof( dependencies[ property ].sha !== 'undefined' ) ); 36 │ 34 │ 37 │ 35 │ grunt.log.writeln( 'Checking out dependency ' + property + ': ' + dependencies[ property ].branch + '@' + dependencies[ property ].sha ); 38 │ 36 │ 39 │ 37 │ //To execute something from a different directory: 40 │ 38 │ //cp.exec('foocommand', { cwd: 'path/to/dir/' }, callback); 41 │ 39 │ //http://stackoverflow.com/questions/14026967/calling-child-process-exec-in-node-as-though-it-was-executed-in-a-specific-folde 42 │ 40 │ var command = 'git checkout ' + ( toMaster ? 'master' : dependencies[ property ].sha ); 43 │ 41 │ child_process.exec( command, { cwd: '../' + property }, function( error1, stdout1, stderr1 ) { 44 │ 42 │ assert( !error1, 'error in ' + command + ' for repo ' + property ); 45 │ 43 │ grunt.log.writeln( 'Finished checkout.' ); 46 │ 44 │ grunt.log.writeln( stdout1 ); 47 │ 45 │ grunt.log.writeln( stderr1 ); 48 │ 46 │ numCheckedOut = numCheckedOut + 1; 49 │ 47 │ if ( numToCheckOut === numCheckedOut ) { 50 │ 48 │ done(); 51 │ 49 │ } 52 │ 50 │ } ); 53 │ 51 │ })( property ); 54 │ 52 │ } 55 │ 53 │ } 56 │ 54 │ }; - ..\perennial\js\grunt\maintenance.js: 770-778 ..\perennial\js\grunt\maintenance.js: 832-840 770 │ 832 │ this.gitCheckoutShas( simName, branch, function() { 771 │ 833 │ self.npmUpdate( simName, function() { 772 │ 834 │ self.npmUpdate( 'chipper', function() { 773 │ 835 │ self.execute( GRUNT_CMD, [], '../' + simName, function() { 774 │ 836 │ // note, may need to enable ssh-agent? "exec ssh-agent bash" 775 │ 837 │ self.execute( GRUNT_CMD, [ 'deploy-rc' ], '../' + simName, function() { 776 │ 838 │ self.gitCheckoutMaster( simName, function() { 777 │ 839 │ self.success( 'Deployed ' + simName ); 778 │ 840 │ } ); - ..\perennial\js\grunt\maintenance.js: 796-806 ..\perennial\js\grunt\maintenance.js: 862-872 796 │ 862 │ maintenanceDeployRC: function( simName, message ) { 797 │ 863 │ var self = this; 798 │ 864 │ 799 │ 865 │ var maintenanceObject = this.storageObject; 800 │ 866 │ var branch = maintenanceObject.sims[ simName ].branch; 801 │ 867 │ this.assert( branch, 'Did not detect branch for ' + simName ); 802 │ 868 │ 803 │ 869 │ this.gitCheckoutShas( simName, branch, function() { 804 │ 870 │ self.getCheckedInVersion( simName, function( branchVersionInfo ) { 805 │ 871 │ var productionVersionInfo = maintenanceObject.sims[ simName ]; 806 │ 872 │ // Bumps in major/minor version indicate "double-check things, and if OK do it manually" - ..\perennial\js\grunt\maintenance.js: 824-835 ..\perennial\js\grunt\maintenance.js: 881-892 824 │ 881 │ var newVersionString = major + '.' + minor + '.' + maintenance + '-rc.' + rcModifier; 825 │ 882 │ 826 │ 883 │ var packageObject = JSON.parse( fs.readFileSync( '../' + simName + '/package.json', 'utf8' ) ); 827 │ 884 │ packageObject.version = newVersionString; 828 │ 885 │ fs.writeFileSync( '../' + simName + '/package.json', JSON.stringify( packageObject, null, 2 ) ); 829 │ 886 │ 830 │ 887 │ self.execute( 'git', [ 'add', 'package.json' ], '../' + simName, function() { 831 │ 888 │ self.execute( 'git', [ 'commit', '-m', 'Bumping version to ' + newVersionString + ' for ' + message ], '../' + simName, function() { 832 │ 889 │ self.gitPush( simName, branch, function() { 833 │ 890 │ self.npmUpdate( simName, function() { 834 │ 891 │ self.npmUpdate( 'chipper', function() { 835 │ 892 │ self.execute( GRUNT_CMD, [], '../' + simName, function() { - ..\beers-law-lab\js\concentration\view\StockSolutionNode.js: 34-45 ..\ph-scale\js\common\view\DropperFluidNode.js: 30-41 34 │ 30 │ if ( dropper.dispensingProperty.get() && !dropper.emptyProperty.get() ) { 35 │ 31 │ self.setRect( -tipWidth / 2, 0, tipWidth, beaker.location.y - dropper.locationProperty.get().y ); 36 │ 32 │ } 37 │ 33 │ else { 38 │ 34 │ self.setRect( 0, 0, 0, 0 ); 39 │ 35 │ } 40 │ 36 │ // move this node to the dropper's location 41 │ 37 │ self.translation = modelViewTransform.modelToViewPosition( dropper.locationProperty.get() ); 42 │ 38 │ }; 43 │ 39 │ dropper.locationProperty.link( updateShapeAndLocation ); 44 │ 40 │ dropper.dispensingProperty.link( updateShapeAndLocation ); 45 │ 41 │ dropper.emptyProperty.link( updateShapeAndLocation ); - ..\beers-law-lab\js\concentration\view\FaucetFluidNode.js: 33-47 ..\ph-scale\js\common\view\FaucetFluidNode.js: 29-43 33 │ 29 │ fluid.colorProperty.link( function( color ) { 34 │ 30 │ self.fill = color; 35 │ 31 │ self.stroke = color.darkerColor(); 36 │ 32 │ } ); 37 │ 33 │ 38 │ 34 │ /* 39 │ 35 │ * Set the width of the shape to match the flow rate. 40 │ 36 │ * @param {number} flowRate 41 │ 37 │ */ 42 │ 38 │ var viewLocation = modelViewTransform.modelToViewPosition( faucet.location ); 43 │ 39 │ var viewHeight = modelViewTransform.modelToViewDeltaY( height ); 44 │ 40 │ faucet.flowRateProperty.link( function( flowRate ) { 45 │ 41 │ if ( flowRate === 0 ) { 46 │ 42 │ self.setRect( 0, 0, 0, 0 ); 47 │ 43 │ } - ..\ph-scale\js\common\view\graph\LinearGraph.js: 166-189 ..\ph-scale\js\common\view\graph\LogarithmicGraph.js: 166-189 166 │ 166 │ }; 167 │ 167 │ 168 │ 168 │ // Update the indicators 169 │ 169 │ var updateIndicators = function() { 170 │ 170 │ 171 │ 171 │ var valueH2O; 172 │ 172 │ var valueH3O; 173 │ 173 │ var valueOH; 174 │ 174 │ if ( graphUnitsProperty.get() === GraphUnits.MOLES_PER_LITER ) { 175 │ 175 │ // concentration 176 │ 176 │ valueH2O = solution.getConcentrationH2O(); 177 │ 177 │ valueH3O = solution.getConcentrationH3O(); 178 │ 178 │ valueOH = solution.getConcentrationOH(); 179 │ 179 │ } 180 │ 180 │ else { 181 │ 181 │ // quantity 182 │ 182 │ valueH2O = solution.getMolesH2O(); 183 │ 183 │ valueH3O = solution.getMolesH3O(); 184 │ 184 │ valueOH = solution.getMolesOH(); 185 │ 185 │ } 186 │ 186 │ 187 │ 187 │ // move indicators 188 │ 188 │ h2OIndicatorNode.y = valueToY( valueH2O, -4 ); // offset the H2O indicator when off scale, so it doesn't butt up again OH indicator 189 │ 189 │ h3OIndicatorNode.y = valueToY( valueH3O ); - ..\beers-law-lab\js\concentration\view\SolutionNode.js: 36-52 ..\ph-scale\js\common\view\SolutionNode.js: 30-46 36 │ 30 │ /* 37 │ 31 │ * Updates the color of the solution, accounting for saturation. 38 │ 32 │ * @param {Color} color 39 │ 33 │ */ 40 │ 34 │ solution.colorProperty.link( function( color ) { 41 │ 35 │ self.fill = color; 42 │ 36 │ self.stroke = color.darkerColor(); 43 │ 37 │ } ); 44 │ 38 │ 45 │ 39 │ /* 46 │ 40 │ * Updates the amount of stuff in the beaker, based on solution volume. 47 │ 41 │ * @param {number} volume 48 │ 42 │ */ 49 │ 43 │ var viewLocation = modelViewTransform.modelToViewPosition( beaker.location ); 50 │ 44 │ var viewWidth = modelViewTransform.modelToViewDeltaX( beaker.size.width ); 51 │ 45 │ solution.volumeProperty.link( function( volume ) { 52 │ 46 │ - ..\beers-law-lab\js\concentration\view\ConcentrationMeterNode.js: 337-345 ..\ph-scale\js\macro\view\MacroPHMeterNode.js: 395-403 337 │ 395 │ var c2Offset = new Vector2( 50, 0 ); 338 │ 396 │ var c1 = new Vector2( bodyConnectionPoint.x + c1Offset.x, bodyConnectionPoint.y + c1Offset.y ); 339 │ 397 │ var c2 = new Vector2( probeConnectionPoint.x + c2Offset.x, probeConnectionPoint.y + c2Offset.y ); 340 │ 398 │ 341 │ 399 │ self.shape = new Shape() 342 │ 400 │ .moveTo( bodyConnectionPoint.x, bodyConnectionPoint.y ) 343 │ 401 │ .cubicCurveTo( c1.x, c1.y, c2.x, c2.y, probeConnectionPoint.x, probeConnectionPoint.y ); 344 │ 402 │ }; 345 │ 403 │ body.locationProperty.link( updateCurve ); - ..\ph-scale\js\macro\view\MacroView.js: 47-59 ..\ph-scale\js\micro\view\MicroView.js: 57-69 47 │ 57 │ var neutralIndicator = new NeutralIndicator( model.solution ); 48 │ 58 │ 49 │ 59 │ // dropper 50 │ 60 │ var DROPPER_SCALE = 0.85; 51 │ 61 │ var dropperNode = new PHDropperNode( model.dropper, modelViewTransform ); 52 │ 62 │ dropperNode.setScaleMagnitude( DROPPER_SCALE ); 53 │ 63 │ var dropperFluidNode = new DropperFluidNode( model.dropper, model.beaker, DROPPER_SCALE * EyeDropperNode.TIP_WIDTH, modelViewTransform ); 54 │ 64 │ 55 │ 65 │ // faucets 56 │ 66 │ var waterFaucetNode = new WaterFaucetNode( model.waterFaucet, modelViewTransform ); 57 │ 67 │ var drainFaucetNode = new DrainFaucetNode( model.drainFaucet, modelViewTransform ); 58 │ 68 │ var WATER_FLUID_HEIGHT = model.beaker.location.y - model.waterFaucet.location.y; 59 │ 69 │ var DRAIN_FLUID_HEIGHT = 1000; // tall enough that resizing the play area is unlikely to show bottom of fluid - ..\ph-scale\js\micro\view\MicroView.js: 47-58 ..\ph-scale\js\mysolution\view\MySolutionView.js: 38-49 47 │ 38 │ function MicroView( model, modelViewTransform ) { 48 │ 39 │ 49 │ 40 │ ScreenView.call( this, PHScaleConstants.SCREEN_VIEW_OPTIONS ); 50 │ 41 │ 51 │ 42 │ // view-specific properties 52 │ 43 │ var viewProperties = new PHScaleViewProperties(); 53 │ 44 │ 54 │ 45 │ // beaker 55 │ 46 │ var beakerNode = new BeakerNode( model.beaker, modelViewTransform ); 56 │ 47 │ var solutionNode = new SolutionNode( model.solution, model.beaker, modelViewTransform ); 57 │ 48 │ var volumeIndicatorNode = new VolumeIndicatorNode( model.solution.volumeProperty, model.beaker, modelViewTransform ); 58 │ 49 │ - ..\ph-scale\js\micro\view\MicroView.js: 71-87 ..\ph-scale\js\mysolution\view\MySolutionView.js: 48-64 71 │ 48 │ var drainFluidNode = new FaucetFluidNode( model.drainFaucet, model.solution.colorProperty, DRAIN_FLUID_HEIGHT, modelViewTransform ); 72 │ 49 │ 73 │ 50 │ // 'H3O+/OH- ratio' representation 74 │ 51 │ var ratioNode = new RatioNode( model.beaker, model.solution, modelViewTransform, { visible: viewProperties.ratioVisibleProperty.get() } ); 75 │ 52 │ viewProperties.ratioVisibleProperty.linkAttribute( ratioNode, 'visible' ); 76 │ 53 │ 77 │ 54 │ // 'molecule count' representation 78 │ 55 │ var moleculeCountNode = new MoleculeCountNode( model.solution ); 79 │ 56 │ viewProperties.moleculeCountVisibleProperty.linkAttribute( moleculeCountNode, 'visible' ); 80 │ 57 │ 81 │ 58 │ // beaker controls 82 │ 59 │ var beakerControls = new BeakerControls( viewProperties.ratioVisibleProperty, viewProperties.moleculeCountVisibleProperty, 83 │ 60 │ { maxWidth: 0.85 * beakerNode.width } ); 84 │ 61 │ 85 │ 62 │ // graph 86 │ 63 │ var graphNode = new GraphNode( model.solution, viewProperties.graphExpandedProperty, { 87 │ 64 │ hasLinearFeature: true, - ..\estimation\js\estimation-config.js: 11-40 ..\ph-scale\js\ph-scale-config.js: 10-39 11 │ 10 │ deps: [ 'estimation-main' ], 12 │ 11 │ 13 │ 12 │ paths: { 14 │ 13 │ 15 │ 14 │ // third-party libs 16 │ 15 │ text: '../../sherpa/lib/text-2.0.12', 17 │ 16 │ 18 │ 17 │ // PhET plugins 19 │ 18 │ image: '../../chipper/js/requirejs-plugins/image', 20 │ 19 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 21 │ 20 │ string: '../../chipper/js/requirejs-plugins/string', 22 │ 21 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 23 │ 22 │ 24 │ 23 │ // PhET libs, uppercase names to identify them in require.js imports 25 │ 24 │ AXON: '../../axon/js', 26 │ 25 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 27 │ 26 │ DOT: '../../dot/js', 28 │ 27 │ JOIST: '../../joist/js', 29 │ 28 │ KITE: '../../kite/js', 30 │ 29 │ PHET_CORE: '../../phet-core/js', 31 │ 30 │ PHET_IO: '../../phet-io/js', 32 │ 31 │ PHETCOMMON: '../../phetcommon/js', 33 │ 32 │ REPOSITORY: '..', 34 │ 33 │ SCENERY: '../../scenery/js', 35 │ 34 │ SCENERY_PHET: '../../scenery-phet/js', 36 │ 35 │ SUN: '../../sun/js', 37 │ 36 │ TANDEM: '../../tandem/js', 38 │ 37 │ VIBE: '../../vibe/js', 39 │ 38 │ VEGAS: '../../vegas/js', 40 │ 39 │ - ..\build-a-molecule\tests\qunit\unit-tests.js: 3-16 ..\phet-core\tests\qunit\unit-tests.js: 3-16 3 │ 3 │ function runBuildAMoleculeTests( pathToTestBase ) { 4 │ 4 │ function loadTestFile( src ) { 5 │ 5 │ var script = document.createElement( 'script' ); 6 │ 6 │ script.type = 'text/javascript'; 7 │ 7 │ script.async = false; 8 │ 8 │ 9 │ 9 │ // make sure things aren't cached, just in case 10 │ 10 │ script.src = pathToTestBase + '/' + src + '?random=' + Math.random().toFixed( 10 ); 11 │ 11 │ 12 │ 12 │ document.getElementsByTagName( 'head' )[ 0 ].appendChild( script ); 13 │ 13 │ } 14 │ 14 │ 15 │ 15 │ loadTestFile( 'js/model.js' ); 16 │ 16 │ }; - ..\build-a-molecule\tests\qunit\unit-tests.js: 3-16 ..\phetcommon\tests\qunit\unit-tests.js: 3-16 3 │ 3 │ function runBuildAMoleculeTests( pathToTestBase ) { 4 │ 4 │ function loadTestFile( src ) { 5 │ 5 │ var script = document.createElement( 'script' ); 6 │ 6 │ script.type = 'text/javascript'; 7 │ 7 │ script.async = false; 8 │ 8 │ 9 │ 9 │ // make sure things aren't cached, just in case 10 │ 10 │ script.src = pathToTestBase + '/' + src + '?random=' + Math.random().toFixed( 10 ); 11 │ 11 │ 12 │ 12 │ document.getElementsByTagName( 'head' )[ 0 ].appendChild( script ); 13 │ 13 │ } 14 │ 14 │ 15 │ 15 │ loadTestFile( 'js/model.js' ); 16 │ 16 │ }; - ..\phet-io\js\simulations\build-an-atom\build-an-atom-api.js: 84-99 ..\phet-io\js\simulations\build-an-atom\build-an-atom-api.js: 111-126 84 │ 111 │ atomScreen: { 85 │ 112 │ model: { 86 │ 113 │ protons: TGroup( TParticle ), 87 │ 114 │ neutrons: TGroup( TParticle ), 88 │ 115 │ electrons: TGroup( TParticle ) 89 │ 116 │ }, 90 │ 117 │ view: { 91 │ 118 │ bucket: TGroup( TObject ), 92 │ 119 │ labelVisualizationControlPanel: TVerticalCheckBoxGroup.extend( { 93 │ 120 │ showElementNameCheckBox: TCheckBox, 94 │ 121 │ showNeutralOrIonCheckBox: TCheckBox, 95 │ 122 │ showStableOrUnstableCheckBox: TCheckBox 96 │ 123 │ } ), 97 │ 124 │ orbitsRadioButton: TRadioButton( TString ), 98 │ 125 │ cloudRadioButton: TRadioButton( TString ), 99 │ 126 │ periodicTableAndSymbol: { - ..\phet-io\js\types\axon\TDerivedProperty.js: 4-19 ..\phet-io\js\types\axon\TProperty.js: 3-18 4 │ 3 │ * 5 │ 4 │ * @author Sam Reid (PhET Interactive Simulations) 6 │ 5 │ * @author Andrew Adare (PhET Interactive Simulations) 7 │ 6 │ */ 8 │ 7 │ define( function( require ) { 9 │ 8 │ 'use strict'; 10 │ 9 │ 11 │ 10 │ // modules 12 │ 11 │ var assertInstanceOf = require( 'PHET_IO/assertions/assertInstanceOf' ); 13 │ 12 │ var phetioInherit = require( 'PHET_IO/phetioInherit' ); 14 │ 13 │ var phetioNamespace = require( 'PHET_IO/phetioNamespace' ); 15 │ 14 │ var TFunctionWrapper = require( 'PHET_IO/types/TFunctionWrapper' ); 16 │ 15 │ var TObject = require( 'PHET_IO/types/TObject' ); 17 │ 16 │ var toEventOnEmit = require( 'PHET_IO/events/toEventOnEmit' ); 18 │ 17 │ var TVoid = require( 'PHET_IO/types/TVoid' ); 19 │ 18 │ - ..\phet-io\wrappers\classroom-activity\forces-and-motion-basics\forces-and-motion-basics.js: 76-89 ..\phet-io\wrappers\classroom-activity\forces-and-motion-basics\forces-and-motion-basics.js: 95-108 76 │ 95 │ explore: [ 77 │ 96 │ // Reset pullers to original location 78 │ 97 │ { phetioID: 'forcesAndMotionBasics.netForceScreen.model', method: 'reset', args: [] }, 79 │ 98 │ // Show Checkbox panel, volume control, and reset all button 80 │ 99 │ { phetioID: 'forcesAndMotionBasics.netForceScreen.view.controlPanel', method: 'setVisible', args: [ true ] }, 81 │ 100 │ // Go button 82 │ 101 │ { phetioID: 'forcesAndMotionBasics.netForceScreen.view.goPauseButton', method: 'setVisible', args: [ true ] }, 83 │ 102 │ // Return button 84 │ 103 │ { phetioID: 'forcesAndMotionBasics.netForceScreen.view.returnButton', method: 'setVisible', args: [ true ] }, 85 │ 104 │ // Show left force arrow 86 │ 105 │ { phetioID: 'forcesAndMotionBasics.netForceScreen.view.leftArrow', method: 'setVisible', args: [ true ] }, 87 │ 106 │ // Show right force arrow 88 │ 107 │ { phetioID: 'forcesAndMotionBasics.netForceScreen.view.rightArrow', method: 'setVisible', args: [ true ] }, 89 │ 108 │ // Enable the sim - ..\phet-io\wrappers\classroom-activity\forces-and-motion-basics\forces-and-motion-basics.js: 76-89 ..\phet-io\wrappers\classroom-activity\forces-and-motion-basics\forces-and-motion-basics.js: 112-125 76 │ 112 │ explore: [ 77 │ 113 │ // Reset pullers to original location 78 │ 114 │ { phetioID: 'forcesAndMotionBasics.netForceScreen.model', method: 'reset', args: [] }, 79 │ 115 │ // Show Checkbox panel, volume control, and reset all button 80 │ 116 │ { phetioID: 'forcesAndMotionBasics.netForceScreen.view.controlPanel', method: 'setVisible', args: [ true ] }, 81 │ 117 │ // Go button 82 │ 118 │ { phetioID: 'forcesAndMotionBasics.netForceScreen.view.goPauseButton', method: 'setVisible', args: [ true ] }, 83 │ 119 │ // Return button 84 │ 120 │ { phetioID: 'forcesAndMotionBasics.netForceScreen.view.returnButton', method: 'setVisible', args: [ true ] }, 85 │ 121 │ // Show left force arrow 86 │ 122 │ { phetioID: 'forcesAndMotionBasics.netForceScreen.view.leftArrow', method: 'setVisible', args: [ true ] }, 87 │ 123 │ // Show right force arrow 88 │ 124 │ { phetioID: 'forcesAndMotionBasics.netForceScreen.view.rightArrow', method: 'setVisible', args: [ true ] }, 89 │ 125 │ // Enable the sim - ..\chipper\eslint\rules\string-require-statement-match.js: 22-36 ..\phet-io\wrappers\common\js\WrapperUtils.js: 31-45 22 │ 31 │ withWhitespaceAfterDigits.split( ' ' ).forEach( function( element, index ) { 23 │ 32 │ out += (index === 0 ? element : element[ 0 ].toUpperCase() + element.slice( 1 )); 24 │ 33 │ } ); 25 │ 34 │ 26 │ 35 │ // lowercase the first character 27 │ 36 │ if ( out.length > 1 ) { 28 │ 37 │ out = out.charAt( 0 ).toLowerCase() + out.slice( 1 ); 29 │ 38 │ } 30 │ 39 │ else if ( out.length === 1 ) { 31 │ 40 │ out = out.toLowerCase(); 32 │ 41 │ } 33 │ 42 │ 34 │ 43 │ return out; 35 │ 44 │ } 36 │ 45 │ - ..\phet-io\wrappers\common\js\dataTable.js: 201-212 ..\phet-io\wrappers\lab-book\lab-book.js: 338-349 201 │ 338 │ var leftPictureSpan = document.createElement( 'span' ); 202 │ 339 │ leftPictureSpan.appendChild( dataPoint.image ); 203 │ 340 │ 204 │ 341 │ var restoreButton = createPhetioElement( 'restoreButton', trialNumber ); 205 │ 342 │ restoreButton.className += ' fa-play-circle'; 206 │ 343 │ 207 │ 344 │ var rightPictureSpan = document.createElement( 'span' ); 208 │ 345 │ rightPictureSpan.appendChild( restoreButton ); 209 │ 346 │ var pictureDiv = document.createElement( 'div' ); 210 │ 347 │ pictureDiv.appendChild( leftPictureSpan ); 211 │ 348 │ pictureDiv.appendChild( rightPictureSpan ); 212 │ 349 │ cell.classList.add( 'screenshot' ); - ..\phet-io\wrappers\playback\playback-deprecated.js: 31-49 ..\phet-io\wrappers\playback\playSession.js: 13-31 31 │ 13 │ // Linearize to make sure all data points are present 32 │ 14 │ var indices = []; 33 │ 15 │ var action = function( event ) { 34 │ 16 │ indices.push( event.messageIndex ); 35 │ 17 │ }; 36 │ 18 │ var visit = function( event ) { 37 │ 19 │ action( event ); 38 │ 20 │ event.children && event.children.forEach( visit ); 39 │ 21 │ }; 40 │ 22 │ eventStream.forEach( visit ); 41 │ 23 │ 42 │ 24 │ for ( var i = 0; i < indices.length; i++ ) { 43 │ 25 │ assert && assert( i === indices[ i ], 'wrong index at ' + i ); 44 │ 26 │ } 45 │ 27 │ console.log( 'validated ' + indices.length + ' points, all are in order' ); 46 │ 28 │ }; 47 │ 29 │ 48 │ 30 │ var loadSocketIOEventLog = function( socketioFilename, callback ) { 49 │ 31 │ assert && assert( socketioFilename, 'filename is required' ); - ..\estimation\js\common\view\CylinderView.js: 49-55 ..\plinko-probability\js\intro\view\CylindersFrontNode.js: 42-48 49 │ 42 │ shape.moveTo( -ellipseWidth / 2, 0 ) 50 │ 43 │ .lineTo( -ellipseWidth / 2, cylinderHeight ) 51 │ 44 │ .ellipticalArc( 0, 0, ellipseWidth / 2, ellipseHeight / 2, 0, Math.PI, 0, true ) 52 │ 45 │ .lineTo( ellipseWidth / 2, 0 ) 53 │ 46 │ .ellipticalArc( 0, cylinderHeight, ellipseWidth / 2, ellipseHeight / 2, 0, 0, Math.PI, false ) 54 │ 47 │ .close(); 55 │ 48 │ side.setShape( shape ); - ..\area-builder\js\area-builder-config.js: 10-39 ..\plinko-probability\js\plinko-probability-config.js: 10-39 10 │ 10 │ deps: [ 'area-builder-main' ], 11 │ 11 │ 12 │ 12 │ paths: { 13 │ 13 │ 14 │ 14 │ // third-party libs 15 │ 15 │ text: '../../sherpa/lib/text-2.0.12', 16 │ 16 │ 17 │ 17 │ // PhET plugins 18 │ 18 │ audio: '../../chipper/js/requirejs-plugins/audio', 19 │ 19 │ image: '../../chipper/js/requirejs-plugins/image', 20 │ 20 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 21 │ 21 │ string: '../../chipper/js/requirejs-plugins/string', 22 │ 22 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 23 │ 23 │ 24 │ 24 │ // PhET libs, uppercase names to identify them in require.js imports 25 │ 25 │ AXON: '../../axon/js', 26 │ 26 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 27 │ 27 │ DOT: '../../dot/js', 28 │ 28 │ JOIST: '../../joist/js', 29 │ 29 │ KITE: '../../kite/js', 30 │ 30 │ PHET_CORE: '../../phet-core/js', 31 │ 31 │ PHET_IO: '../../phet-io/js', 32 │ 32 │ PHETCOMMON: '../../phetcommon/js', 33 │ 33 │ REPOSITORY: '..', 34 │ 34 │ SCENERY: '../../scenery/js', 35 │ 35 │ SCENERY_PHET: '../../scenery-phet/js', 36 │ 36 │ SHERPA: '../../sherpa', 37 │ 37 │ SUN: '../../sun/js', 38 │ 38 │ TANDEM: '../../tandem/js', 39 │ 39 │ VIBE: '../../vibe/js', - ..\energy-skate-park-basics\js\energy-skate-park-basics\view\EnergySkateParkBasicsScreenView.js: 437-460 ..\projectile-motion\js\common\view\ProjectileMotionScreenView.js: 267-290 437 │ 267 │ layout: function( width, height ) { 438 │ 268 │ 439 │ 269 │ this.resetTransform(); 440 │ 270 │ 441 │ 271 │ var scale = this.getLayoutScale( width, height ); 442 │ 272 │ this.setScaleMagnitude( scale ); 443 │ 273 │ 444 │ 274 │ var offsetX = 0; 445 │ 275 │ var offsetY = 0; 446 │ 276 │ 447 │ 277 │ // Move to bottom vertically 448 │ 278 │ if ( scale === width / this.layoutBounds.width ) { 449 │ 279 │ offsetY = (height / scale - this.layoutBounds.height); 450 │ 280 │ } 451 │ 281 │ 452 │ 282 │ // center horizontally 453 │ 283 │ else if ( scale === height / this.layoutBounds.height ) { 454 │ 284 │ offsetX = (width - this.layoutBounds.width * scale) / 2 / scale; 455 │ 285 │ } 456 │ 286 │ this.translate( offsetX, offsetY ); 457 │ 287 │ 458 │ 288 │ this.backgroundNode.layout( offsetX, offsetY, width, height, scale ); 459 │ 289 │ this.gridNode.layout( offsetX, offsetY, width, height, scale ); 460 │ 290 │ - ..\projectile-motion\js\common\view\ToolboxPanel.js: 87-105 ..\projectile-motion\js\common\view\ToolboxPanel.js: 149-167 87 │ 149 │ tracerIconNode.addInputListener( { 88 │ 150 │ down: function( event ) { 89 │ 151 │ // find the parent screen if not already found by moving up the scene graph 90 │ 152 │ if ( !parentScreenView ) { 91 │ 153 │ var testNode = self; 92 │ 154 │ while ( testNode !== null ) { 93 │ 155 │ if ( testNode instanceof ScreenView ) { 94 │ 156 │ parentScreenView = testNode; 95 │ 157 │ break; 96 │ 158 │ } 97 │ 159 │ testNode = testNode.parents[ 0 ]; // move up the scene graph by one level 98 │ 160 │ } 99 │ 161 │ assert && assert( parentScreenView, 'unable to find parent screen view' ); 100 │ 162 │ } 101 │ 163 │ // Ignore non-left-mouse-button 102 │ 164 │ if ( event.pointer.isMouse && event.domEvent.button !== 0 ) { 103 │ 165 │ return; 104 │ 166 │ } 105 │ 167 │ - ..\projectile-motion\js\common\view\TracerNode.js: 87-102 ..\projectile-motion\js\common\view\TracerNode.js: 226-241 87 │ 226 │ rectangle.addInputListener( this.movableDragHandler ); 88 │ 227 │ 89 │ 228 │ // crosshair view 90 │ 229 │ var crosshairShape = new Shape() 91 │ 230 │ .moveTo( -CIRCLE_RADIUS, 0 ) 92 │ 231 │ .lineTo( CIRCLE_RADIUS, 0 ) 93 │ 232 │ .moveTo( 0, -CIRCLE_RADIUS ) 94 │ 233 │ .lineTo( 0, CIRCLE_RADIUS ); 95 │ 234 │ 96 │ 235 │ var crosshair = new Path( crosshairShape, { stroke: 'black' } ); 97 │ 236 │ var circle = new Circle( CIRCLE_RADIUS, { lineWidth: 2, stroke: 'black', fill: TRANSPARENT_WHITE } ); 98 │ 237 │ 99 │ 238 │ // Create the base of the crosshair 100 │ 239 │ var crosshairMount = new Rectangle( 0, 0, 0.4 * CIRCLE_RADIUS, 0.4 * CIRCLE_RADIUS, { fill: 'gray' } ); 101 │ 240 │ 102 │ 241 │ var timeReadoutProperty = new Property( '-' ); - ..\neuron\js\neuron\view\ZoomControl.js: 35-47 ..\projectile-motion\js\common\view\ZoomControl.js: 34-46 35 │ 34 │ }; 36 │ 35 │ var zoomSlider = new HSlider( zoomProperty, { min: minZoom, max: maxZoom }, zoomSliderOptions ); 37 │ 36 │ zoomSlider.rotation = -Math.PI / 2; 38 │ 37 │ 39 │ 38 │ function createZoomControlButton( contentNode, marginOptions, listener ) { 40 │ 39 │ return new RectangularPushButton( { 41 │ 40 │ content: contentNode, 42 │ 41 │ cornerRadius: 2, 43 │ 42 │ xMargin: marginOptions.xMargin, 44 │ 43 │ yMargin: marginOptions.yMargin, 45 │ 44 │ baseColor: 'white', 46 │ 45 │ listener: listener, 47 │ 46 │ touchAreaXDilation: 5, - ..\neuron\js\neuron\view\ZoomControl.js: 49-97 ..\projectile-motion\js\common\view\ZoomControl.js: 46-94 49 │ 46 │ } ); 50 │ 47 │ } 51 │ 48 │ 52 │ 49 │ var sideLength = 24; // length of one side of the button, empirically determined 53 │ 50 │ var symbolLength = 0.5 * sideLength; 54 │ 51 │ var symbolLineWidth = 0.12 * sideLength; 55 │ 52 │ 56 │ 53 │ var plusSymbolShape = new Shape() 57 │ 54 │ .moveTo( symbolLength / 2, 0 ) 58 │ 55 │ .lineTo( symbolLength / 2, symbolLength ) 59 │ 56 │ .moveTo( 0, symbolLength / 2 ) 60 │ 57 │ .lineTo( symbolLength, symbolLength / 2 ); 61 │ 58 │ 62 │ 59 │ var minusSymbolShape = new Shape() 63 │ 60 │ .moveTo( -symbolLength / 2, 0 ) 64 │ 61 │ .lineTo( symbolLength / 2, 0 ); 65 │ 62 │ 66 │ 63 │ var symbolOptions = { 67 │ 64 │ lineWidth: symbolLineWidth, 68 │ 65 │ stroke: 'black', 69 │ 66 │ centerX: sideLength / 2, 70 │ 67 │ centerY: sideLength / 2 71 │ 68 │ }; 72 │ 69 │ 73 │ 70 │ var plusButton = createZoomControlButton( new Path( plusSymbolShape, symbolOptions ), { xMargin: 6, yMargin: 6 }, function() { 74 │ 71 │ zoomProperty.set( Util.clamp( zoomProperty.value + 0.1, minZoom, maxZoom ) ); 75 │ 72 │ } ); 76 │ 73 │ 77 │ 74 │ var minusButton = createZoomControlButton( new Path( minusSymbolShape, symbolOptions ), { xMargin: 6, yMargin: 10 }, function() { 78 │ 75 │ zoomProperty.set( Util.clamp( zoomProperty.value - 0.1, minZoom, maxZoom ) ); 79 │ 76 │ } ); 80 │ 77 │ 81 │ 78 │ // Temporarily set the zoom to a value that puts the knob roughly half way up so that the initial layout of the 82 │ 79 │ // VBox will work. 83 │ 80 │ var originalZoomValue = zoomProperty.value; 84 │ 81 │ zoomProperty.set( 4 ); 85 │ 82 │ 86 │ 83 │ // vertical panel 87 │ 84 │ VBox.call( this, { 88 │ 85 │ children: [ plusButton, zoomSlider, minusButton ], 89 │ 86 │ align: 'center', 90 │ 87 │ resize: false, 91 │ 88 │ spacing: 12 92 │ 89 │ } ); 93 │ 90 │ 94 │ 91 │ // restore the zoom to its original value 95 │ 92 │ zoomProperty.set( originalZoomValue ); 96 │ 93 │ } 97 │ 94 │ - ..\projectile-motion\js\drag\view\ProjectilePanel.js: 23-45 ..\projectile-motion\js\intro\view\IntroSecondPanel.js: 21-43 23 │ 21 │ var ProjectileObjectViewFactory = require( 'PROJECTILE_MOTION/common/view/ProjectileObjectViewFactory' ); 24 │ 22 │ var Rectangle = require( 'SCENERY/nodes/Rectangle' ); 25 │ 23 │ var StringUtils = require( 'PHETCOMMON/util/StringUtils' ); 26 │ 24 │ var Text = require( 'SCENERY/nodes/Text' ); 27 │ 25 │ var VBox = require( 'SCENERY/nodes/VBox' ); 28 │ 26 │ 29 │ 27 │ // strings 30 │ 28 │ var pattern0Label1UnitsString = require( 'string!PROJECTILE_MOTION/pattern0Label1Units' ); 31 │ 29 │ var massString = require( 'string!PROJECTILE_MOTION/mass' ); 32 │ 30 │ var kgString = require( 'string!PROJECTILE_MOTION/kg' ); 33 │ 31 │ var diameterString = require( 'string!PROJECTILE_MOTION/diameter' ); 34 │ 32 │ var mString = require( 'string!PROJECTILE_MOTION/m' ); 35 │ 33 │ var dragCoefficientString = require( 'string!PROJECTILE_MOTION/dragCoefficient' ); 36 │ 34 │ var airResistanceString = require( 'string!PROJECTILE_MOTION/airResistance' ); 37 │ 35 │ 38 │ 36 │ // constants 39 │ 37 │ var LABEL_OPTIONS = ProjectileMotionConstants.PANEL_LABEL_OPTIONS; 40 │ 38 │ var BIGGER_LABEL_OPTIONS = ProjectileMotionConstants.PANEL_BIGGER_LABEL_OPTIONS; 41 │ 39 │ var TEXT_BACKGROUND_OPTIONS = { 42 │ 40 │ fill: 'white', 43 │ 41 │ stroke: 'black' 44 │ 42 │ }; 45 │ 43 │ var DRAG_OBJECT_DISPLAY_RADIUS = 12; - ..\projectile-motion\js\intro\view\IntroSecondPanel.js: 125-143 ..\projectile-motion\js\lab\view\LabSecondPanel.js: 90-108 125 │ 90 │ ); 126 │ 91 │ 127 │ 92 │ // text node updates if property value changes 128 │ 93 │ property.link( function( value ) { 129 │ 94 │ valueText.setText( value ); 130 │ 95 │ valueText.center = backgroundNode.center; 131 │ 96 │ } ); 132 │ 97 │ 133 │ 98 │ var valueNode = new Node( { children: [ backgroundNode, valueText ] } ); 134 │ 99 │ 135 │ 100 │ var xSpacing = options.minWidth - 2 * options.xMargin - parameterLabel.width - valueNode.width; 136 │ 101 │ 137 │ 102 │ return new HBox( { spacing: xSpacing, children: [ parameterLabel, valueNode ] } ); 138 │ 103 │ } 139 │ 104 │ 140 │ 105 │ var massBox = createParameterControlBox( 141 │ 106 │ massString, 142 │ 107 │ kgString, 143 │ 108 │ projectileMotionIntroModel.projectileMassProperty, - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-44 ..\projectile-motion\js\projectile-motion-config.js: 10-43 11 │ 10 │ deps: [ 'area-model-multiplication-main' ], 12 │ 11 │ 13 │ 12 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 13 │ 15 │ 14 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 15 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 16 │ paths: { 18 │ 17 │ 19 │ 18 │ // third-party libs 20 │ 19 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 20 │ 22 │ 21 │ // PhET plugins 23 │ 22 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 23 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 24 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 25 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 26 │ 28 │ 27 │ // common directories, uppercase names to identify them in require imports 29 │ 28 │ AXON: '../../axon/js', 30 │ 29 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 30 │ DOT: '../../dot/js', 32 │ 31 │ JOIST: '../../joist/js', 33 │ 32 │ KITE: '../../kite/js', 34 │ 33 │ PHET_CORE: '../../phet-core/js', 35 │ 34 │ PHET_IO: '../../phet-io/js', 36 │ 35 │ PHETCOMMON: '../../phetcommon/js', 37 │ 36 │ REPOSITORY: '..', 38 │ 37 │ SCENERY: '../../scenery/js', 39 │ 38 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 39 │ SUN: '../../sun/js', 41 │ 40 │ TANDEM: '../../tandem/js', 42 │ 41 │ 43 │ 42 │ // this sim 44 │ 43 │ AREA_MODEL_MULTIPLICATION: '.' - ..\proportion-playground\js\explore\ExploreScreen.js: 4-22 ..\proportion-playground\js\predict\PredictScreen.js: 4-22 4 │ 4 │ * 5 │ 5 │ * @author Sam Reid (PhET Interactive Simulations) 6 │ 6 │ */ 7 │ 7 │ define( function( require ) { 8 │ 8 │ 'use strict'; 9 │ 9 │ 10 │ 10 │ // modules 11 │ 11 │ var ProportionModel = require( 'PROPORTION_PLAYGROUND/common/model/ProportionModel' ); 12 │ 12 │ var ProportionScreenView = require( 'PROPORTION_PLAYGROUND/common/view/ProportionScreenView' ); 13 │ 13 │ var inherit = require( 'PHET_CORE/inherit' ); 14 │ 14 │ var Screen = require( 'JOIST/Screen' ); 15 │ 15 │ var proportionPlayground = require( 'PROPORTION_PLAYGROUND/proportionPlayground' ); 16 │ 16 │ var ProportionPlaygroundConstants = require( 'PROPORTION_PLAYGROUND/ProportionPlaygroundConstants' ); 17 │ 17 │ var Property = require( 'AXON/Property' ); 18 │ 18 │ var Color = require( 'SCENERY/util/Color' ); 19 │ 19 │ 20 │ 20 │ // strings 21 │ 21 │ var exploreString = require( 'string!PROPORTION_PLAYGROUND/explore' ); 22 │ 22 │ - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-44 ..\proportion-playground\js\proportion-playground-config.js: 11-44 11 │ 11 │ deps: [ 'area-model-multiplication-main' ], 12 │ 12 │ 13 │ 13 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 14 │ 15 │ 15 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 16 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 17 │ paths: { 18 │ 18 │ 19 │ 19 │ // third-party libs 20 │ 20 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 21 │ 22 │ 22 │ // PhET plugins 23 │ 23 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 24 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 25 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 26 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 27 │ 28 │ 28 │ // common directories, uppercase names to identify them in require imports 29 │ 29 │ AXON: '../../axon/js', 30 │ 30 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 31 │ DOT: '../../dot/js', 32 │ 32 │ JOIST: '../../joist/js', 33 │ 33 │ KITE: '../../kite/js', 34 │ 34 │ PHET_CORE: '../../phet-core/js', 35 │ 35 │ PHET_IO: '../../phet-io/js', 36 │ 36 │ PHETCOMMON: '../../phetcommon/js', 37 │ 37 │ REPOSITORY: '..', 38 │ 38 │ SCENERY: '../../scenery/js', 39 │ 39 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 40 │ SUN: '../../sun/js', 41 │ 41 │ TANDEM: '../../tandem/js', 42 │ 42 │ 43 │ 43 │ // this sim 44 │ 44 │ AREA_MODEL_MULTIPLICATION: '.' - ..\protein-synthesis\js\protein-synthesis\view\TRNANode.js: 117-129 ..\protein-synthesis\js\protein-synthesis\view\TRNANode.js: 145-157 117 │ 145 │ var self = this; 118 │ 146 │ var screenView = this.screenView; 119 │ 147 │ 120 │ 148 │ var proposedBodyCenter = screenView.worldNode.globalToLocalPoint( event.pointer.point ); 121 │ 149 │ 122 │ 150 │ var snapped = false; 123 │ 151 │ //TODO: make sure types are compatible (AT, GC) 124 │ 152 │ var connectionPoints = screenView.connectionModel.getConnectionPointsForTRNA( screenView, self ); 125 │ 153 │ if ( connectionPoints.length > 0 ) { 126 │ 154 │ var closestConnectionPoint = _.min( connectionPoints, function( connectionPoint ) {return connectionPoint.point.distance( proposedBodyCenter );} ); 127 │ 155 │ var newPoint = closestConnectionPoint.point.plusXY( 85 - screenView.viewProperties.numAminoAcids * BaseShape.BODY_WIDTH * 3 * BaseNode.fullSize, 60 ); 128 │ 156 │ var distance = newPoint.distance( proposedBodyCenter ); 129 │ 157 │ if ( distance < 30 ) { - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-44 ..\protein-synthesis\js\protein-synthesis-config.js: 10-43 11 │ 10 │ deps: [ 'area-model-multiplication-main' ], 12 │ 11 │ 13 │ 12 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 13 │ 15 │ 14 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 15 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 16 │ paths: { 18 │ 17 │ 19 │ 18 │ // third-party libs 20 │ 19 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 20 │ 22 │ 21 │ // PhET plugins 23 │ 22 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 23 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 24 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 25 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 26 │ 28 │ 27 │ // common directories, uppercase names to identify them in require imports 29 │ 28 │ AXON: '../../axon/js', 30 │ 29 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 30 │ DOT: '../../dot/js', 32 │ 31 │ JOIST: '../../joist/js', 33 │ 32 │ KITE: '../../kite/js', 34 │ 33 │ PHET_CORE: '../../phet-core/js', 35 │ 34 │ PHET_IO: '../../phet-io/js', 36 │ 35 │ PHETCOMMON: '../../phetcommon/js', 37 │ 36 │ REPOSITORY: '..', 38 │ 37 │ SCENERY: '../../scenery/js', 39 │ 38 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 39 │ SUN: '../../sun/js', 41 │ 40 │ TANDEM: '../../tandem/js', 42 │ 41 │ 43 │ 42 │ // this sim 44 │ 43 │ AREA_MODEL_MULTIPLICATION: '.' - ..\balancing-chemical-equations\js\common\model\MoleculeFactory.js: 28-50 ..\reactants-products-and-leftovers\js\common\model\ReactionFactory.js: 35-57 28 │ 35 │ var Cl2Node = require( 'NITROGLYCERIN/nodes/Cl2Node' ); 29 │ 36 │ var F2Node = require( 'NITROGLYCERIN/nodes/F2Node' ); 30 │ 37 │ var H2Node = require( 'NITROGLYCERIN/nodes/H2Node' ); 31 │ 38 │ var H2ONode = require( 'NITROGLYCERIN/nodes/H2ONode' ); 32 │ 39 │ var H2SNode = require( 'NITROGLYCERIN/nodes/H2SNode' ); 33 │ 40 │ var HClNode = require( 'NITROGLYCERIN/nodes/HClNode' ); 34 │ 41 │ var HFNode = require( 'NITROGLYCERIN/nodes/HFNode' ); 35 │ 42 │ var N2Node = require( 'NITROGLYCERIN/nodes/N2Node' ); 36 │ 43 │ var N2ONode = require( 'NITROGLYCERIN/nodes/N2ONode' ); 37 │ 44 │ var NH3Node = require( 'NITROGLYCERIN/nodes/NH3Node' ); 38 │ 45 │ var NO2Node = require( 'NITROGLYCERIN/nodes/NO2Node' ); 39 │ 46 │ var NONode = require( 'NITROGLYCERIN/nodes/NONode' ); 40 │ 47 │ var O2Node = require( 'NITROGLYCERIN/nodes/O2Node' ); 41 │ 48 │ var OF2Node = require( 'NITROGLYCERIN/nodes/OF2Node' ); 42 │ 49 │ var P4Node = require( 'NITROGLYCERIN/nodes/P4Node' ); 43 │ 50 │ var PCl3Node = require( 'NITROGLYCERIN/nodes/PCl3Node' ); 44 │ 51 │ var PCl5Node = require( 'NITROGLYCERIN/nodes/PCl5Node' ); 45 │ 52 │ var PF3Node = require( 'NITROGLYCERIN/nodes/PF3Node' ); 46 │ 53 │ var PH3Node = require( 'NITROGLYCERIN/nodes/PH3Node' ); 47 │ 54 │ var SNode = require( 'NITROGLYCERIN/nodes/SNode' ); 48 │ 55 │ var SO2Node = require( 'NITROGLYCERIN/nodes/SO2Node' ); 49 │ 56 │ var SO3Node = require( 'NITROGLYCERIN/nodes/SO3Node' ); 50 │ 57 │ - ..\reactants-products-and-leftovers\js\common\model\ReactionFactory.js: 23-60 ..\reactants-products-and-leftovers\js\common\view\MoleculeNodes.js: 15-52 23 │ 15 │ var C2H2Node = require( 'NITROGLYCERIN/nodes/C2H2Node' ); 24 │ 16 │ var C2H4Node = require( 'NITROGLYCERIN/nodes/C2H4Node' ); 25 │ 17 │ var C2H5ClNode = require( 'NITROGLYCERIN/nodes/C2H5ClNode' ); 26 │ 18 │ var C2H5OHNode = require( 'NITROGLYCERIN/nodes/C2H5OHNode' ); 27 │ 19 │ var C2H6Node = require( 'NITROGLYCERIN/nodes/C2H6Node' ); 28 │ 20 │ var CH2ONode = require( 'NITROGLYCERIN/nodes/CH2ONode' ); 29 │ 21 │ var CH3OHNode = require( 'NITROGLYCERIN/nodes/CH3OHNode' ); 30 │ 22 │ var CH4Node = require( 'NITROGLYCERIN/nodes/CH4Node' ); 31 │ 23 │ var Cl2Node = require( 'NITROGLYCERIN/nodes/Cl2Node' ); 32 │ 24 │ var CNode = require( 'NITROGLYCERIN/nodes/CNode' ); 33 │ 25 │ var CO2Node = require( 'NITROGLYCERIN/nodes/CO2Node' ); 34 │ 26 │ var CONode = require( 'NITROGLYCERIN/nodes/CONode' ); 35 │ 27 │ var CS2Node = require( 'NITROGLYCERIN/nodes/CS2Node' ); 36 │ 28 │ var F2Node = require( 'NITROGLYCERIN/nodes/F2Node' ); 37 │ 29 │ var H2Node = require( 'NITROGLYCERIN/nodes/H2Node' ); 38 │ 30 │ var H2ONode = require( 'NITROGLYCERIN/nodes/H2ONode' ); 39 │ 31 │ var H2SNode = require( 'NITROGLYCERIN/nodes/H2SNode' ); 40 │ 32 │ var HClNode = require( 'NITROGLYCERIN/nodes/HClNode' ); 41 │ 33 │ var HFNode = require( 'NITROGLYCERIN/nodes/HFNode' ); 42 │ 34 │ var N2Node = require( 'NITROGLYCERIN/nodes/N2Node' ); 43 │ 35 │ var N2ONode = require( 'NITROGLYCERIN/nodes/N2ONode' ); 44 │ 36 │ var NH3Node = require( 'NITROGLYCERIN/nodes/NH3Node' ); 45 │ 37 │ var NO2Node = require( 'NITROGLYCERIN/nodes/NO2Node' ); 46 │ 38 │ var NONode = require( 'NITROGLYCERIN/nodes/NONode' ); 47 │ 39 │ var O2Node = require( 'NITROGLYCERIN/nodes/O2Node' ); 48 │ 40 │ var OF2Node = require( 'NITROGLYCERIN/nodes/OF2Node' ); 49 │ 41 │ var P4Node = require( 'NITROGLYCERIN/nodes/P4Node' ); 50 │ 42 │ var PCl3Node = require( 'NITROGLYCERIN/nodes/PCl3Node' ); 51 │ 43 │ var PCl5Node = require( 'NITROGLYCERIN/nodes/PCl5Node' ); 52 │ 44 │ var PF3Node = require( 'NITROGLYCERIN/nodes/PF3Node' ); 53 │ 45 │ var PH3Node = require( 'NITROGLYCERIN/nodes/PH3Node' ); 54 │ 46 │ var SNode = require( 'NITROGLYCERIN/nodes/SNode' ); 55 │ 47 │ var SO2Node = require( 'NITROGLYCERIN/nodes/SO2Node' ); 56 │ 48 │ var SO3Node = require( 'NITROGLYCERIN/nodes/SO3Node' ); 57 │ 49 │ 58 │ 50 │ // strings 59 │ 51 │ var combustMethaneString = require( 'string!REACTANTS_PRODUCTS_AND_LEFTOVERS/combustMethane' ); 60 │ 52 │ var makeAmmoniaString = require( 'string!REACTANTS_PRODUCTS_AND_LEFTOVERS/makeAmmonia' ); - ..\reactants-products-and-leftovers\js\common\model\Reaction.js: 54-62 ..\reactants-products-and-leftovers\js\game\model\GameGuess.js: 71-79 54 │ 71 │ return inherit( Object, Reaction, { 55 │ 72 │ 56 │ 73 │ // @public 57 │ 74 │ reset: function() { 58 │ 75 │ this.reactants.forEach( function( reactant ) { reactant.reset(); } ); 59 │ 76 │ this.products.forEach( function( product ) { product.reset(); } ); 60 │ 77 │ this.leftovers.forEach( function( leftover ) { leftover.reset(); } ); 61 │ 78 │ }, 62 │ 79 │ - ..\graphing-lines\js\linegame\model\LineGameModel.js: 226-250 ..\reactants-products-and-leftovers\js\game\model\GameModel.js: 202-226 226 │ 202 │ }, 227 │ 203 │ 228 │ 204 │ // @private Updates the best time for the current level, at the end of a timed game with a perfect score. 229 │ 205 │ updateBestTime: function() { 230 │ 206 │ assert && assert( !this.timer.isRunning ); 231 │ 207 │ if ( this.timerEnabledProperty.get() && this.isPerfectScore() ) { 232 │ 208 │ var level = this.levelProperty.get(); 233 │ 209 │ var time = this.timer.elapsedTime; 234 │ 210 │ this.isNewBestTime = false; 235 │ 211 │ if ( !this.bestTimeProperties[ level ].get() ) { 236 │ 212 │ // there was no previous time for this level 237 │ 213 │ this.bestTimeProperties[ level ].set( time ); 238 │ 214 │ } 239 │ 215 │ else if ( time < this.bestTimeProperties[ level ].get() ) { 240 │ 216 │ // we have a new best time for this level 241 │ 217 │ this.bestTimeProperties[ level ].set( time ); 242 │ 218 │ this.isNewBestTime = true; 243 │ 219 │ } 244 │ 220 │ } 245 │ 221 │ }, 246 │ 222 │ 247 │ 223 │ // @private initializes a new set of challenges for the current level 248 │ 224 │ initChallenges: function() { 249 │ 225 │ this.challengeIndexProperty.set( -1 ); 250 │ 226 │ var level = this.levelProperty.get(); - ..\beers-law-lab\js\beers-law-lab-config.js: 19-37 ..\reactants-products-and-leftovers\js\reactants-products-and-leftovers-config.js: 20-38 19 │ 20 │ image: '../../chipper/js/requirejs-plugins/image', 20 │ 21 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 21 │ 22 │ string: '../../chipper/js/requirejs-plugins/string', 22 │ 23 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 23 │ 24 │ 24 │ 25 │ // PhET libs, uppercase names to identify them in require.js imports 25 │ 26 │ AXON: '../../axon/js', 26 │ 27 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 27 │ 28 │ DOT: '../../dot/js', 28 │ 29 │ JOIST: '../../joist/js', 29 │ 30 │ KITE: '../../kite/js', 30 │ 31 │ NITROGLYCERIN: '../../nitroglycerin/js', 31 │ 32 │ PHET_CORE: '../../phet-core/js', 32 │ 33 │ PHET_IO: '../../phet-io/js', 33 │ 34 │ PHETCOMMON: '../../phetcommon/js', 34 │ 35 │ REPOSITORY: '..', 35 │ 36 │ SCENERY: '../../scenery/js', 36 │ 37 │ SCENERY_PHET: '../../scenery-phet/js', 37 │ 38 │ SUN: '../../sun/js', - ..\build-a-molecule\js\build-a-molecule-config.js: 22-42 ..\reactants-products-and-leftovers\js\reactants-products-and-leftovers-config.js: 23-43 22 │ 23 │ text: '../../sherpa/lib/text-2.0.12', 23 │ 24 │ 24 │ 25 │ // PhET libs, uppercase names to identify them in require.js imports 25 │ 26 │ AXON: '../../axon/js', 26 │ 27 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 27 │ 28 │ DOT: '../../dot/js', 28 │ 29 │ JOIST: '../../joist/js', 29 │ 30 │ KITE: '../../kite/js', 30 │ 31 │ NITROGLYCERIN: '../../nitroglycerin/js', 31 │ 32 │ PHET_CORE: '../../phet-core/js', 32 │ 33 │ PHET_IO: '../../phet-io/js', 33 │ 34 │ PHETCOMMON: '../../phetcommon/js', 34 │ 35 │ REPOSITORY: '..', 35 │ 36 │ SCENERY: '../../scenery/js', 36 │ 37 │ SCENERY_PHET: '../../scenery-phet/js', 37 │ 38 │ SHERPA: '../../sherpa', 38 │ 39 │ SUN: '../../sun/js', 39 │ 40 │ TANDEM: '../../tandem/js', 40 │ 41 │ VEGAS: '../../vegas/js', 41 │ 42 │ VIBE: '../../vibe/js', 42 │ 43 │ - ..\ohms-law\js\ohms-law\view\Slider.js: 17-39 ..\resistance-in-a-wire\js\resistance-in-a-wire\view\Slider.js: 17-39 17 │ 17 │ var ohmsLaw = require( 'OHMS_LAW/ohmsLaw' ); 18 │ 18 │ 19 │ 19 │ // constants 20 │ 20 │ var KNOB_WIDTH = 32; // Empirically determined. 21 │ 21 │ 22 │ 22 │ /** 23 │ 23 │ * @param x 24 │ 24 │ * @param y 25 │ 25 │ * @param h 26 │ 26 │ * @param targetProperty 27 │ 27 │ * @param img 28 │ 28 │ * @param value 29 │ 29 │ * @constructor 30 │ 30 │ */ 31 │ 31 │ function Slider( x, y, h, targetProperty, img, value ) { 32 │ 32 │ 33 │ 33 │ var self = this; 34 │ 34 │ Node.call( this, { x: x, y: y } ); 35 │ 35 │ this.addChild( new Rectangle( -3, 0, 6, h, { fill: 'black' } ) ); 36 │ 36 │ 37 │ 37 │ var knob = new Image( img, { cursor: 'pointer' } ); 38 │ 38 │ knob.scale( KNOB_WIDTH / knob.width ); 39 │ 39 │ knob.mutate( { centerX: 0, top: 0 } ); - ..\ohms-law\js\ohms-law\view\Slider.js: 52-63 ..\resistance-in-a-wire\js\resistance-in-a-wire\view\Slider.js: 52-63 52 │ 52 │ allowTouchSnag: true, 53 │ 53 │ 54 │ 54 │ start: function( event ) { 55 │ 55 │ clickYOffset = self.globalToParentPoint( event.pointer.point ).y - event.currentTarget.y; 56 │ 56 │ }, 57 │ 57 │ 58 │ 58 │ drag: function( event ) { 59 │ 59 │ var y = self.globalToParentPoint( event.pointer.point ).y - clickYOffset; 60 │ 60 │ y = Math.max( Math.min( y, yMax ), yMin ); 61 │ 61 │ targetProperty.set( positionToValue( y ) ); 62 │ 62 │ } 63 │ 63 │ } ) ); - ..\build-an-atom\js\build-an-atom-config.js: 10-35 ..\resistance-in-a-wire\js\resistance-in-a-wire-config.js: 13-38 10 │ 13 │ text: '../../sherpa/lib/text-2.0.12', 11 │ 14 │ 12 │ 15 │ // plugins 13 │ 16 │ audio: '../../chipper/js/requirejs-plugins/audio', 14 │ 17 │ image: '../../chipper/js/requirejs-plugins/image', 15 │ 18 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 16 │ 19 │ string: '../../chipper/js/requirejs-plugins/string', 17 │ 20 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 18 │ 21 │ 19 │ 22 │ // PhET libs, uppercase names to identify them in require.js imports 20 │ 23 │ AXON: '../../axon/js', 21 │ 24 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 22 │ 25 │ DOT: '../../dot/js', 23 │ 26 │ JOIST: '../../joist/js', 24 │ 27 │ KITE: '../../kite/js', 25 │ 28 │ PHET_CORE: '../../phet-core/js', 26 │ 29 │ PHET_IO: '../../phet-io/js', 27 │ 30 │ PHETCOMMON: '../../phetcommon/js', 28 │ 31 │ REPOSITORY: '..', 29 │ 32 │ SCENERY: '../../scenery/js', 30 │ 33 │ SCENERY_PHET: '../../scenery-phet/js', 31 │ 34 │ SHERPA: '../../sherpa', 32 │ 35 │ SHRED: '../../shred/js', 33 │ 36 │ SUN: '../../sun/js', 34 │ 37 │ TANDEM: '../../tandem/js', 35 │ 38 │ VEGAS: '../../vegas/js', - ..\rosetta\js\commitQueue.js: 238-244 ..\rosetta\js\commitQueue.js: 264-270 238 │ 264 │ for ( var stringKey in repos[ repository ] ) { 239 │ 265 │ var stringValue = repos[ repository ][ stringKey ].value; 240 │ 266 │ var translatedString = req.session.translatedStrings[ targetLocale ] && 241 │ 267 │ req.session.translatedStrings[ targetLocale ][ repository ] && 242 │ 268 │ req.session.translatedStrings[ targetLocale ][ repository ][ stringKey ]; 243 │ 269 │ if ( !translatedString || stringValue !== translatedString.value ) { 244 │ 270 │ successes.push( { - ..\rosetta\js\commitQueue.js: 54-67 ..\rosetta\js\routes.js: 549-562 54 │ 549 │ for ( var string in req.body ) { 55 │ 550 │ if ( req.body.hasOwnProperty( string ) ) { 56 │ 551 │ 57 │ 552 │ // data submitted is in the form "[repository] [key]", for example "area-builder area-builder.title" 58 │ 553 │ var repoAndKey = string.split( ' ' ); 59 │ 554 │ var repo = repoAndKey[ 0 ]; 60 │ 555 │ var key = repoAndKey[ 1 ]; 61 │ 556 │ 62 │ 557 │ if ( !repos[ repo ] ) { 63 │ 558 │ repos[ repo ] = {}; 64 │ 559 │ } 65 │ 560 │ 66 │ 561 │ var stringValue = req.body[ string ]; 67 │ 562 │ - ..\rutherford-scattering\js\common\model\Atom.js: 99-116 ..\rutherford-scattering\js\common\model\RSBaseModel.js: 166-183 99 │ 166 │ * @protected 100 │ 167 │ */ 101 │ 168 │ cullParticles: function() { 102 │ 169 │ var self = this; 103 │ 170 │ this.particles.forEach( function( particle ) { 104 │ 171 │ if ( !self.bounds.containsPoint( particle.position ) ) { 105 │ 172 │ self.removeParticle( particle ); 106 │ 173 │ } 107 │ 174 │ } ); 108 │ 175 │ }, 109 │ 176 │ 110 │ 177 │ /** 111 │ 178 │ * {number} dt - time step 112 │ 179 │ * @public 113 │ 180 │ */ 114 │ 181 │ step: function( dt ) { 115 │ 182 │ if ( this.running && !this.userInteraction && dt < 1 ) { 116 │ 183 │ this.gun.step( dt ); - ..\rutherford-scattering\js\common\model\Atom.js: 129-150 ..\rutherford-scattering\js\common\model\RSBaseModel.js: 200-221 129 │ 200 │ if ( !this.userInteraction ) { 130 │ 201 │ this.gun.step( this.maunalStepDt ); 131 │ 202 │ this.moveParticles( this.maunalStepDt ); 132 │ 203 │ this.cullParticles(); 133 │ 204 │ } 134 │ 205 │ 135 │ 206 │ this.stepEmitter.emit(); 136 │ 207 │ }, 137 │ 208 │ 138 │ 209 │ /** 139 │ 210 │ * @public 140 │ 211 │ */ 141 │ 212 │ reset: function() { 142 │ 213 │ this.gun.onProperty.reset(); 143 │ 214 │ this.removeAllParticles(); 144 │ 215 │ PropertySet.prototype.reset.call( this ); 145 │ 216 │ } 146 │ 217 │ 147 │ 218 │ } ); // inherit 148 │ 219 │ 149 │ 220 │ } ); // define 150 │ 221 │ - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-40 ..\rutherford-scattering\js\rutherford-scattering-config.js: 11-40 11 │ 11 │ deps: [ 'area-model-multiplication-main' ], 12 │ 12 │ 13 │ 13 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 14 │ 15 │ 15 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 16 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 17 │ paths: { 18 │ 18 │ 19 │ 19 │ // third-party libs 20 │ 20 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 21 │ 22 │ 22 │ // PhET plugins 23 │ 23 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 24 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 25 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 26 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 27 │ 28 │ 28 │ // common directories, uppercase names to identify them in require imports 29 │ 29 │ AXON: '../../axon/js', 30 │ 30 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 31 │ DOT: '../../dot/js', 32 │ 32 │ JOIST: '../../joist/js', 33 │ 33 │ KITE: '../../kite/js', 34 │ 34 │ PHET_CORE: '../../phet-core/js', 35 │ 35 │ PHET_IO: '../../phet-io/js', 36 │ 36 │ PHETCOMMON: '../../phetcommon/js', 37 │ 37 │ REPOSITORY: '..', 38 │ 38 │ SCENERY: '../../scenery/js', 39 │ 39 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 40 │ SUN: '../../sun/js', - ..\scenery\js\display\drawables\LineStatefulDrawable.js: 49-79 ..\scenery\js\display\drawables\PathStatefulDrawable.js: 46-76 49 │ 46 │ this.dirtyY2 = true; 50 │ 47 │ 51 │ 48 │ // After adding flags, we'll initialize the mixed-in PaintableStateful state. 52 │ 49 │ this.initializePaintableState( renderer, instance ); 53 │ 50 │ 54 │ 51 │ return this; // allow for chaining 55 │ 52 │ }; 56 │ 53 │ 57 │ 54 │ /** 58 │ 55 │ * Disposes the stateful mixin state, so it can be put into the pool to be initialized again. 59 │ 56 │ * @protected 60 │ 57 │ */ 61 │ 58 │ proto.disposeState = function() { 62 │ 59 │ this.disposePaintableState(); 63 │ 60 │ }; 64 │ 61 │ 65 │ 62 │ /** 66 │ 63 │ * A "catch-all" dirty method that directly marks the paintDirty flag and triggers propagation of dirty 67 │ 64 │ * information. This can be used by other mark* methods, or directly itself if the paintDirty flag is checked. 68 │ 65 │ * @public (scenery-internal) 69 │ 66 │ * 70 │ 67 │ * It should be fired (indirectly or directly) for anything besides transforms that needs to make a drawable 71 │ 68 │ * dirty. 72 │ 69 │ */ 73 │ 70 │ proto.markPaintDirty = function() { 74 │ 71 │ this.paintDirty = true; 75 │ 72 │ this.markDirty(); 76 │ 73 │ }; 77 │ 74 │ 78 │ 75 │ proto.markDirtyLine = function() { 79 │ 76 │ this.dirtyX1 = true; - ..\scenery\js\display\drawables\CircleCanvasDrawable.js: 72-85 ..\scenery\js\display\drawables\RectangleCanvasDrawable.js: 106-119 72 │ 106 │ context.closePath(); 73 │ 107 │ 74 │ 108 │ if ( node.hasFill() ) { 75 │ 109 │ node.beforeCanvasFill( wrapper ); // defined in Paintable 76 │ 110 │ context.fill(); 77 │ 111 │ node.afterCanvasFill( wrapper ); // defined in Paintable 78 │ 112 │ } 79 │ 113 │ if ( node.hasStroke() ) { 80 │ 114 │ node.beforeCanvasStroke( wrapper ); // defined in Paintable 81 │ 115 │ context.stroke(); 82 │ 116 │ node.afterCanvasStroke( wrapper ); // defined in Paintable 83 │ 117 │ } 84 │ 118 │ }, 85 │ 119 │ - ..\scenery\js\display\drawables\CircleDOMDrawable.js: 87-109 ..\scenery\js\display\drawables\RectangleDOMDrawable.js: 76-98 87 │ 76 │ fillElement.appendChild( strokeElement ); 88 │ 77 │ } 89 │ 78 │ 90 │ 79 │ // @protected {HTMLElement} - Our primary DOM element. This is exposed as part of the DOMSelfDrawable API. 91 │ 80 │ this.domElement = this.fillElement; 92 │ 81 │ 93 │ 82 │ // Apply CSS needed for future CSS transforms to work properly. 94 │ 83 │ scenery.Util.prepareForTransform( this.domElement, this.forceAcceleration ); 95 │ 84 │ 96 │ 85 │ return this; // allow for chaining 97 │ 86 │ }, 98 │ 87 │ 99 │ 88 │ /** 100 │ 89 │ * Updates our DOM element so that its appearance matches our node's representation. 101 │ 90 │ * @protected 102 │ 91 │ * 103 │ 92 │ * This implements part of the DOMSelfDrawable required API for subtypes. 104 │ 93 │ */ 105 │ 94 │ updateDOM: function() { 106 │ 95 │ var node = this.node; 107 │ 96 │ var fillElement = this.fillElement; 108 │ 97 │ var strokeElement = this.strokeElement; 109 │ 98 │ - ..\scenery\js\display\drawables\CircleDOMDrawable.js: 139-150 ..\scenery\js\display\drawables\RectangleDOMDrawable.js: 135-146 139 │ 135 │ strokeElement.style[ Features.borderRadius ] = ( node._radius + node.getLineWidth() / 2 ) + 'px'; 140 │ 136 │ } 141 │ 137 │ if ( hadNoStrokeBefore || this.dirtyLineWidth ) { 142 │ 138 │ strokeElement.style.left = ( -node.getLineWidth() / 2 ) + 'px'; 143 │ 139 │ strokeElement.style.top = ( -node.getLineWidth() / 2 ) + 'px'; 144 │ 140 │ strokeElement.style.borderWidth = node.getLineWidth() + 'px'; 145 │ 141 │ } 146 │ 142 │ if ( hadNoStrokeBefore || this.dirtyStroke ) { 147 │ 143 │ strokeElement.style.borderColor = node.getSimpleCSSStroke(); 148 │ 144 │ } 149 │ 145 │ } 150 │ 146 │ } - ..\scenery\js\display\drawables\LineStatefulDrawable.js: 49-79 ..\scenery\js\display\drawables\RectangleStatefulDrawable.js: 51-81 49 │ 51 │ this.dirtyY2 = true; 50 │ 52 │ 51 │ 53 │ // After adding flags, we'll initialize the mixed-in PaintableStateful state. 52 │ 54 │ this.initializePaintableState( renderer, instance ); 53 │ 55 │ 54 │ 56 │ return this; // allow for chaining 55 │ 57 │ }; 56 │ 58 │ 57 │ 59 │ /** 58 │ 60 │ * Disposes the stateful mixin state, so it can be put into the pool to be initialized again. 59 │ 61 │ * @protected 60 │ 62 │ */ 61 │ 63 │ proto.disposeState = function() { 62 │ 64 │ this.disposePaintableState(); 63 │ 65 │ }; 64 │ 66 │ 65 │ 67 │ /** 66 │ 68 │ * A "catch-all" dirty method that directly marks the paintDirty flag and triggers propagation of dirty 67 │ 69 │ * information. This can be used by other mark* methods, or directly itself if the paintDirty flag is checked. 68 │ 70 │ * @public (scenery-internal) 69 │ 71 │ * 70 │ 72 │ * It should be fired (indirectly or directly) for anything besides transforms that needs to make a drawable 71 │ 73 │ * dirty. 72 │ 74 │ */ 73 │ 75 │ proto.markPaintDirty = function() { 74 │ 76 │ this.paintDirty = true; 75 │ 77 │ this.markDirty(); 76 │ 78 │ }; 77 │ 79 │ 78 │ 80 │ proto.markDirtyLine = function() { 79 │ 81 │ this.dirtyX1 = true; - ..\scenery\js\display\drawables\LineStatefulDrawable.js: 49-79 ..\scenery\js\display\drawables\TextStatefulDrawable.js: 48-78 49 │ 48 │ this.dirtyY2 = true; 50 │ 49 │ 51 │ 50 │ // After adding flags, we'll initialize the mixed-in PaintableStateful state. 52 │ 51 │ this.initializePaintableState( renderer, instance ); 53 │ 52 │ 54 │ 53 │ return this; // allow for chaining 55 │ 54 │ }; 56 │ 55 │ 57 │ 56 │ /** 58 │ 57 │ * Disposes the stateful mixin state, so it can be put into the pool to be initialized again. 59 │ 58 │ * @protected 60 │ 59 │ */ 61 │ 60 │ proto.disposeState = function() { 62 │ 61 │ this.disposePaintableState(); 63 │ 62 │ }; 64 │ 63 │ 65 │ 64 │ /** 66 │ 65 │ * A "catch-all" dirty method that directly marks the paintDirty flag and triggers propagation of dirty 67 │ 66 │ * information. This can be used by other mark* methods, or directly itself if the paintDirty flag is checked. 68 │ 67 │ * @public (scenery-internal) 69 │ 68 │ * 70 │ 69 │ * It should be fired (indirectly or directly) for anything besides transforms that needs to make a drawable 71 │ 70 │ * dirty. 72 │ 71 │ */ 73 │ 72 │ proto.markPaintDirty = function() { 74 │ 73 │ this.paintDirty = true; 75 │ 74 │ this.markDirty(); 76 │ 75 │ }; 77 │ 76 │ 78 │ 77 │ proto.markDirtyLine = function() { 79 │ 78 │ this.dirtyX1 = true; - ..\scenery\js\display\WebGLBlock.js: 418-429 ..\scenery\js\display\WebGLBlock.js: 527-538 418 │ 527 │ uniforms: [ 'uProjectionMatrix' ] 419 │ 528 │ } ); 420 │ 529 │ 421 │ 530 │ this.vertexBuffer = gl.createBuffer(); 422 │ 531 │ this.lastArrayLength = 128; // initial vertex buffer array length 423 │ 532 │ this.vertexArray = new Float32Array( this.lastArrayLength ); 424 │ 533 │ 425 │ 534 │ gl.bindBuffer( gl.ARRAY_BUFFER, this.vertexBuffer ); 426 │ 535 │ gl.bufferData( gl.ARRAY_BUFFER, this.vertexArray, gl.DYNAMIC_DRAW ); // fully buffer at the start 427 │ 536 │ }; 428 │ 537 │ inherit( Object, WebGLBlock.VertexColorPolygons, { 429 │ 538 │ activate: function() { - ..\scenery\js\display\WebGLBlock.js: 438-450 ..\scenery\js\display\WebGLBlock.js: 558-570 438 │ 558 │ var vertexData = drawable.vertexArray; 439 │ 559 │ 440 │ 560 │ // if our vertex data won't fit, keep doubling the size until it fits 441 │ 561 │ while ( vertexData.length + this.vertexArrayIndex > this.vertexArray.length ) { 442 │ 562 │ var newVertexArray = new Float32Array( this.vertexArray.length * 2 ); 443 │ 563 │ newVertexArray.set( this.vertexArray ); 444 │ 564 │ this.vertexArray = newVertexArray; 445 │ 565 │ } 446 │ 566 │ 447 │ 567 │ // copy our vertex data into the main array 448 │ 568 │ this.vertexArray.set( vertexData, this.vertexArrayIndex ); 449 │ 569 │ this.vertexArrayIndex += vertexData.length; 450 │ 570 │ - ..\scenery\js\display\WebGLBlock.js: 467-483 ..\scenery\js\display\WebGLBlock.js: 585-601 467 │ 585 │ var gl = this.gl; 468 │ 586 │ 469 │ 587 │ // (uniform) projection transform into normalized device coordinates 470 │ 588 │ gl.uniformMatrix3fv( this.shaderProgram.uniformLocations.uProjectionMatrix, false, this.webglBlock.projectionMatrixArray ); 471 │ 589 │ 472 │ 590 │ gl.bindBuffer( gl.ARRAY_BUFFER, this.vertexBuffer ); 473 │ 591 │ // if we increased in length, we need to do a full bufferData to resize it on the GPU side 474 │ 592 │ if ( this.vertexArray.length > this.lastArrayLength ) { 475 │ 593 │ gl.bufferData( gl.ARRAY_BUFFER, this.vertexArray, gl.DYNAMIC_DRAW ); // fully buffer at the start 476 │ 594 │ } 477 │ 595 │ // otherwise do a more efficient update that only sends part of the array over 478 │ 596 │ else { 479 │ 597 │ gl.bufferSubData( gl.ARRAY_BUFFER, 0, this.vertexArray.subarray( 0, this.vertexArrayIndex ) ); 480 │ 598 │ } 481 │ 599 │ var sizeOfFloat = Float32Array.BYTES_PER_ELEMENT; 482 │ 600 │ var stride = 6 * sizeOfFloat; 483 │ 601 │ gl.vertexAttribPointer( this.shaderProgram.attributeLocations.aVertex, 2, gl.FLOAT, false, stride, 0 * sizeOfFloat ); - ..\scenery\js\display\CanvasSelfDrawable.js: 56-74 ..\scenery\js\display\WebGLSelfDrawable.js: 42-60 56 │ 42 │ this.dirty = false; 57 │ 43 │ }, 58 │ 44 │ 59 │ 45 │ // @override 60 │ 46 │ updateSelfVisibility: function() { 61 │ 47 │ SelfDrawable.prototype.updateSelfVisibility.call( this ); 62 │ 48 │ 63 │ 49 │ // mark us as dirty when our self visibility changes 64 │ 50 │ this.markDirty(); 65 │ 51 │ }, 66 │ 52 │ 67 │ 53 │ dispose: function() { 68 │ 54 │ this.instance.relativeTransform.removeListener( this.transformListener ); 69 │ 55 │ this.instance.relativeTransform.removePrecompute(); 70 │ 56 │ 71 │ 57 │ SelfDrawable.prototype.dispose.call( this ); 72 │ 58 │ } 73 │ 59 │ } ); 74 │ 60 │ - ..\scenery\js\input\Input.js: 714-733 ..\scenery\js\input\Input.js: 749-768 714 │ 749 │ var listener = pointerListeners[ i ]; 715 │ 750 │ 716 │ 751 │ // if a listener returns true, don't handle any more 717 │ 752 │ var aborted = false; 718 │ 753 │ 719 │ 754 │ if ( !aborted && listener[ specificType ] ) { 720 │ 755 │ listener[ specificType ]( inputEvent ); 721 │ 756 │ aborted = inputEvent.aborted; 722 │ 757 │ } 723 │ 758 │ if ( pointer.firesGenericEvent && !aborted && listener[ type ] ) { 724 │ 759 │ listener[ type ]( inputEvent ); 725 │ 760 │ aborted = inputEvent.aborted; 726 │ 761 │ } 727 │ 762 │ 728 │ 763 │ // bail out if the event is aborted, so no other listeners are triggered 729 │ 764 │ if ( aborted ) { 730 │ 765 │ return; 731 │ 766 │ } 732 │ 767 │ } 733 │ 768 │ }, - ..\scenery\js\input\Pen.js: 32-58 ..\scenery\js\input\Touch.js: 34-60 32 │ 34 │ inherit( Pointer, Pen, { 33 │ 35 │ move: function( point, event ) { 34 │ 36 │ var pointChanged = this.hasPointChanged( point ); 35 │ 37 │ // if ( this.point ) { this.point.freeToPool(); } 36 │ 38 │ this.point = point; 37 │ 39 │ return pointChanged; 38 │ 40 │ }, 39 │ 41 │ 40 │ 42 │ end: function( point, event ) { 41 │ 43 │ var pointChanged = this.hasPointChanged( point ); 42 │ 44 │ // if ( this.point ) { this.point.freeToPool(); } 43 │ 45 │ this.point = point; 44 │ 46 │ this.isDown = false; 45 │ 47 │ return pointChanged; 46 │ 48 │ }, 47 │ 49 │ 48 │ 50 │ cancel: function( point, event ) { 49 │ 51 │ var pointChanged = this.hasPointChanged( point ); 50 │ 52 │ // if ( this.point ) { this.point.freeToPool(); } 51 │ 53 │ this.point = point; 52 │ 54 │ this.isDown = false; 53 │ 55 │ return pointChanged; 54 │ 56 │ }, 55 │ 57 │ 56 │ 58 │ toString: function() { 57 │ 59 │ return 'Pen#' + this.id; 58 │ 60 │ } - ..\scenery\js\nodes\Node.js: 1628-1641 ..\scenery\js\nodes\Node.js: 1654-1667 1628 │ 1654 │ var trails = node.getTrails( hasRootedDisplayPredicate ); 1629 │ 1655 │ for ( var i = 0; i < trails.length; i++ ) { 1630 │ 1656 │ var trail = trails[ i ]; 1631 │ 1657 │ 1632 │ 1658 │ // Ignore trails where this node is not the child node's parent. See https://github.com/phetsims/scenery/issues/491 1633 │ 1659 │ if ( trail.nodeFromTop( 1 ) !== this ) { 1634 │ 1660 │ continue; 1635 │ 1661 │ } 1636 │ 1662 │ 1637 │ 1663 │ // Notify each Display of the trail 1638 │ 1664 │ var rootedDisplays = trail.rootNode()._rootedDisplays; 1639 │ 1665 │ for ( var j = 0; j < rootedDisplays.length; j++ ) { 1640 │ 1666 │ rootedDisplays[ j ].addAccessibleTrail( trail ); 1641 │ 1667 │ } - ..\scenery\js\nodes\Node.js: 3614-3627 ..\scenery\js\nodes\Node.js: 3665-3678 3614 │ 3665 │ function handleChild( m ) { 3615 │ 3666 │ delete edges[ n.id ][ m.id ]; 3616 │ 3667 │ if ( _.every( edges, function( children ) { return !children[ m.id ]; } ) ) { 3617 │ 3668 │ // there are no more edges to m 3618 │ 3669 │ s.push( m ); 3619 │ 3670 │ } 3620 │ 3671 │ } 3621 │ 3672 │ 3622 │ 3673 │ while ( s.length ) { 3623 │ 3674 │ n = s.pop(); 3624 │ 3675 │ l.push( n ); 3625 │ 3676 │ 3626 │ 3677 │ _.each( n._children, handleChild ); 3627 │ 3678 │ } - ..\scenery\js\nodes\Node.js: 3808-3816 ..\scenery\js\nodes\Node.js: 3858-3866 3808 │ 3858 │ toCanvas: function( callback, x, y, width, height ) { 3809 │ 3859 │ assert && assert( typeof callback === 'function' ); 3810 │ 3860 │ assert && assert( x === undefined || typeof x === 'number', 'If provided, x should be a number' ); 3811 │ 3861 │ assert && assert( y === undefined || typeof y === 'number', 'If provided, y should be a number' ); 3812 │ 3862 │ assert && assert( width === undefined || ( typeof width === 'number' && width >= 0 && ( width % 1 === 0 ) ), 3813 │ 3863 │ 'If provided, width should be a non-negative integer' ); 3814 │ 3864 │ assert && assert( height === undefined || ( typeof height === 'number' && height >= 0 && ( height % 1 === 0 ) ), 3815 │ 3865 │ 'If provided, height should be a non-negative integer' ); 3816 │ 3866 │ - ..\scenery\js\nodes\Node.js: 3808-3818 ..\scenery\js\nodes\Node.js: 3884-3894 3808 │ 3884 │ toCanvas: function( callback, x, y, width, height ) { 3809 │ 3885 │ assert && assert( typeof callback === 'function' ); 3810 │ 3886 │ assert && assert( x === undefined || typeof x === 'number', 'If provided, x should be a number' ); 3811 │ 3887 │ assert && assert( y === undefined || typeof y === 'number', 'If provided, y should be a number' ); 3812 │ 3888 │ assert && assert( width === undefined || ( typeof width === 'number' && width >= 0 && ( width % 1 === 0 ) ), 3813 │ 3889 │ 'If provided, width should be a non-negative integer' ); 3814 │ 3890 │ assert && assert( height === undefined || ( typeof height === 'number' && height >= 0 && ( height % 1 === 0 ) ), 3815 │ 3891 │ 'If provided, height should be a non-negative integer' ); 3816 │ 3892 │ 3817 │ 3893 │ var padding = 2; // padding used if x and y are not set 3818 │ 3894 │ - ..\scenery\js\nodes\Node.js: 3808-3818 ..\scenery\js\nodes\Node.js: 3920-3930 3808 │ 3920 │ toCanvas: function( callback, x, y, width, height ) { 3809 │ 3921 │ assert && assert( typeof callback === 'function' ); 3810 │ 3922 │ assert && assert( x === undefined || typeof x === 'number', 'If provided, x should be a number' ); 3811 │ 3923 │ assert && assert( y === undefined || typeof y === 'number', 'If provided, y should be a number' ); 3812 │ 3924 │ assert && assert( width === undefined || ( typeof width === 'number' && width >= 0 && ( width % 1 === 0 ) ), 3813 │ 3925 │ 'If provided, width should be a non-negative integer' ); 3814 │ 3926 │ assert && assert( height === undefined || ( typeof height === 'number' && height >= 0 && ( height % 1 === 0 ) ), 3815 │ 3927 │ 'If provided, height should be a non-negative integer' ); 3816 │ 3928 │ 3817 │ 3929 │ var padding = 2; // padding used if x and y are not set 3818 │ 3930 │ - ..\scenery\js\nodes\Node.js: 3810-3818 ..\scenery\js\nodes\Node.js: 3949-3957 3810 │ 3949 │ assert && assert( x === undefined || typeof x === 'number', 'If provided, x should be a number' ); 3811 │ 3950 │ assert && assert( y === undefined || typeof y === 'number', 'If provided, y should be a number' ); 3812 │ 3951 │ assert && assert( width === undefined || ( typeof width === 'number' && width >= 0 && ( width % 1 === 0 ) ), 3813 │ 3952 │ 'If provided, width should be a non-negative integer' ); 3814 │ 3953 │ assert && assert( height === undefined || ( typeof height === 'number' && height >= 0 && ( height % 1 === 0 ) ), 3815 │ 3954 │ 'If provided, height should be a non-negative integer' ); 3816 │ 3955 │ 3817 │ 3956 │ var padding = 2; // padding used if x and y are not set 3818 │ 3957 │ - ..\scenery\js\nodes\Node.js: 3948-3957 ..\scenery\js\nodes\Node.js: 3978-3987 3948 │ 3978 │ toCanvasNodeSynchronous: function( x, y, width, height ) { 3949 │ 3979 │ assert && assert( x === undefined || typeof x === 'number', 'If provided, x should be a number' ); 3950 │ 3980 │ assert && assert( y === undefined || typeof y === 'number', 'If provided, y should be a number' ); 3951 │ 3981 │ assert && assert( width === undefined || ( typeof width === 'number' && width >= 0 && ( width % 1 === 0 ) ), 3952 │ 3982 │ 'If provided, width should be a non-negative integer' ); 3953 │ 3983 │ assert && assert( height === undefined || ( typeof height === 'number' && height >= 0 && ( height % 1 === 0 ) ), 3954 │ 3984 │ 'If provided, height should be a non-negative integer' ); 3955 │ 3985 │ 3956 │ 3986 │ var result = null; 3957 │ 3987 │ this.toCanvas( function( canvas, x, y ) { - ..\charges-and-fields\js\charges-and-fields\view\ChargesAndFieldsScreenView.js: 460-466 ..\scenery\js\util\Color.js: 705-711 460 │ 705 │ if ( distance < 0 || distance > 1 ) { 461 │ 706 │ throw new Error( 'distance must be between 0 and 1: ' + distance ); 462 │ 707 │ } 463 │ 708 │ var r = Math.floor( linear( 0, 1, color1.r, color2.r, distance ) ); 464 │ 709 │ var g = Math.floor( linear( 0, 1, color1.g, color2.g, distance ) ); 465 │ 710 │ var b = Math.floor( linear( 0, 1, color1.b, color2.b, distance ) ); 466 │ 711 │ return 'rgba(' + r + ',' + g + ',' + b + ',' + options.transparency + ')'; - ..\mobius\js\ShaderProgram.js: 23-45 ..\scenery\js\util\ShaderProgram.js: 30-52 23 │ 30 │ }; 24 │ 31 │ 25 │ 32 │ return inherit( Object, ShaderProgram, { 26 │ 33 │ // initializes (or reinitializes) the WebGL state and uniform/attribute references. 27 │ 34 │ initialize: function( gl ) { 28 │ 35 │ var self = this; 29 │ 36 │ this.gl = gl; // TODO: create them with separate contexts 30 │ 37 │ 31 │ 38 │ this.used = false; 32 │ 39 │ 33 │ 40 │ this.program = this.gl.createProgram(); 34 │ 41 │ 35 │ 42 │ this.vertexShader = Util.createShader( this.gl, this.vertexSource, this.gl.VERTEX_SHADER ); 36 │ 43 │ this.fragmentShader = Util.createShader( this.gl, this.fragmentSource, this.gl.FRAGMENT_SHADER ); 37 │ 44 │ 38 │ 45 │ this.gl.attachShader( this.program, this.vertexShader ); 39 │ 46 │ this.gl.attachShader( this.program, this.fragmentShader ); 40 │ 47 │ 41 │ 48 │ this.gl.linkProgram( this.program ); 42 │ 49 │ 43 │ 50 │ if ( !this.gl.getProgramParameter( this.program, this.gl.LINK_STATUS ) ) { 44 │ 51 │ console.log( this.gl.getProgramInfoLog( this.program ) ); 45 │ 52 │ console.log( this.vertexSource ); - ..\mobius\js\ShaderProgram.js: 48-82 ..\scenery\js\util\ShaderProgram.js: 61-95 48 │ 61 │ } 49 │ 62 │ 50 │ 63 │ // clean these up, they aren't needed after the link 51 │ 64 │ this.gl.deleteShader( this.vertexShader ); 52 │ 65 │ this.gl.deleteShader( this.fragmentShader ); 53 │ 66 │ 54 │ 67 │ this.uniformLocations = {}; // map name => uniform location for program 55 │ 68 │ this.attributeLocations = {}; // map name => attribute location for program 56 │ 69 │ this.activeAttributes = {}; // map name => boolean (enabled) 57 │ 70 │ 58 │ 71 │ _.each( this.attributeNames, function( attributeName ) { 59 │ 72 │ self.attributeLocations[ attributeName ] = self.gl.getAttribLocation( self.program, attributeName ); 60 │ 73 │ self.activeAttributes[ attributeName ] = true; // default to enabled 61 │ 74 │ } ); 62 │ 75 │ _.each( this.uniformNames, function( uniformName ) { 63 │ 76 │ self.uniformLocations[ uniformName ] = self.gl.getUniformLocation( self.program, uniformName ); 64 │ 77 │ } ); 65 │ 78 │ 66 │ 79 │ this.isInitialized = true; 67 │ 80 │ }, 68 │ 81 │ 69 │ 82 │ use: function() { 70 │ 83 │ if ( this.used ) { return; } 71 │ 84 │ 72 │ 85 │ var self = this; 73 │ 86 │ 74 │ 87 │ this.used = true; 75 │ 88 │ 76 │ 89 │ this.gl.useProgram( this.program ); 77 │ 90 │ 78 │ 91 │ // enable the active attributes 79 │ 92 │ _.each( this.attributeNames, function( attributeName ) { 80 │ 93 │ if ( self.activeAttributes[ attributeName ] ) { 81 │ 94 │ self.gl.enableVertexAttribArray( self.attributeLocations[ attributeName ] ); 82 │ 95 │ } - ..\scenery\tests\benchmarks\js\current.js: 18-25 ..\scenery\tests\benchmarks\js\current.js: 56-63 18 │ 56 │ var scene = phet.benchmark.createDetachedScene( 256, 256 ); 19 │ 57 │ for ( var i = 0; i < 200; i++ ) { 20 │ 58 │ scene.addChild( new scenery.Path( kite.Shape.rectangle( i, ( 7 * i ) % 200, 20, 20 ), { 21 │ 59 │ fill: 'rgba(255,0,0,1)', 22 │ 60 │ stroke: '#000000' 23 │ 61 │ } ) ); 24 │ 62 │ } 25 │ 63 │ var start = new Date; - ..\scenery\tests\benchmarks\js\current.js: 51-64 ..\scenery\tests\benchmarks\js\current.js: 68-81 51 │ 68 │ scene.rotate( Math.sin( i ) ); 52 │ 69 │ scene.updateScene(); 53 │ 70 │ } 54 │ 71 │ }, { 55 │ 72 │ setup: function() { 56 │ 73 │ var scene = phet.benchmark.createDetachedScene( 256, 256 ); 57 │ 74 │ for ( var i = 0; i < 200; i++ ) { 58 │ 75 │ scene.addChild( new scenery.Path( kite.Shape.rectangle( i, ( 7 * i ) % 200, 20, 20 ), { 59 │ 76 │ fill: 'rgba(255,0,0,1)', 60 │ 77 │ stroke: '#000000' 61 │ 78 │ } ) ); 62 │ 79 │ } 63 │ 80 │ } 64 │ 81 │ } ); - ..\scenery\tests\benchmarks\js\current.js: 52-70 ..\scenery\tests\benchmarks\js\current.js: 92-110 52 │ 92 │ scene.updateScene(); 53 │ 93 │ } 54 │ 94 │ }, { 55 │ 95 │ setup: function() { 56 │ 96 │ var scene = phet.benchmark.createDetachedScene( 256, 256 ); 57 │ 97 │ for ( var i = 0; i < 200; i++ ) { 58 │ 98 │ scene.addChild( new scenery.Path( kite.Shape.rectangle( i, ( 7 * i ) % 200, 20, 20 ), { 59 │ 99 │ fill: 'rgba(255,0,0,1)', 60 │ 100 │ stroke: '#000000' 61 │ 101 │ } ) ); 62 │ 102 │ } 63 │ 103 │ } 64 │ 104 │ } ); 65 │ 105 │ 66 │ 106 │ benchmarkTimer.add( 'Square rotating over background squares 100x', function() { 67 │ 107 │ for ( var i = 0; i < 100; i++ ) { 68 │ 108 │ node.rotate( Math.sin( i ) ); 69 │ 109 │ scene.updateScene(); 70 │ 110 │ } - ..\scenery\tests\benchmarks\js\benchmarks.js: 77-91 ..\scenery\tests\benchmarks\js\marks.js: 388-402 77 │ 388 │ console.log( 'loading script ' + src ); 78 │ 389 │ 79 │ 390 │ var called = false; 80 │ 391 │ 81 │ 392 │ var script = document.createElement( 'script' ); 82 │ 393 │ script.type = 'text/javascript'; 83 │ 394 │ script.async = true; 84 │ 395 │ script.onload = script.onreadystatechange = function() { 85 │ 396 │ var state = this.readyState; 86 │ 397 │ if ( state && state != "complete" && state != "loaded" ) { 87 │ 398 │ return; 88 │ 399 │ } 89 │ 400 │ 90 │ 401 │ if ( !called ) { 91 │ 402 │ console.log( 'loaded script ' + src ); - ..\scenery\tests\benchmarks\js\perf-current.js: 5-18 ..\scenery\tests\benchmarks\js\perf-current.js: 39-52 5 │ 39 │ name: 'Text node instances', 6 │ 40 │ count: 20, 7 │ 41 │ before: function() { 8 │ 42 │ this.width = 1024; 9 │ 43 │ this.height = 768; 10 │ 44 │ 11 │ 45 │ this.i = 0; 12 │ 46 │ 13 │ 47 │ var main = $( '#main' ); 14 │ 48 │ main.width( this.width ); 15 │ 49 │ main.height( this.height ); 16 │ 50 │ var scene = new scenery.Scene( main ); 17 │ 51 │ var text = new scenery.Text( 'A', { font: '16px sans-serif' } ); 18 │ 52 │ for ( var i = 0; i < 10000; i++ ) { - ..\scenery\tests\benchmarks\js\perf-current.js: 17-39 ..\scenery\tests\benchmarks\js\perf-current.js: 54-76 17 │ 54 │ var text = new scenery.Text( 'A', { font: '16px sans-serif' } ); 18 │ 55 │ for ( var i = 0; i < 10000; i++ ) { 19 │ 56 │ scene.addChild( new scenery.Node( { 20 │ 57 │ children: [ text ], 21 │ 58 │ x: i % 759, 22 │ 59 │ y: ( i * 172 ) % 973 23 │ 60 │ } ) ); 24 │ 61 │ } 25 │ 62 │ 26 │ 63 │ this.main = main; 27 │ 64 │ this.scene = scene; 28 │ 65 │ }, 29 │ 66 │ step: function() { 30 │ 67 │ this.scene.rotate( 0.01 ); 31 │ 68 │ this.scene.updateScene(); 32 │ 69 │ }, 33 │ 70 │ after: function() { 34 │ 71 │ this.main.empty(); 35 │ 72 │ } 36 │ 73 │ }; 37 │ 74 │ 38 │ 75 │ var textPathInstances = { 39 │ 76 │ name: 'Text path instances', - ..\scenery\tests\benchmarks\js\perf-current.js: 373-385 ..\scenery\tests\benchmarks\js\perf-current.js: 403-415 373 │ 403 │ name: 'Rotated group of squares with hardcoded xy', 374 │ 404 │ count: 20, 375 │ 405 │ before: function() { 376 │ 406 │ this.width = 1024; 377 │ 407 │ this.height = 768; 378 │ 408 │ 379 │ 409 │ var main = $( '#main' ); 380 │ 410 │ main.width( this.width ); 381 │ 411 │ main.height( this.height ); 382 │ 412 │ var scene = new scenery.Scene( main ); 383 │ 413 │ for ( var i = 0; i < 4000; i++ ) { 384 │ 414 │ scene.addChild( new scenery.Rectangle( ( Math.PI * i ) % this.width, ( 27 * i ) % this.height, 20, 20, { 385 │ 415 │ fill: 'rgba(255,0,0,0.3)', - ..\scenery\tests\benchmarks\js\perf-current.js: 387-403 ..\scenery\tests\benchmarks\js\perf-current.js: 419-435 387 │ 419 │ } ) ); 388 │ 420 │ } 389 │ 421 │ 390 │ 422 │ this.main = main; 391 │ 423 │ this.scene = scene; 392 │ 424 │ }, 393 │ 425 │ step: function() { 394 │ 426 │ this.scene.rotateAround( new dot.Vector2( this.width / 2, this.height / 2 ), 0.1 ); 395 │ 427 │ this.scene.updateScene(); 396 │ 428 │ }, 397 │ 429 │ after: function() { 398 │ 430 │ this.main.empty(); 399 │ 431 │ } 400 │ 432 │ }; 401 │ 433 │ 402 │ 434 │ var rotatedSquaresTransformXY = { 403 │ 435 │ name: 'Rotated group of squares with transform xy', - ..\scenery\tests\benchmarks\js\perf-current.js: 373-386 ..\scenery\tests\benchmarks\js\perf-current.js: 435-448 373 │ 435 │ name: 'Rotated group of squares with hardcoded xy', 374 │ 436 │ count: 20, 375 │ 437 │ before: function() { 376 │ 438 │ this.width = 1024; 377 │ 439 │ this.height = 768; 378 │ 440 │ 379 │ 441 │ var main = $( '#main' ); 380 │ 442 │ main.width( this.width ); 381 │ 443 │ main.height( this.height ); 382 │ 444 │ var scene = new scenery.Scene( main ); 383 │ 445 │ for ( var i = 0; i < 4000; i++ ) { 384 │ 446 │ scene.addChild( new scenery.Rectangle( ( Math.PI * i ) % this.width, ( 27 * i ) % this.height, 20, 20, { 385 │ 447 │ fill: 'rgba(255,0,0,0.3)', 386 │ 448 │ stroke: '#000000' - ..\scenery\tests\benchmarks\js\perf-current.js: 445-456 ..\scenery\tests\benchmarks\js\perf-current.js: 479-490 445 │ 479 │ for ( var i = 0; i < 4000; i++ ) { 446 │ 480 │ scene.addChild( new scenery.Rectangle( 0, 0, 20, 20, { 447 │ 481 │ fill: 'rgba(0,255,0,0.3)', 448 │ 482 │ stroke: '#000000', 449 │ 483 │ x: ( Math.PI * i ) % this.width, 450 │ 484 │ y: ( 27 * i ) % this.height 451 │ 485 │ } ) ); 452 │ 486 │ } 453 │ 487 │ 454 │ 488 │ this.main = main; 455 │ 489 │ this.scene = scene; 456 │ 490 │ }, - ..\scenery\tests\benchmarks\js\perf-current.js: 445-479 ..\scenery\tests\benchmarks\js\perf-current.js: 523-557 445 │ 523 │ for ( var i = 0; i < 4000; i++ ) { 446 │ 524 │ scene.addChild( new scenery.Rectangle( 0, 0, 20, 20, { 447 │ 525 │ fill: 'rgba(0,255,0,0.3)', 448 │ 526 │ stroke: '#000000', 449 │ 527 │ x: ( Math.PI * i ) % this.width, 450 │ 528 │ y: ( 27 * i ) % this.height 451 │ 529 │ } ) ); 452 │ 530 │ } 453 │ 531 │ 454 │ 532 │ this.main = main; 455 │ 533 │ this.scene = scene; 456 │ 534 │ }, 457 │ 535 │ step: function() { 458 │ 536 │ _.each( this.scene.getChildren(), function( child ) { 459 │ 537 │ child.rotate( 0.1 ); 460 │ 538 │ } ); 461 │ 539 │ this.scene.updateScene(); 462 │ 540 │ }, 463 │ 541 │ after: function() { 464 │ 542 │ this.main.empty(); 465 │ 543 │ } 466 │ 544 │ }; 467 │ 545 │ 468 │ 546 │ var fastSquaresCanvas = { 469 │ 547 │ name: 'Fast Squares Canvas', 470 │ 548 │ count: 20, 471 │ 549 │ before: function() { 472 │ 550 │ this.width = 1024; 473 │ 551 │ this.height = 768; 474 │ 552 │ 475 │ 553 │ var main = $( '#main' ); 476 │ 554 │ main.width( this.width ); 477 │ 555 │ main.height( this.height ); 478 │ 556 │ var scene = new scenery.Scene( main ); 479 │ 557 │ for ( var i = 0; i < 1000; i++ ) { - ..\scenery\tests\benchmarks\js\marks.js: 378-416 ..\scenery\tests\benchmarks\js\performance.js: 183-221 378 │ 183 │ } 379 │ 184 │ } 380 │ 185 │ 381 │ 186 │ function info( msg ) { 382 │ 187 │ if ( console && console.log ) { 383 │ 188 │ console.log( msg ); 384 │ 189 │ } 385 │ 190 │ } 386 │ 191 │ 387 │ 192 │ function loadScript( src, callback ) { 388 │ 193 │ debug( 'requesting script ' + src ); 389 │ 194 │ 390 │ 195 │ var called = false; 391 │ 196 │ 392 │ 197 │ var script = document.createElement( 'script' ); 393 │ 198 │ script.type = 'text/javascript'; 394 │ 199 │ script.async = true; 395 │ 200 │ script.onload = script.onreadystatechange = function() { 396 │ 201 │ var state = this.readyState; 397 │ 202 │ if ( state && state != "complete" && state != "loaded" ) { 398 │ 203 │ return; 399 │ 204 │ } 400 │ 205 │ 401 │ 206 │ if ( !called ) { 402 │ 207 │ debug( 'completed script ' + src ); 403 │ 208 │ called = true; 404 │ 209 │ callback(); 405 │ 210 │ } 406 │ 211 │ }; 407 │ 212 │ 408 │ 213 │ // make sure things aren't cached, just in case 409 │ 214 │ script.src = src + '?random=' + Math.random().toFixed( 10 ); 410 │ 215 │ 411 │ 216 │ var other = document.getElementsByTagName( 'script' )[ 0 ]; 412 │ 217 │ other.parentNode.insertBefore( script, other ); 413 │ 218 │ } 414 │ 219 │ 415 │ 220 │ })(); 416 │ 221 │ - ..\scenery\tests\benchmarks\js\marks.js: 187-208 ..\scenery\tests\benchmarks\js\table-report.js: 5-26 187 │ 5 │ marks.TableReport = function( container ) { 188 │ 6 │ this.container = container; 189 │ 7 │ 190 │ 8 │ this.table = document.createElement( 'table' ); 191 │ 9 │ this.table.className = 'table table-condensed'; 192 │ 10 │ 193 │ 11 │ this.thead = document.createElement( 'thead' ); 194 │ 12 │ this.table.appendChild( this.thead ); 195 │ 13 │ this.headRow = document.createElement( 'tr' ); 196 │ 14 │ this.thead.appendChild( this.headRow ); 197 │ 15 │ 198 │ 16 │ this.tbody = document.createElement( 'tbody' ); 199 │ 17 │ this.table.appendChild( this.tbody ); 200 │ 18 │ 201 │ 19 │ this.container.appendChild( this.table ); 202 │ 20 │ 203 │ 21 │ // 2-d array that stores table cells (TD elements) 204 │ 22 │ this.cells = []; 205 │ 23 │ 206 │ 24 │ // TR elements 207 │ 25 │ this.rows = []; 208 │ 26 │ - ..\scenery\tests\benchmarks\js\marks.js: 316-333 ..\scenery\tests\benchmarks\js\table-report.js: 36-53 316 │ 36 │ }, 317 │ 37 │ 318 │ 38 │ addRow: function() { 319 │ 39 │ this.numRows++; 320 │ 40 │ 321 │ 41 │ var row = document.createElement( 'tr' ); 322 │ 42 │ this.table.appendChild( row ); 323 │ 43 │ this.rows.push( row ); 324 │ 44 │ 325 │ 45 │ // append row with the requisite number of columns 326 │ 46 │ var rowElements = []; 327 │ 47 │ for ( var i = 0; i < this.numColumns; i++ ) { 328 │ 48 │ var td = document.createElement( 'td' ); 329 │ 49 │ row.appendChild( td ); 330 │ 50 │ rowElements.push( td ); 331 │ 51 │ } 332 │ 52 │ this.cells.push( rowElements ); 333 │ 53 │ }, - ..\scenery\tests\qunit\js\display.js: 25-38 ..\scenery\tests\qunit\js\display.js: 71-84 25 │ 71 │ var r1 = new scenery.Rectangle( 5, 10, 100, 50, 0, 0, { fill: 'red', stroke: 'blue', lineWidth: 5 } ); 26 │ 72 │ var r1i = new scenery.Instance( stubDisplay, r1.getUniqueTrail() ); 27 │ 73 │ var r1dd = r1.createDOMDrawable( scenery.Renderer.bitmaskDOM, r1i ); 28 │ 74 │ var r1ds = r1.createSVGDrawable( scenery.Renderer.bitmaskSVG, r1i ); 29 │ 75 │ var r1dc = r1.createCanvasDrawable( scenery.Renderer.bitmaskCanvas, r1i ); 30 │ 76 │ 31 │ 77 │ ok( r1._drawables.length === 3, 'After init, should have drawable refs' ); 32 │ 78 │ 33 │ 79 │ r1dd.updateDOM(); 34 │ 80 │ r1ds.updateSVG(); 35 │ 81 │ r1dc.paintCanvas( wrapper, r1 ); 36 │ 82 │ 37 │ 83 │ r1.setRect( 0, 0, 100, 100, 5, 5 ); 38 │ 84 │ - ..\scenery\tests\qunit\js\display.js: 37-57 ..\scenery\tests\qunit\js\display.js: 83-103 37 │ 83 │ r1.setRect( 0, 0, 100, 100, 5, 5 ); 38 │ 84 │ 39 │ 85 │ r1dd.updateDOM(); 40 │ 86 │ r1ds.updateSVG(); 41 │ 87 │ r1dc.paintCanvas( wrapper, r1 ); 42 │ 88 │ 43 │ 89 │ r1.stroke = null; 44 │ 90 │ r1.fill = null; 45 │ 91 │ 46 │ 92 │ r1dd.updateDOM(); 47 │ 93 │ r1ds.updateSVG(); 48 │ 94 │ r1dc.paintCanvas( wrapper, r1 ); 49 │ 95 │ 50 │ 96 │ r1dd.dispose(); 51 │ 97 │ r1ds.dispose(); 52 │ 98 │ r1dc.dispose(); 53 │ 99 │ 54 │ 100 │ ok( r1._drawables.length === 0, 'After dispose, should not have drawable refs' ); 55 │ 101 │ 56 │ 102 │ ok( scenery.RectangleDOMDrawable.pool.length > 0, 'Disposed drawable returned to pool' ); 57 │ 103 │ ok( scenery.RectangleSVGDrawable.pool.length > 0, 'Disposed drawable returned to pool' ); - ..\scenery\tests\qunit\js\display.js: 117-128 ..\scenery\tests\qunit\js\display.js: 158-169 117 │ 158 │ var r1 = new scenery.Line( 0, 1, 2, 3, { fill: 'red', stroke: 'blue', lineWidth: 5 } ); 118 │ 159 │ var r1i = new scenery.Instance( stubDisplay, r1.getUniqueTrail() ); 119 │ 160 │ var r1ds = r1.createSVGDrawable( scenery.Renderer.bitmaskSVG, r1i ); 120 │ 161 │ var r1dc = r1.createCanvasDrawable( scenery.Renderer.bitmaskCanvas, r1i ); 121 │ 162 │ 122 │ 163 │ ok( r1._drawables.length === 2, 'After init, should have drawable refs' ); 123 │ 164 │ 124 │ 165 │ r1ds.updateSVG(); 125 │ 166 │ r1dc.paintCanvas( wrapper, r1 ); 126 │ 167 │ 127 │ 168 │ r1.x1 = 50; 128 │ 169 │ r1.x2 = 100; - ..\scenery\tests\qunit\js\display.js: 25-38 ..\scenery\tests\qunit\js\display.js: 203-216 25 │ 203 │ var r1 = new scenery.Rectangle( 5, 10, 100, 50, 0, 0, { fill: 'red', stroke: 'blue', lineWidth: 5 } ); 26 │ 204 │ var r1i = new scenery.Instance( stubDisplay, r1.getUniqueTrail() ); 27 │ 205 │ var r1dd = r1.createDOMDrawable( scenery.Renderer.bitmaskDOM, r1i ); 28 │ 206 │ var r1ds = r1.createSVGDrawable( scenery.Renderer.bitmaskSVG, r1i ); 29 │ 207 │ var r1dc = r1.createCanvasDrawable( scenery.Renderer.bitmaskCanvas, r1i ); 30 │ 208 │ 31 │ 209 │ ok( r1._drawables.length === 3, 'After init, should have drawable refs' ); 32 │ 210 │ 33 │ 211 │ r1dd.updateDOM(); 34 │ 212 │ r1ds.updateSVG(); 35 │ 213 │ r1dc.paintCanvas( wrapper, r1 ); 36 │ 214 │ 37 │ 215 │ r1.setRect( 0, 0, 100, 100, 5, 5 ); 38 │ 216 │ - ..\scenery\tests\qunit\js\display.js: 37-57 ..\scenery\tests\qunit\js\display.js: 221-241 37 │ 221 │ r1.setRect( 0, 0, 100, 100, 5, 5 ); 38 │ 222 │ 39 │ 223 │ r1dd.updateDOM(); 40 │ 224 │ r1ds.updateSVG(); 41 │ 225 │ r1dc.paintCanvas( wrapper, r1 ); 42 │ 226 │ 43 │ 227 │ r1.stroke = null; 44 │ 228 │ r1.fill = null; 45 │ 229 │ 46 │ 230 │ r1dd.updateDOM(); 47 │ 231 │ r1ds.updateSVG(); 48 │ 232 │ r1dc.paintCanvas( wrapper, r1 ); 49 │ 233 │ 50 │ 234 │ r1dd.dispose(); 51 │ 235 │ r1ds.dispose(); 52 │ 236 │ r1dc.dispose(); 53 │ 237 │ 54 │ 238 │ ok( r1._drawables.length === 0, 'After dispose, should not have drawable refs' ); 55 │ 239 │ 56 │ 240 │ ok( scenery.RectangleDOMDrawable.pool.length > 0, 'Disposed drawable returned to pool' ); 57 │ 241 │ ok( scenery.RectangleSVGDrawable.pool.length > 0, 'Disposed drawable returned to pool' ); - ..\scenery\tests\qunit\js\display.js: 25-36 ..\scenery\tests\qunit\js\display.js: 255-266 25 │ 255 │ var r1 = new scenery.Rectangle( 5, 10, 100, 50, 0, 0, { fill: 'red', stroke: 'blue', lineWidth: 5 } ); 26 │ 256 │ var r1i = new scenery.Instance( stubDisplay, r1.getUniqueTrail() ); 27 │ 257 │ var r1dd = r1.createDOMDrawable( scenery.Renderer.bitmaskDOM, r1i ); 28 │ 258 │ var r1ds = r1.createSVGDrawable( scenery.Renderer.bitmaskSVG, r1i ); 29 │ 259 │ var r1dc = r1.createCanvasDrawable( scenery.Renderer.bitmaskCanvas, r1i ); 30 │ 260 │ 31 │ 261 │ ok( r1._drawables.length === 3, 'After init, should have drawable refs' ); 32 │ 262 │ 33 │ 263 │ r1dd.updateDOM(); 34 │ 264 │ r1ds.updateSVG(); 35 │ 265 │ r1dc.paintCanvas( wrapper, r1 ); 36 │ 266 │ - ..\scenery\tests\qunit\js\display.js: 321-326 ..\scenery\tests\qunit\js\display.js: 328-333 321 │ 328 │ mask = Renderer.pushOrderBitmask( mask, Renderer.bitmaskSVG ); 322 │ 329 │ equal( Renderer.bitmaskOrder( mask, 0 ), Renderer.bitmaskSVG ); 323 │ 330 │ equal( Renderer.bitmaskOrder( mask, 1 ), 0 ); 324 │ 331 │ equal( Renderer.bitmaskOrder( mask, 2 ), 0 ); 325 │ 332 │ equal( Renderer.bitmaskOrder( mask, 3 ), 0 ); 326 │ 333 │ - ..\scenery\tests\qunit\js\display.js: 350-355 ..\scenery\tests\qunit\js\display.js: 357-362 350 │ 357 │ mask = Renderer.pushOrderBitmask( mask, Renderer.bitmaskDOM ); 351 │ 358 │ equal( Renderer.bitmaskOrder( mask, 0 ), Renderer.bitmaskDOM ); 352 │ 359 │ equal( Renderer.bitmaskOrder( mask, 1 ), Renderer.bitmaskSVG ); 353 │ 360 │ equal( Renderer.bitmaskOrder( mask, 2 ), Renderer.bitmaskCanvas ); 354 │ 361 │ equal( Renderer.bitmaskOrder( mask, 3 ), 0 ); 355 │ 362 │ - ..\scenery\tests\qunit\js\display.js: 407-417 ..\scenery\tests\qunit\js\display.js: 410-420 407 │ 410 │ var d = new scenery.Display( n ); 408 │ 411 │ d.updateDisplay(); 409 │ 412 │ 410 │ 413 │ n.addChild( new scenery.Rectangle( 0, 0, 50, 50, { fill: 'red' } ) ); 411 │ 414 │ d.updateDisplay(); 412 │ 415 │ 413 │ 416 │ n.addChild( new scenery.Rectangle( 0, 0, 50, 50, { fill: 'red' } ) ); 414 │ 417 │ d.updateDisplay(); 415 │ 418 │ 416 │ 419 │ n.addChild( new scenery.Rectangle( 0, 0, 50, 50, { fill: 'red' } ) ); 417 │ 420 │ d.updateDisplay(); - ..\scenery\tests\qunit\js\focus.js: 27-39 ..\scenery\tests\qunit\js\focus.js: 50-62 27 │ 50 │ test( 'Simple Test', function() { 28 │ 51 │ 29 │ 52 │ var a1 = new scenery.Node( { accessibleContent: accessibleContent } ); 30 │ 53 │ var a2 = new scenery.Node( { accessibleContent: accessibleContent } ); 31 │ 54 │ 32 │ 55 │ var b1 = new scenery.Node( { accessibleContent: accessibleContent } ); 33 │ 56 │ var b2 = new scenery.Node( { accessibleContent: accessibleContent } ); 34 │ 57 │ 35 │ 58 │ var a = new scenery.Node( { children: [ a1, a2 ] } ); 36 │ 59 │ var b = new scenery.Node( { children: [ b1, b2 ] } ); 37 │ 60 │ 38 │ 61 │ var root = new scenery.Node( { children: [ a, b ] } ); 39 │ 62 │ - ..\scenery\tests\qunit\js\focus.js: 27-39 ..\scenery\tests\qunit\js\focus.js: 73-85 27 │ 73 │ test( 'Simple Test', function() { 28 │ 74 │ 29 │ 75 │ var a1 = new scenery.Node( { accessibleContent: accessibleContent } ); 30 │ 76 │ var a2 = new scenery.Node( { accessibleContent: accessibleContent } ); 31 │ 77 │ 32 │ 78 │ var b1 = new scenery.Node( { accessibleContent: accessibleContent } ); 33 │ 79 │ var b2 = new scenery.Node( { accessibleContent: accessibleContent } ); 34 │ 80 │ 35 │ 81 │ var a = new scenery.Node( { children: [ a1, a2 ] } ); 36 │ 82 │ var b = new scenery.Node( { children: [ b1, b2 ] } ); 37 │ 83 │ 38 │ 84 │ var root = new scenery.Node( { children: [ a, b ] } ); 39 │ 85 │ - ..\scenery\tests\qunit\js\focus.js: 27-37 ..\scenery\tests\qunit\js\focus.js: 126-136 27 │ 126 │ test( 'Simple Test', function() { 28 │ 127 │ 29 │ 128 │ var a1 = new scenery.Node( { accessibleContent: accessibleContent } ); 30 │ 129 │ var a2 = new scenery.Node( { accessibleContent: accessibleContent } ); 31 │ 130 │ 32 │ 131 │ var b1 = new scenery.Node( { accessibleContent: accessibleContent } ); 33 │ 132 │ var b2 = new scenery.Node( { accessibleContent: accessibleContent } ); 34 │ 133 │ 35 │ 134 │ var a = new scenery.Node( { children: [ a1, a2 ] } ); 36 │ 135 │ var b = new scenery.Node( { children: [ b1, b2 ] } ); 37 │ 136 │ - ..\scenery\tests\qunit\js\focus.js: 27-36 ..\scenery\tests\qunit\js\focus.js: 149-158 27 │ 149 │ test( 'Simple Test', function() { 28 │ 150 │ 29 │ 151 │ var a1 = new scenery.Node( { accessibleContent: accessibleContent } ); 30 │ 152 │ var a2 = new scenery.Node( { accessibleContent: accessibleContent } ); 31 │ 153 │ 32 │ 154 │ var b1 = new scenery.Node( { accessibleContent: accessibleContent } ); 33 │ 155 │ var b2 = new scenery.Node( { accessibleContent: accessibleContent } ); 34 │ 156 │ 35 │ 157 │ var a = new scenery.Node( { children: [ a1, a2 ] } ); 36 │ 158 │ var b = new scenery.Node( { children: [ b1, b2 ] } ); - ..\scenery\tests\qunit\js\focus.js: 137-145 ..\scenery\tests\qunit\js\focus.js: 160-168 137 │ 160 │ var root = new scenery.Node( { children: [ a, b ], accessibleOrder: [ b, b1, a ] } ); 138 │ 161 │ 139 │ 162 │ var nestedOrder = root.getNestedAccessibleOrder(); 140 │ 163 │ 141 │ 164 │ nestedEquality( nestedOrder, [ 142 │ 165 │ { trail: new scenery.Trail( [ root, b, b2 ] ), children: [] }, 143 │ 166 │ { trail: new scenery.Trail( [ root, b, b1 ] ), children: [] }, 144 │ 167 │ { trail: new scenery.Trail( [ root, a, a1 ] ), children: [] }, 145 │ 168 │ { trail: new scenery.Trail( [ root, a, a2 ] ), children: [] } - ..\scenery\tests\qunit\js\from-fuzzer.js: 14-30 ..\scenery\tests\qunit\js\from-fuzzer.js: 525-541 14 │ 525 │ var display = new scenery.Display( scene ); 15 │ 526 │ display.updateDisplay(); 16 │ 527 │ var node0 = new scenery.Node(); 17 │ 528 │ var node1 = new scenery.Node(); 18 │ 529 │ var node2 = new scenery.Node(); 19 │ 530 │ var node3 = new scenery.Node(); 20 │ 531 │ var node4 = new scenery.Node(); 21 │ 532 │ var node5 = new scenery.Node(); 22 │ 533 │ var node6 = new scenery.Node(); 23 │ 534 │ var path0 = new scenery.Path( null ); 24 │ 535 │ var path1 = new scenery.Path( null ); 25 │ 536 │ var path2 = new scenery.Path( null ); 26 │ 537 │ var path3 = new scenery.Path( null ); 27 │ 538 │ var text0 = new scenery.Text( '0!' ); 28 │ 539 │ var text1 = new scenery.Text( '1!' ); 29 │ 540 │ var text2 = new scenery.Text( '2!' ); 30 │ 541 │ node2.insertChild( 0, node0 ); - ..\scenery\tests\qunit\js\pixel-comparison.js: 633-647 ..\scenery\tests\qunit\js\pixel-comparison.js: 656-670 633 │ 656 │ var pattern = new scenery.Pattern( img ); 634 │ 657 │ scene.addChild( new scenery.Path( kite.Shape.regularPolygon( 6, 22 ), { 635 │ 658 │ x: 32, 636 │ 659 │ y: 32, 637 │ 660 │ rotation: Math.PI / 4, 638 │ 661 │ fill: pattern, 639 │ 662 │ stroke: '#000000', 640 │ 663 │ lineWidth: 3 641 │ 664 │ } ) ); 642 │ 665 │ display.updateDisplay(); 643 │ 666 │ asyncCallback(); 644 │ 667 │ }; 645 │ 668 │ img.src = patternUrl; 646 │ 669 │ }, 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAGvElEQVR4Xu2aB+h+UxjHP/belDJCRCRbQiGzkJHsrYzsLZSRbNm7jJC9siJCSPYqEdkke5Pdh3N03M6999z3fe+Pf7/3qbfet3vOec/zPc/4Ps+5UzHJZapJrj9jAMYWMMkRGLvAJDeAcRAcu8D/zAWWBzYD1gbeAXbre3//tQUskiis0nNWFL6qbxAmGgAVjCeswgLQJr2CMBEArAVsHsxaE2+Sd4FHgPmBDZOBvYHQBwAqmSrdpPDXQWGVviP4fRzvb60lSi8gjAIAzThVuOrHVQAeBZ4DHge+Cw9fBqYBPqoMvj1YT28gDAvAC0CbWb+UnLInvRywE7AiMFfQ7EvgeeAaQIBSuR7Yti9LGAYAT/7tjH1HP1ZZP6azKBsD1wFTA7NV5n4L/A5sD9ybyQa79AHCMADsClwZNuUp66Mq/GKN068G3AAsAExbM+ZX4INw4k9NBAjDAJAGqYOBcxqi3RzAvsAhwDyNeQA+B84CLgS+6RuEYQDQb2PAW6Hh5NVhJuAmYJMW5ePju4GtgR8z47W0kbnDoAAY+AyAij7fRmjmBQxm6xUC8CCwHfBZzfiRgTAoAAcBZ4fNXQ0YD5pkMeDGEPkNgE1iIDSmbAW81TBwJCAMCoDBztyvWLC4mSaZATgdOKDQAs4Djga+bxk/NAiDAvBHsrFFK6mubs/m/hML3MXUelzgBCV4DcUTBgHAIubhsDNNtY0IpUpcFALYzDWa/RCsyYzRRQZmjIMAYLo7MOzuXMB4oEhsfgk53uzwCfBzRgtdYYPACH8Kz2cMfv8AcERmjoCZPs08coXpAIlTKgPVDoMAkNLfLUIRs2qICasHAIz6Won09paMQlZ6SwNLhWevAa8C92fGGgylzesDHweQnwyU+enKeOcLriKl1lobpSsAnqynEEUuvwZg0NIC5gsPfgvFzZvAzSGg5TYSXUHTz8kpIRssDsQ1HfdpIEkG1ZQ2p0HxBOD4UQOQ0l8R9g80vVka6K2R/FTgpLbNVJ4fCxwV1s5N1RVc216DWUkxgEZO0kbO/prQ1QJShOUBmrpuMGuLcs8Ah2cqvbppmu4ZwMot6xoHDICmTK0vkjP7DG1l+UAApAhvFDa5bOHJ7gVcVjh2T+DSwrGvhEPYNCFnd1b6CLVLdbGAtPwV4Z2BC4CFCjaqj18RrCBG/rppZoQzA8GqS5fp3A+BfYA9kg5SCTnrbAEp/RXhy4FLgAULALCocaw+nUuN6RLTA6cBWoxFVJvYRdJirk3MvpScdYoB1fL3LuAeYMm2HYbn+weLKRm+H3B+yUDgdeBkwJpEKSnO/lm6iwuk5a8IS4eN7FsCbaZqD/BI4KFCpdYNVrBSy3hd67ZQNUZCVlKcdQagrvy1vrfFZRq0qZkTN+lpav5dxNSp1dSBKy8wDe4AHJYUZ5GcFf1XqQWY7y1QlCrC9vDc7OyAnR9F63Dt9wCbG3XcXkqrSKFzYu1gH3HhZE3HGYTtFmlV92XI2VdF2nfgAWn5q99XOzuarLlbVqglCIZ01fwf+4bpntYElghUWLD04zdCq7y6dyP6KoBzdENP/olAfnQpiZBcQOlanBUHwWrdbXtrm8pO5w6/BcDvNjdz9fwxAUCbpPFeQCIlYFqLAa0qWpa3RV8EAHzud6WuOCsyglIXcLESENr+VG6vXxszciJgsRnStlZ8npKzdRJaXDS/CwA5EAyAOxb9098WIwBmkCaxDSa1tYXWJtW7ia76FLtAupFB2lBGcrtBh7ZpFJ7LBB1frfmr06vFWWv5W12gM2Jhga4geFKWxdb1JU1R7wpNZ+mtUg67dB9tdxNZ7AcFIOcOTbe39gpuDU2NEiOwM2QjpM0CutxNjByALiDYONGn7eqUiAB4IZo2X6rzUnJWXP6OygW6xgTTmH1EzbStTpfE2Guw36hiddL1bqIXC4iLlsQEU5QlseVzHW2W5LwP7J50nnMn752EATB2pIvL3z4soAsI0uaLQ1e3WupaMkuJ9w7XaHHd+AKGEV7Wl7Og4vK3TwByMcEa3QuRVOzcWMDY7oogqPyzobB6LBQ2Kuyn7d6hM/1NNzNMFqjzzRLG6InZ+VkmLCIQpkiVbcvlxgV7E7kXMEoC7L/G9AFAzhKqtUN8kSqecltgtAMdla57AaOz8k7oC4AcCPbvvS0qeT8wvlcUlR5IuZJJfQKQA6FuT/G9oqhwcT1fomTTmL4BqAOh6f3AYXXqNH8iAIggmM7iC5Ej9eNOGlcGTxQAw+yx17ljAHqFdwpYfGwBU8Ah9brFsQX0Cu8UsPjYAqaAQ+p1i38CLVd1UD7ExigAAAAASUVORK5CYII=', 647 │ 670 │ 1, testedRenderers, true - ..\scenery\tests\qunit\js\scene.js: 216-221 ..\scenery\tests\qunit\js\scene.js: 262-267 216 │ 262 │ new scenery.TrailPointer( node.children[ 0 ].getUniqueTrail(), false ), 217 │ 263 │ new scenery.TrailPointer( node.children[ 0 ].children[ 0 ].getUniqueTrail(), true ), 218 │ 264 │ new scenery.TrailPointer( node.children[ 0 ].children[ 0 ].getUniqueTrail(), false ), 219 │ 265 │ new scenery.TrailPointer( node.children[ 0 ].children[ 1 ].getUniqueTrail(), true ), 220 │ 266 │ new scenery.TrailPointer( node.children[ 0 ].children[ 1 ].getUniqueTrail(), false ), 221 │ 267 │ new scenery.TrailPointer( node.children[ 0 ].children[ 1 ].children[ 0 ].getUniqueTrail(), true ), - ..\scenery\tests\qunit\js\scene.js: 222-227 ..\scenery\tests\qunit\js\scene.js: 268-273 222 │ 268 │ new scenery.TrailPointer( node.children[ 0 ].children[ 1 ].children[ 0 ].getUniqueTrail(), false ), 223 │ 269 │ new scenery.TrailPointer( node.children[ 0 ].children[ 2 ].getUniqueTrail(), true ), 224 │ 270 │ new scenery.TrailPointer( node.children[ 0 ].children[ 2 ].getUniqueTrail(), false ), 225 │ 271 │ new scenery.TrailPointer( node.children[ 0 ].children[ 3 ].getUniqueTrail(), true ), 226 │ 272 │ new scenery.TrailPointer( node.children[ 0 ].children[ 3 ].getUniqueTrail(), false ), 227 │ 273 │ new scenery.TrailPointer( node.children[ 0 ].children[ 3 ].children[ 0 ].getUniqueTrail(), true ), - ..\scenery\tests\qunit\js\scene.js: 234-239 ..\scenery\tests\qunit\js\scene.js: 281-286 234 │ 281 │ new scenery.TrailPointer( node.children[ 0 ].children[ 4 ].getUniqueTrail(), false ), 235 │ 282 │ new scenery.TrailPointer( node.children[ 1 ].getUniqueTrail(), true ), 236 │ 283 │ new scenery.TrailPointer( node.children[ 1 ].getUniqueTrail(), false ), 237 │ 284 │ new scenery.TrailPointer( node.children[ 2 ].getUniqueTrail(), true ), 238 │ 285 │ new scenery.TrailPointer( node.children[ 2 ].getUniqueTrail(), false ) 239 │ 286 │ ]; - ..\scenery\tests\qunit\js\scene.js: 314-319 ..\scenery\tests\qunit\js\scene.js: 335-340 314 │ 335 │ for ( var i = 0; i < pointers.length; i++ ) { 315 │ 336 │ for ( var j = i + 1; j < pointers.length; j++ ) { 316 │ 337 │ // i < j guaranteed 317 │ 338 │ var contents = []; 318 │ 339 │ pointers[ i ].depthFirstUntil( pointers[ j ], function( pointer ) { contents.push( pointer.copy() ); }, false ); 319 │ 340 │ equal( contents.length, j - i + 1, 'depthFirstUntil inclusive ' + i + ',' + j + ' count check' ); - ..\scenery\tests\qunit\js\scene.js: 691-704 ..\scenery\tests\qunit\js\scene.js: 762-775 691 │ 762 │ test( 'getTrails/getUniqueTrail', function() { 692 │ 763 │ var a = new scenery.Node(); 693 │ 764 │ var b = new scenery.Node(); 694 │ 765 │ var c = new scenery.Node(); 695 │ 766 │ var d = new scenery.Node(); 696 │ 767 │ var e = new scenery.Node(); 697 │ 768 │ 698 │ 769 │ // DAG-like structure 699 │ 770 │ a.addChild( b ); 700 │ 771 │ a.addChild( c ); 701 │ 772 │ b.addChild( d ); 702 │ 773 │ c.addChild( d ); 703 │ 774 │ c.addChild( e ); 704 │ 775 │ - ..\scenery\tests\qunit\js\shapes.js: 55-67 ..\scenery\tests\qunit\js\shapes.js: 84-96 55 │ 84 │ styles.lineJoin = 'miter'; 56 │ 85 │ 57 │ 86 │ var strokeShape = new Shape(); 58 │ 87 │ strokeShape.moveTo( 70, 70 ); 59 │ 88 │ strokeShape.lineTo( 140, 200 ); 60 │ 89 │ strokeShape.lineTo( 210, 70 ); 61 │ 90 │ var fillShape = strokeShape.getStrokedShape( styles ); 62 │ 91 │ 63 │ 92 │ strokeEqualsFill( strokeShape, fillShape, function( node ) { node.setLineStyles( styles ); }, QUnit.config.current.testName ); 64 │ 93 │ } ); 65 │ 94 │ 66 │ 95 │ test( 'Line Join - Miter - Closed', function() { 67 │ 96 │ var styles = new kite.LineStyles(); - ..\scenery\tests\qunit\js\shapes.js: 69-82 ..\scenery\tests\qunit\js\shapes.js: 98-111 69 │ 98 │ styles.lineJoin = 'miter'; 70 │ 99 │ 71 │ 100 │ var strokeShape = new Shape(); 72 │ 101 │ strokeShape.moveTo( 70, 70 ); 73 │ 102 │ strokeShape.lineTo( 140, 200 ); 74 │ 103 │ strokeShape.lineTo( 210, 70 ); 75 │ 104 │ strokeShape.close(); 76 │ 105 │ var fillShape = strokeShape.getStrokedShape( styles ); 77 │ 106 │ 78 │ 107 │ strokeEqualsFill( strokeShape, fillShape, function( node ) { node.setLineStyles( styles ); }, QUnit.config.current.testName ); 79 │ 108 │ } ); 80 │ 109 │ 81 │ 110 │ test( 'Line Join - Round', function() { 82 │ 111 │ var styles = new kite.LineStyles(); - ..\scenery\tests\qunit\js\shapes.js: 69-82 ..\scenery\tests\qunit\js\shapes.js: 113-126 69 │ 113 │ styles.lineJoin = 'miter'; 70 │ 114 │ 71 │ 115 │ var strokeShape = new Shape(); 72 │ 116 │ strokeShape.moveTo( 70, 70 ); 73 │ 117 │ strokeShape.lineTo( 140, 200 ); 74 │ 118 │ strokeShape.lineTo( 210, 70 ); 75 │ 119 │ strokeShape.close(); 76 │ 120 │ var fillShape = strokeShape.getStrokedShape( styles ); 77 │ 121 │ 78 │ 122 │ strokeEqualsFill( strokeShape, fillShape, function( node ) { node.setLineStyles( styles ); }, QUnit.config.current.testName ); 79 │ 123 │ } ); 80 │ 124 │ 81 │ 125 │ test( 'Line Join - Round', function() { 82 │ 126 │ var styles = new kite.LineStyles(); - ..\scenery\tests\qunit\js\test-utils.js: 249-256 ..\scenery\tests\qunit\js\test-utils.js: 251-258 249 │ 251 │ node.addChild( new scenery.Node() ); 250 │ 252 │ 251 │ 253 │ node.children[ 0 ].addChild( new scenery.Node() ); 252 │ 254 │ node.children[ 0 ].addChild( new scenery.Node() ); 253 │ 255 │ node.children[ 0 ].addChild( new scenery.Node() ); 254 │ 256 │ node.children[ 0 ].addChild( new scenery.Node() ); 255 │ 257 │ node.children[ 0 ].addChild( new scenery.Node() ); 256 │ 258 │ - ..\build-a-molecule\tests\qunit\unit-tests.js: 3-16 ..\scenery\tests\qunit\unit-tests.js: 3-16 3 │ 3 │ function runBuildAMoleculeTests( pathToTestBase ) { 4 │ 4 │ function loadTestFile( src ) { 5 │ 5 │ var script = document.createElement( 'script' ); 6 │ 6 │ script.type = 'text/javascript'; 7 │ 7 │ script.async = false; 8 │ 8 │ 9 │ 9 │ // make sure things aren't cached, just in case 10 │ 10 │ script.src = pathToTestBase + '/' + src + '?random=' + Math.random().toFixed( 10 ); 11 │ 11 │ 12 │ 12 │ document.getElementsByTagName( 'head' )[ 0 ].appendChild( script ); 13 │ 13 │ } 14 │ 14 │ 15 │ 15 │ loadTestFile( 'js/model.js' ); 16 │ 16 │ }; - ..\scenery-phet\js\buttons\RewindButton.js: 6-24 ..\scenery-phet\js\buttons\StepButton.js: 8-26 6 │ 8 │ */ 7 │ 9 │ define( function( require ) { 8 │ 10 │ 'use strict'; 9 │ 11 │ 10 │ 12 │ // modules 11 │ 13 │ var inherit = require( 'PHET_CORE/inherit' ); 12 │ 14 │ var RoundPushButton = require( 'SUN/buttons/RoundPushButton' ); 13 │ 15 │ var Shape = require( 'KITE/Shape' ); 14 │ 16 │ var Path = require( 'SCENERY/nodes/Path' ); 15 │ 17 │ var Rectangle = require( 'SCENERY/nodes/Rectangle' ); 16 │ 18 │ var HBox = require( 'SCENERY/nodes/HBox' ); 17 │ 19 │ var sceneryPhet = require( 'SCENERY_PHET/sceneryPhet' ); 18 │ 20 │ 19 │ 21 │ /** 20 │ 22 │ * @param {Object} [options] - see RoundPushButton 21 │ 23 │ * @constructor 22 │ 24 │ */ 23 │ 25 │ function RewindButton( options ) { 24 │ 26 │ - ..\scenery-phet\js\demo\ComponentsView.js: 573-642 ..\scenery-phet\js\demo\ComponentsView.js: 665-734 573 │ 665 │ var keysSet1 = [ 574 │ 666 │ { 575 │ 667 │ column: 0, 576 │ 668 │ row: 0, 577 │ 669 │ verticalSpan: 1, 578 │ 670 │ horizontalSpan: 1, 579 │ 671 │ content: '7' 580 │ 672 │ }, 581 │ 673 │ { 582 │ 674 │ column: 1, 583 │ 675 │ row: 0, 584 │ 676 │ verticalSpan: 1, 585 │ 677 │ horizontalSpan: 1, 586 │ 678 │ content: '8' 587 │ 679 │ }, 588 │ 680 │ { 589 │ 681 │ column: 2, 590 │ 682 │ row: 0, 591 │ 683 │ verticalSpan: 1, 592 │ 684 │ horizontalSpan: 1, 593 │ 685 │ content: '9' 594 │ 686 │ }, 595 │ 687 │ { 596 │ 688 │ column: 0, 597 │ 689 │ row: 1, 598 │ 690 │ verticalSpan: 1, 599 │ 691 │ horizontalSpan: 1, 600 │ 692 │ content: '4' 601 │ 693 │ }, 602 │ 694 │ { 603 │ 695 │ column: 1, 604 │ 696 │ row: 1, 605 │ 697 │ verticalSpan: 1, 606 │ 698 │ horizontalSpan: 1, 607 │ 699 │ content: '5' 608 │ 700 │ }, 609 │ 701 │ { 610 │ 702 │ column: 2, 611 │ 703 │ row: 1, 612 │ 704 │ verticalSpan: 1, 613 │ 705 │ horizontalSpan: 1, 614 │ 706 │ content: '6' 615 │ 707 │ }, 616 │ 708 │ { 617 │ 709 │ column: 0, 618 │ 710 │ row: 2, 619 │ 711 │ verticalSpan: 1, 620 │ 712 │ horizontalSpan: 1, 621 │ 713 │ content: '1' 622 │ 714 │ }, 623 │ 715 │ { 624 │ 716 │ column: 1, 625 │ 717 │ row: 2, 626 │ 718 │ verticalSpan: 1, 627 │ 719 │ horizontalSpan: 1, 628 │ 720 │ content: '2' 629 │ 721 │ }, 630 │ 722 │ { 631 │ 723 │ column: 2, 632 │ 724 │ row: 2, 633 │ 725 │ verticalSpan: 1, 634 │ 726 │ horizontalSpan: 1, 635 │ 727 │ content: '3' 636 │ 728 │ }, 637 │ 729 │ { 638 │ 730 │ column: 0, 639 │ 731 │ row: 3, 640 │ 732 │ verticalSpan: 1, 641 │ 733 │ horizontalSpan: 1, 642 │ 734 │ content: backSpaceIconLayout1 - ..\scenery-phet\js\demo\ComponentsView.js: 573-643 ..\scenery-phet\js\demo\ComponentsView.js: 750-820 573 │ 750 │ var keysSet1 = [ 574 │ 751 │ { 575 │ 752 │ column: 0, 576 │ 753 │ row: 0, 577 │ 754 │ verticalSpan: 1, 578 │ 755 │ horizontalSpan: 1, 579 │ 756 │ content: '7' 580 │ 757 │ }, 581 │ 758 │ { 582 │ 759 │ column: 1, 583 │ 760 │ row: 0, 584 │ 761 │ verticalSpan: 1, 585 │ 762 │ horizontalSpan: 1, 586 │ 763 │ content: '8' 587 │ 764 │ }, 588 │ 765 │ { 589 │ 766 │ column: 2, 590 │ 767 │ row: 0, 591 │ 768 │ verticalSpan: 1, 592 │ 769 │ horizontalSpan: 1, 593 │ 770 │ content: '9' 594 │ 771 │ }, 595 │ 772 │ { 596 │ 773 │ column: 0, 597 │ 774 │ row: 1, 598 │ 775 │ verticalSpan: 1, 599 │ 776 │ horizontalSpan: 1, 600 │ 777 │ content: '4' 601 │ 778 │ }, 602 │ 779 │ { 603 │ 780 │ column: 1, 604 │ 781 │ row: 1, 605 │ 782 │ verticalSpan: 1, 606 │ 783 │ horizontalSpan: 1, 607 │ 784 │ content: '5' 608 │ 785 │ }, 609 │ 786 │ { 610 │ 787 │ column: 2, 611 │ 788 │ row: 1, 612 │ 789 │ verticalSpan: 1, 613 │ 790 │ horizontalSpan: 1, 614 │ 791 │ content: '6' 615 │ 792 │ }, 616 │ 793 │ { 617 │ 794 │ column: 0, 618 │ 795 │ row: 2, 619 │ 796 │ verticalSpan: 1, 620 │ 797 │ horizontalSpan: 1, 621 │ 798 │ content: '1' 622 │ 799 │ }, 623 │ 800 │ { 624 │ 801 │ column: 1, 625 │ 802 │ row: 2, 626 │ 803 │ verticalSpan: 1, 627 │ 804 │ horizontalSpan: 1, 628 │ 805 │ content: '2' 629 │ 806 │ }, 630 │ 807 │ { 631 │ 808 │ column: 2, 632 │ 809 │ row: 2, 633 │ 810 │ verticalSpan: 1, 634 │ 811 │ horizontalSpan: 1, 635 │ 812 │ content: '3' 636 │ 813 │ }, 637 │ 814 │ { 638 │ 815 │ column: 0, 639 │ 816 │ row: 3, 640 │ 817 │ verticalSpan: 1, 641 │ 818 │ horizontalSpan: 1, 642 │ 819 │ content: backSpaceIconLayout1 643 │ 820 │ }, - ..\scenery-phet\js\demo\ComponentsView.js: 573-597 ..\scenery-phet\js\demo\ComponentsView.js: 835-859 573 │ 835 │ var keysSet1 = [ 574 │ 836 │ { 575 │ 837 │ column: 0, 576 │ 838 │ row: 0, 577 │ 839 │ verticalSpan: 1, 578 │ 840 │ horizontalSpan: 1, 579 │ 841 │ content: '7' 580 │ 842 │ }, 581 │ 843 │ { 582 │ 844 │ column: 1, 583 │ 845 │ row: 0, 584 │ 846 │ verticalSpan: 1, 585 │ 847 │ horizontalSpan: 1, 586 │ 848 │ content: '8' 587 │ 849 │ }, 588 │ 850 │ { 589 │ 851 │ column: 2, 590 │ 852 │ row: 0, 591 │ 853 │ verticalSpan: 1, 592 │ 854 │ horizontalSpan: 1, 593 │ 855 │ content: '9' 594 │ 856 │ }, 595 │ 857 │ { 596 │ 858 │ column: 0, 597 │ 859 │ row: 1, - ..\scenery-phet\js\demo\ComponentsView.js: 594-618 ..\scenery-phet\js\demo\ComponentsView.js: 863-887 594 │ 863 │ }, 595 │ 864 │ { 596 │ 865 │ column: 0, 597 │ 866 │ row: 1, 598 │ 867 │ verticalSpan: 1, 599 │ 868 │ horizontalSpan: 1, 600 │ 869 │ content: '4' 601 │ 870 │ }, 602 │ 871 │ { 603 │ 872 │ column: 1, 604 │ 873 │ row: 1, 605 │ 874 │ verticalSpan: 1, 606 │ 875 │ horizontalSpan: 1, 607 │ 876 │ content: '5' 608 │ 877 │ }, 609 │ 878 │ { 610 │ 879 │ column: 2, 611 │ 880 │ row: 1, 612 │ 881 │ verticalSpan: 1, 613 │ 882 │ horizontalSpan: 1, 614 │ 883 │ content: '6' 615 │ 884 │ }, 616 │ 885 │ { 617 │ 886 │ column: 0, 618 │ 887 │ row: 2, - ..\scenery-phet\js\demo\ComponentsView.js: 615-639 ..\scenery-phet\js\demo\ComponentsView.js: 891-915 615 │ 891 │ }, 616 │ 892 │ { 617 │ 893 │ column: 0, 618 │ 894 │ row: 2, 619 │ 895 │ verticalSpan: 1, 620 │ 896 │ horizontalSpan: 1, 621 │ 897 │ content: '1' 622 │ 898 │ }, 623 │ 899 │ { 624 │ 900 │ column: 1, 625 │ 901 │ row: 2, 626 │ 902 │ verticalSpan: 1, 627 │ 903 │ horizontalSpan: 1, 628 │ 904 │ content: '2' 629 │ 905 │ }, 630 │ 906 │ { 631 │ 907 │ column: 2, 632 │ 908 │ row: 2, 633 │ 909 │ verticalSpan: 1, 634 │ 910 │ horizontalSpan: 1, 635 │ 911 │ content: '3' 636 │ 912 │ }, 637 │ 913 │ { 638 │ 914 │ column: 0, 639 │ 915 │ row: 3, - ..\scenery-phet\js\CanvasWarningNode.js: 4-22 ..\scenery-phet\js\IE11StencilWarningNode.js: 6-24 4 │ 6 │ * 5 │ 7 │ * @author Jonathan Olson 6 │ 8 │ */ 7 │ 9 │ define( function( require ) { 8 │ 10 │ 'use strict'; 9 │ 11 │ 10 │ 12 │ // modules 11 │ 13 │ var inherit = require( 'PHET_CORE/inherit' ); 12 │ 14 │ var HBox = require( 'SCENERY/nodes/HBox' ); 13 │ 15 │ var VBox = require( 'SCENERY/nodes/VBox' ); 14 │ 16 │ var Text = require( 'SCENERY/nodes/Text' ); 15 │ 17 │ var PhetFont = require( 'SCENERY_PHET/PhetFont' ); 16 │ 18 │ var FontAwesomeNode = require( 'SUN/FontAwesomeNode' ); 17 │ 19 │ var sceneryPhet = require( 'SCENERY_PHET/sceneryPhet' ); 18 │ 20 │ 19 │ 21 │ // strings 20 │ 22 │ var webglWarningTitleString = require( 'string!SCENERY_PHET/webglWarning.title' ); 21 │ 23 │ var webglWarningBodyString = require( 'string!SCENERY_PHET/webglWarning.body' ); 22 │ 24 │ - ..\scenery-phet\js\CanvasWarningNode.js: 39-58 ..\scenery-phet\js\IE11StencilWarningNode.js: 41-60 39 │ 41 │ new Text( webglWarningBodyString, { 40 │ 42 │ font: new PhetFont( 10 ), 41 │ 43 │ fill: '#999' 42 │ 44 │ } ) 43 │ 45 │ ], 44 │ 46 │ spacing: 3, 45 │ 47 │ align: 'left' 46 │ 48 │ } ) 47 │ 49 │ ], 48 │ 50 │ spacing: 12, 49 │ 51 │ align: 'center', 50 │ 52 │ cursor: 'pointer' 51 │ 53 │ } ) ); 52 │ 54 │ 53 │ 55 │ this.mouseArea = this.touchArea = this.localBounds; 54 │ 56 │ 55 │ 57 │ this.addInputListener( { 56 │ 58 │ up: function() { 57 │ 59 │ var phetWindow = window.open( 'http://phet.colorado.edu/webgl-disabled-page?simLocale=' + phet.joist.sim.locale, '_blank' ); 58 │ 60 │ phetWindow.focus(); - ..\balloons-and-static-electricity\js\balloons-and-static-electricity\accessibility\AccessibleDragNode.js: 236-257 ..\scenery-phet\js\input\MovableDragHandler.js: 92-113 236 │ 92 │ /** 237 │ 93 │ * Sets the dragBounds. 238 │ 94 │ * In addition, it forces the location to be within the bounds. 239 │ 95 │ * @param {Bounds2} dragBounds 240 │ 96 │ * @public 241 │ 97 │ */ 242 │ 98 │ setDragBounds: function( dragBounds ) { 243 │ 99 │ this._dragBounds = dragBounds.copy(); 244 │ 100 │ this.locationProperty.set( this._dragBounds.closestPointTo( this.locationProperty.get() ) ); 245 │ 101 │ }, 246 │ 102 │ set dragBounds( value ) { this.setDragBounds( value ); }, 247 │ 103 │ 248 │ 104 │ /** 249 │ 105 │ * Gets the dragBounds. Clients should not mutate the value returned. 250 │ 106 │ * @returns {Bounds2} 251 │ 107 │ * @public 252 │ 108 │ */ 253 │ 109 │ getDragBounds: function() { 254 │ 110 │ return this._dragBounds; 255 │ 111 │ }, 256 │ 112 │ get dragBounds() { return this.getDragBounds(); }, 257 │ 113 │ } ); - ..\circuit-construction-kit-common\js\common\view\CustomLightBulbNode.js: 68-75 ..\scenery-phet\js\LightBulbNode.js: 59-66 68 │ 59 │ var bulbRadius = offNode.width / 2; // use 'off' node, the 'on' node is wider because it has a glow around it. 69 │ 60 │ var rayOptions = _.pick( options, _.keys( defaultOptions ) ); // cherry-pick options that are specific to rays 70 │ 61 │ rayOptions.x = this.onNode.centerX; 71 │ 62 │ rayOptions.y = offNode.top + bulbRadius; 72 │ 63 │ self.raysNode = new LightRaysNode( bulbRadius, rayOptions ); // @private 73 │ 64 │ 74 │ 65 │ options.children = [ self.raysNode, offNode, self.onNode ]; 75 │ 66 │ } - ..\circuit-construction-kit-common\js\common\view\CustomLightBulbNode.js: 118-145 ..\scenery-phet\js\LightBulbNode.js: 79-106 118 │ 79 │ this.disposeCustomLightBulbNode(); 119 │ 80 │ }, 120 │ 81 │ 121 │ 82 │ // @private 122 │ 83 │ update: function() { 123 │ 84 │ if ( this.visible ) { 124 │ 85 │ var brightness = this.brightnessProperty.value; 125 │ 86 │ assert && assert( brightness >= 0 && brightness <= 1 ); 126 │ 87 │ this.onNode.visible = ( brightness > 0 ); 127 │ 88 │ if ( this.onNode.visible ) { 128 │ 89 │ this.onNode.opacity = Util.linear( 0, 1, 0.3, 1, brightness ); 129 │ 90 │ } 130 │ 91 │ this.raysNode.setBrightness( brightness ); 131 │ 92 │ } 132 │ 93 │ }, 133 │ 94 │ 134 │ 95 │ // @override update when this node becomes visible 135 │ 96 │ setVisible: function( visible ) { 136 │ 97 │ var wasVisible = this.visible; 137 │ 98 │ Node.prototype.setVisible.call( this, visible ); 138 │ 99 │ if ( !wasVisible && visible ) { 139 │ 100 │ this.update(); 140 │ 101 │ } 141 │ 102 │ } 142 │ 103 │ } ); 143 │ 104 │ 144 │ 105 │ return CustomLightBulbNode; 145 │ 106 │ } ); - ..\griddle\js\griddle-config.js: 4-28 ..\scenery-phet\js\scenery-phet-config.js: 4-28 4 │ 4 │ deps: [ 'griddle-main' ], 5 │ 5 │ 6 │ 6 │ paths: { 7 │ 7 │ 8 │ 8 │ // third party libs 9 │ 9 │ text: '../../sherpa/lib/text-2.0.12', 10 │ 10 │ 11 │ 11 │ // plugins 12 │ 12 │ image: '../../chipper/js/requirejs-plugins/image', 13 │ 13 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 14 │ 14 │ string: '../../chipper/js/requirejs-plugins/string', 15 │ 15 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 16 │ 16 │ 17 │ 17 │ // PhET libs, uppercase names to identify them in require.js imports 18 │ 18 │ AXON: '../../axon/js', 19 │ 19 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 20 │ 20 │ DOT: '../../dot/js', 21 │ 21 │ JOIST: '../../joist/js', 22 │ 22 │ KITE: '../../kite/js', 23 │ 23 │ PHETCOMMON: '../../phetcommon/js', 24 │ 24 │ REPOSITORY: '..', 25 │ 25 │ PHET_CORE: '../../phet-core/js', 26 │ 26 │ PHET_IO: '../../phet-io/js', 27 │ 27 │ SCENERY: '../../scenery/js', 28 │ 28 │ SCENERY_PHET: '../../scenery-phet/js', - ..\phet-io\wrappers\lab-book\beers-law-lab.js: 20-68 ..\scenery-phet\js\VisibleColor.js: 119-167 20 │ 119 │ var b; 21 │ 120 │ 22 │ 121 │ // Determine the RGB component values. 23 │ 122 │ if ( wavelength >= 380 && wavelength <= 440 ) { 24 │ 123 │ r = -1 * ( wavelength - 440 ) / ( 440 - 380 ); 25 │ 124 │ g = 0; 26 │ 125 │ b = 1; 27 │ 126 │ } 28 │ 127 │ else if ( wavelength > 440 && wavelength <= 490 ) { 29 │ 128 │ r = 0; 30 │ 129 │ g = ( wavelength - 440 ) / ( 490 - 440 ); 31 │ 130 │ b = 1; 32 │ 131 │ } 33 │ 132 │ else if ( wavelength > 490 && wavelength <= 510 ) { 34 │ 133 │ r = 0; 35 │ 134 │ g = 1; 36 │ 135 │ b = -1 * ( wavelength - 510 ) / ( 510 - 490 ); 37 │ 136 │ } 38 │ 137 │ else if ( wavelength > 510 && wavelength <= 580 ) { 39 │ 138 │ r = ( wavelength - 510 ) / ( 580 - 510 ); 40 │ 139 │ g = 1; 41 │ 140 │ b = 0; 42 │ 141 │ } 43 │ 142 │ else if ( wavelength > 580 && wavelength <= 645 ) { 44 │ 143 │ r = 1; 45 │ 144 │ g = -1 * ( wavelength - 645 ) / ( 645 - 580 ); 46 │ 145 │ b = 0; 47 │ 146 │ } 48 │ 147 │ else if ( wavelength > 645 && wavelength <= 780 ) { 49 │ 148 │ r = 1; 50 │ 149 │ g = 0; 51 │ 150 │ b = 0; 52 │ 151 │ } 53 │ 152 │ 54 │ 153 │ // Let the intensity fall off near the vision limits. 55 │ 154 │ var intensity; 56 │ 155 │ if ( wavelength > 645 ) { 57 │ 156 │ intensity = 0.3 + 0.7 * ( 780 - wavelength ) / ( 780 - 645 ); 58 │ 157 │ } 59 │ 158 │ else if ( wavelength < 420 ) { 60 │ 159 │ intensity = 0.3 + 0.7 * ( wavelength - 380 ) / ( 420 - 380 ); 61 │ 160 │ } 62 │ 161 │ else { 63 │ 162 │ intensity = 1; 64 │ 163 │ } 65 │ 164 │ var red = Math.round( 255 * ( intensity * r ) ); 66 │ 165 │ var green = Math.round( 255 * ( intensity * g ) ); 67 │ 166 │ var blue = Math.round( 255 * ( intensity * b ) ); 68 │ 167 │ - ..\fraction-comparison\js\intro\view\NodeDragHandler.js: 16-55 ..\seasons\js\intensity\view\NodeDragHandler.js: 12-51 16 │ 12 │ var fractionComparison = require( 'FRACTION_COMPARISON/fractionComparison' ); 17 │ 13 │ var inherit = require( 'PHET_CORE/inherit' ); 18 │ 14 │ var SimpleDragHandler = require( 'SCENERY/input/SimpleDragHandler' ); 19 │ 15 │ var Vector2 = require( 'DOT/Vector2' ); 20 │ 16 │ 21 │ 17 │ function NodeDragHandler( node, options ) { 22 │ 18 │ 23 │ 19 │ options = _.extend( { 24 │ 20 │ startDrag: function() {}, 25 │ 21 │ drag: function() {}, 26 │ 22 │ endDrag: function() { /* do nothing */ } // use this to do things at the end of dragging, like 'snapping' 27 │ 23 │ }, options ); 28 │ 24 │ 29 │ 25 │ var startOffset; // where the drag started, relative to the Movable's origin, in parent view coordinates 30 │ 26 │ 31 │ 27 │ SimpleDragHandler.call( this, { 32 │ 28 │ 33 │ 29 │ allowTouchSnag: true, 34 │ 30 │ 35 │ 31 │ // note where the drag started 36 │ 32 │ start: function( event ) { 37 │ 33 │ startOffset = event.currentTarget.globalToParentPoint( event.pointer.point ).minusXY( node.x, node.y ); 38 │ 34 │ options.startDrag(); 39 │ 35 │ }, 40 │ 36 │ 41 │ 37 │ // change the location, adjust for starting offset, constrain to drag bounds 42 │ 38 │ drag: function( event ) { 43 │ 39 │ var parentPoint = event.currentTarget.globalToParentPoint( event.pointer.point ).minus( startOffset ); 44 │ 40 │ var location = parentPoint; 45 │ 41 │ var constrainedLocation = constrainBounds( location, options.dragBounds ); 46 │ 42 │ node.setTranslation( constrainedLocation ); 47 │ 43 │ options.drag( event ); 48 │ 44 │ }, 49 │ 45 │ 50 │ 46 │ end: function( event ) { 51 │ 47 │ options.endDrag( event ); 52 │ 48 │ } 53 │ 49 │ } ); 54 │ 50 │ } 55 │ 51 │ - ..\fraction-comparison\js\intro\view\NodeDragHandler.js: 56-78 ..\seasons\js\intensity\view\NodeDragHandler.js: 52-74 56 │ 52 │ fractionComparison.register( 'NodeDragHandler', NodeDragHandler ); 57 │ 53 │ 58 │ 54 │ inherit( SimpleDragHandler, NodeDragHandler ); 59 │ 55 │ 60 │ 56 │ /** 61 │ 57 │ * Constrains a point to some bounds. 62 │ 58 │ * @param {Vector2} point 63 │ 59 │ * @param {Bounds2} bounds 64 │ 60 │ */ 65 │ 61 │ var constrainBounds = function( point, bounds ) { 66 │ 62 │ if ( _.isUndefined( bounds ) || bounds.containsCoordinates( point.x, point.y ) ) { 67 │ 63 │ return point; 68 │ 64 │ } 69 │ 65 │ else { 70 │ 66 │ var xConstrained = Math.max( Math.min( point.x, bounds.maxX ), bounds.x ); 71 │ 67 │ var yConstrained = Math.max( Math.min( point.y, bounds.maxY ), bounds.y ); 72 │ 68 │ return new Vector2( xConstrained, yConstrained ); 73 │ 69 │ } 74 │ 70 │ }; 75 │ 71 │ 76 │ 72 │ return NodeDragHandler; 77 │ 73 │ } ); - ..\seasons\js\intensity\view\NodeDragHandler.js: 2-34 ..\seasons\js\intensity\view\NodeDragHandler3D.js: 2-34 2 │ 2 │ /** 3 │ 3 │ * Copied from fractions-intro, should be factored out//TODO 4 │ 4 │ * 5 │ 5 │ * @author Chris Malley (PixelZoom, Inc.) 6 │ 6 │ * @author Sam Reid 7 │ 7 │ */ 8 │ 8 │ define( function( require ) { 9 │ 9 │ 'use strict'; 10 │ 10 │ 11 │ 11 │ // modules 12 │ 12 │ var seasons = require( 'SEASONS/seasons' ); 13 │ 13 │ var inherit = require( 'PHET_CORE/inherit' ); 14 │ 14 │ var SimpleDragHandler = require( 'SCENERY/input/SimpleDragHandler' ); 15 │ 15 │ var Vector2 = require( 'DOT/Vector2' ); 16 │ 16 │ 17 │ 17 │ function NodeDragHandler( node, options ) { 18 │ 18 │ 19 │ 19 │ options = _.extend( { 20 │ 20 │ startDrag: function() {}, 21 │ 21 │ drag: function() {}, 22 │ 22 │ endDrag: function() { /* do nothing */ } // use this to do things at the end of dragging, like 'snapping' 23 │ 23 │ }, options ); 24 │ 24 │ 25 │ 25 │ var startOffset; // where the drag started, relative to the Movable's origin, in parent view coordinates 26 │ 26 │ 27 │ 27 │ SimpleDragHandler.call( this, { 28 │ 28 │ 29 │ 29 │ allowTouchSnag: true, 30 │ 30 │ 31 │ 31 │ // note where the drag started 32 │ 32 │ start: function( event ) { 33 │ 33 │ startOffset = event.currentTarget.globalToParentPoint( event.pointer.point ).minusXY( node.x, node.y ); 34 │ 34 │ options.startDrag(); - ..\seasons\js\intensity\view\NodeDragHandler.js: 42-74 ..\seasons\js\intensity\view\NodeDragHandler3D.js: 44-76 42 │ 44 │ node.setTranslation( constrainedLocation ); 43 │ 45 │ options.drag( event ); 44 │ 46 │ }, 45 │ 47 │ 46 │ 48 │ end: function( event ) { 47 │ 49 │ options.endDrag( event ); 48 │ 50 │ } 49 │ 51 │ } ); 50 │ 52 │ } 51 │ 53 │ 52 │ 54 │ seasons.register( 'NodeDragHandler', NodeDragHandler ); 53 │ 55 │ 54 │ 56 │ inherit( SimpleDragHandler, NodeDragHandler ); 55 │ 57 │ 56 │ 58 │ /** 57 │ 59 │ * Constrains a point to some bounds. 58 │ 60 │ * @param {Vector2} point 59 │ 61 │ * @param {Bounds2} bounds 60 │ 62 │ */ 61 │ 63 │ var constrainBounds = function( point, bounds ) { 62 │ 64 │ if ( _.isUndefined( bounds ) || bounds.containsCoordinates( point.x, point.y ) ) { 63 │ 65 │ return point; 64 │ 66 │ } 65 │ 67 │ else { 66 │ 68 │ var xConstrained = Math.max( Math.min( point.x, bounds.maxX ), bounds.x ); 67 │ 69 │ var yConstrained = Math.max( Math.min( point.y, bounds.maxY ), bounds.y ); 68 │ 70 │ return new Vector2( xConstrained, yConstrained ); 69 │ 71 │ } 70 │ 72 │ }; 71 │ 73 │ 72 │ 74 │ return NodeDragHandler; 73 │ 75 │ } ); - ..\seasons\js\intensity\view\PanelNode.js: 276-285 ..\seasons\js\intensity\view\TargetOutlineNode.js: 31-40 276 │ 31 │ var up = Vector2.createPolar( HEIGHT, this.panelModel.angle + Math.PI / 2 ); 277 │ 32 │ var centerLeft = new Vector2( x, y ); 278 │ 33 │ var bottomLeft = centerLeft.plus( up.times( -0.5 * scale ) ); 279 │ 34 │ var topLeft = bottomLeft.plus( up.times( scale ) ); 280 │ 35 │ 281 │ 36 │ //TODO: Should be a function of the angle 282 │ 37 │ var extensionLength = 60 * 0.9 * scale; 283 │ 38 │ var topRight = topLeft.plus( new Vector2( this.playAreaCenter.x * 2 + x, y ).minus( topLeft ).normalized().times( extensionLength ) ); 284 │ 39 │ var bottomRight = bottomLeft.plus( new Vector2( this.playAreaCenter.x * 2 + x, y ).minus( bottomLeft ).normalized().times( extensionLength ) ); 285 │ 40 │ - ..\estimation\js\estimation-config.js: 11-40 ..\seasons\js\seasons-config.js: 10-39 11 │ 10 │ deps: [ 'estimation-main' ], 12 │ 11 │ 13 │ 12 │ paths: { 14 │ 13 │ 15 │ 14 │ // third-party libs 16 │ 15 │ text: '../../sherpa/lib/text-2.0.12', 17 │ 16 │ 18 │ 17 │ // PhET plugins 19 │ 18 │ image: '../../chipper/js/requirejs-plugins/image', 20 │ 19 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 21 │ 20 │ string: '../../chipper/js/requirejs-plugins/string', 22 │ 21 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 23 │ 22 │ 24 │ 23 │ // PhET libs, uppercase names to identify them in require.js imports 25 │ 24 │ AXON: '../../axon/js', 26 │ 25 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 27 │ 26 │ DOT: '../../dot/js', 28 │ 27 │ JOIST: '../../joist/js', 29 │ 28 │ KITE: '../../kite/js', 30 │ 29 │ PHET_CORE: '../../phet-core/js', 31 │ 30 │ PHET_IO: '../../phet-io/js', 32 │ 31 │ PHETCOMMON: '../../phetcommon/js', 33 │ 32 │ REPOSITORY: '..', 34 │ 33 │ SCENERY: '../../scenery/js', 35 │ 34 │ SCENERY_PHET: '../../scenery-phet/js', 36 │ 35 │ SUN: '../../sun/js', 37 │ 36 │ TANDEM: '../../tandem/js', 38 │ 37 │ VIBE: '../../vibe/js', 39 │ 38 │ VEGAS: '../../vegas/js', 40 │ 39 │ - ..\shred\js\model\ParticleAtom.js: 133-142 ..\shred\js\model\ParticleAtom.js: 145-154 133 │ 145 │ this.nucleusOffsetProperty.link( function( newOffset, oldOffset ) { 134 │ 146 │ var translation = oldOffset === null ? Vector2.ZERO : newOffset.minus( oldOffset ); 135 │ 147 │ self.protons.forEach( function( particle ) { 136 │ 148 │ translateParticle( particle, translation ); 137 │ 149 │ } ); 138 │ 150 │ self.neutrons.forEach( function( particle ) { 139 │ 151 │ translateParticle( particle, translation ); 140 │ 152 │ } ); 141 │ 153 │ } ); 142 │ 154 │ - ..\griddle\js\griddle-config.js: 4-33 ..\shred\js\shred-config.js: 4-33 4 │ 4 │ deps: [ 'griddle-main' ], 5 │ 5 │ 6 │ 6 │ paths: { 7 │ 7 │ 8 │ 8 │ // third party libs 9 │ 9 │ text: '../../sherpa/lib/text-2.0.12', 10 │ 10 │ 11 │ 11 │ // plugins 12 │ 12 │ image: '../../chipper/js/requirejs-plugins/image', 13 │ 13 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 14 │ 14 │ string: '../../chipper/js/requirejs-plugins/string', 15 │ 15 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 16 │ 16 │ 17 │ 17 │ // PhET libs, uppercase names to identify them in require.js imports 18 │ 18 │ AXON: '../../axon/js', 19 │ 19 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 20 │ 20 │ DOT: '../../dot/js', 21 │ 21 │ JOIST: '../../joist/js', 22 │ 22 │ KITE: '../../kite/js', 23 │ 23 │ PHETCOMMON: '../../phetcommon/js', 24 │ 24 │ REPOSITORY: '..', 25 │ 25 │ PHET_CORE: '../../phet-core/js', 26 │ 26 │ PHET_IO: '../../phet-io/js', 27 │ 27 │ SCENERY: '../../scenery/js', 28 │ 28 │ SCENERY_PHET: '../../scenery-phet/js', 29 │ 29 │ SHERPA: '../../sherpa', 30 │ 30 │ SUN: '../../sun/js', 31 │ 31 │ TANDEM: '../../tandem/js', 32 │ 32 │ 33 │ 33 │ // this app - ..\build-an-atom\js\common\view\AtomView.js: 114-152 ..\shred\js\view\InteractiveSchematicAtom.js: 75-113 114 │ 75 │ } ) ); 115 │ 76 │ // Add a listener that adjusts a nucleon's z-order layering. 116 │ 77 │ nucleon.zLayerProperty.link( function( zLayer ) { 117 │ 78 │ assert && assert( nucleonLayers.length > zLayer, 'zLayer for nucleon exceeds number of layers, max number may need increasing.' ); 118 │ 79 │ // Determine whether nucleon view is on the correct layer. 119 │ 80 │ var onCorrectLayer = false; 120 │ 81 │ nucleonLayers[ zLayer ].children.forEach( function( particleView ) { 121 │ 82 │ if ( particleView.particle === nucleon ) { 122 │ 83 │ onCorrectLayer = true; 123 │ 84 │ } 124 │ 85 │ } ); 125 │ 86 │ 126 │ 87 │ if ( !onCorrectLayer ) { 127 │ 88 │ 128 │ 89 │ // Remove particle view from its current layer. 129 │ 90 │ var particleView = null; 130 │ 91 │ for ( var layerIndex = 0; layerIndex < nucleonLayers.length && particleView === null; layerIndex++ ) { 131 │ 92 │ for ( var childIndex = 0; childIndex < nucleonLayers[ layerIndex ].children.length; childIndex++ ) { 132 │ 93 │ if ( nucleonLayers[ layerIndex ].children[ childIndex ].particle === nucleon ) { 133 │ 94 │ particleView = nucleonLayers[ layerIndex ].children[ childIndex ]; 134 │ 95 │ nucleonLayers[ layerIndex ].removeChildAt( childIndex ); 135 │ 96 │ break; 136 │ 97 │ } 137 │ 98 │ } 138 │ 99 │ } 139 │ 100 │ 140 │ 101 │ // Add the particle view to its new layer. 141 │ 102 │ assert && assert( particleView !== null, 'Particle view not found during relayering' ); 142 │ 103 │ nucleonLayers[ zLayer ].addChild( particleView ); 143 │ 104 │ } 144 │ 105 │ } ); 145 │ 106 │ } ); 146 │ 107 │ 147 │ 108 │ // Add the electron particle views. 148 │ 109 │ model.electrons.forEach( function( electron ) { 149 │ 110 │ electronLayer.addChild( new ParticleView( electron, modelViewTransform, { 150 │ 111 │ tandem: electronsTandem.createNextTandem() 151 │ 112 │ } ) ); 152 │ 113 │ } ); - ..\build-an-atom\js\common\view\AtomView.js: 156-165 ..\shred\js\view\InteractiveSchematicAtom.js: 119-128 156 │ 119 │ var updateElectronVisibility = function() { 157 │ 120 │ electronLayer.getChildren().forEach( function( electronNode ) { 158 │ 121 │ electronNode.visible = model.electronShellDepictionProperty.get() === 'orbits' || !model.particleAtom.electrons.contains( electronNode.particle ); 159 │ 122 │ } ); 160 │ 123 │ }; 161 │ 124 │ model.particleAtom.electrons.lengthProperty.link( updateElectronVisibility ); 162 │ 125 │ model.electronShellDepictionProperty.link( updateElectronVisibility ); 163 │ 126 │ 164 │ 127 │ // Add the front portion of the buckets. This is done separately from the bucket holes for layering purposes. 165 │ 128 │ var bucketFrontLayer = new Node(); - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-44 ..\simula-rasa\js\simula-rasa-config.js: 11-44 11 │ 11 │ deps: [ 'area-model-multiplication-main' ], 12 │ 12 │ 13 │ 13 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 14 │ 15 │ 15 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 16 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 17 │ paths: { 18 │ 18 │ 19 │ 19 │ // third-party libs 20 │ 20 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 21 │ 22 │ 22 │ // PhET plugins 23 │ 23 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 24 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 25 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 26 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 27 │ 28 │ 28 │ // common directories, uppercase names to identify them in require imports 29 │ 29 │ AXON: '../../axon/js', 30 │ 30 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 31 │ DOT: '../../dot/js', 32 │ 32 │ JOIST: '../../joist/js', 33 │ 33 │ KITE: '../../kite/js', 34 │ 34 │ PHET_CORE: '../../phet-core/js', 35 │ 35 │ PHET_IO: '../../phet-io/js', 36 │ 36 │ PHETCOMMON: '../../phetcommon/js', 37 │ 37 │ REPOSITORY: '..', 38 │ 38 │ SCENERY: '../../scenery/js', 39 │ 39 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 40 │ SUN: '../../sun/js', 41 │ 41 │ TANDEM: '../../tandem/js', 42 │ 42 │ 43 │ 43 │ // this sim 44 │ 44 │ AREA_MODEL_MULTIPLICATION: '.' - ..\fluid-pressure-and-flow\js\flow\view\FlowView.js: 229-244 ..\states-of-matter\js\atomic-interactions\view\AtomicInteractionsScreenView.js: 197-212 229 │ 197 │ ( slowMotionRadioBox.localBounds.minX + speedControlMaxWidth ), 230 │ 198 │ slowMotionRadioBox.localBounds.maxY + touchAreaYDilation 231 │ 199 │ ); 232 │ 200 │ 233 │ 201 │ normalMotionRadioBox.touchArea = new Bounds2( 234 │ 202 │ normalMotionRadioBox.localBounds.minX, 235 │ 203 │ normalMotionRadioBox.localBounds.minY - touchAreaYDilation, 236 │ 204 │ ( normalMotionRadioBox.localBounds.minX + speedControlMaxWidth ), 237 │ 205 │ normalMotionRadioBox.localBounds.maxY + touchAreaYDilation 238 │ 206 │ ); 239 │ 207 │ 240 │ 208 │ var speedControl = new VBox( { 241 │ 209 │ align: 'left', 242 │ 210 │ spacing: radioButtonSpacing, 243 │ 211 │ children: [ slowMotionRadioBox, normalMotionRadioBox ] 244 │ 212 │ } ); - ..\states-of-matter\js\common\model\engine\AbstractPhaseStateChanger.js: 87-100 ..\states-of-matter\js\common\model\engine\DiatomicPhaseStateChanger.js: 148-161 87 │ 148 │ this.multipleParticleModel.setTemperature( StatesOfMatterConstants.GAS_TEMPERATURE ); 88 │ 149 │ 89 │ 150 │ // Get references to the various elements of the data set. 90 │ 151 │ var moleculeDataSet = this.multipleParticleModel.moleculeDataSet; 91 │ 152 │ var moleculeCenterOfMassPositions = moleculeDataSet.getMoleculeCenterOfMassPositions(); 92 │ 153 │ var moleculeVelocities = moleculeDataSet.getMoleculeVelocities(); 93 │ 154 │ var moleculeRotationAngles = moleculeDataSet.getMoleculeRotationAngles(); 94 │ 155 │ var moleculeRotationRates = moleculeDataSet.getMoleculeRotationRates(); 95 │ 156 │ var moleculesInsideContainer = this.multipleParticleModel.moleculeDataSet.insideContainer; 96 │ 157 │ 97 │ 158 │ // Create and initialize other variables needed to do the job. 98 │ 159 │ var temperatureSqrt = Math.sqrt( this.multipleParticleModel.temperatureSetPointProperty.get() ); 99 │ 160 │ var numberOfMolecules = moleculeDataSet.getNumberOfMolecules(); 100 │ 161 │ for ( var i = 0; i < numberOfMolecules; i++ ) { - ..\states-of-matter\js\common\model\engine\MonatomicPhaseStateChanger.js: 36-58 ..\states-of-matter\js\common\model\engine\WaterPhaseStateChanger.js: 45-67 36 │ 45 │ return inherit( AbstractPhaseStateChanger, MonatomicPhaseStateChanger, { 37 │ 46 │ 38 │ 47 │ /** 39 │ 48 │ * @public 40 │ 49 │ * @param {number} phaseID - state(solid/liquid/gas) of Molecule 41 │ 50 │ */ 42 │ 51 │ setPhase: function( phaseID ) { 43 │ 52 │ switch( phaseID ) { 44 │ 53 │ case PhaseStateEnum.SOLID: 45 │ 54 │ this.setPhaseSolid(); 46 │ 55 │ break; 47 │ 56 │ case PhaseStateEnum.LIQUID: 48 │ 57 │ this.setPhaseLiquid(); 49 │ 58 │ break; 50 │ 59 │ case PhaseStateEnum.GAS: 51 │ 60 │ this.setPhaseGas(); 52 │ 61 │ break; 53 │ 62 │ default: 54 │ 63 │ throw new Error( 'invalid phaseID: ' + phaseID ); 55 │ 64 │ } 56 │ 65 │ 57 │ 66 │ var moleculeDataSet = this.multipleParticleModel.moleculeDataSet; 58 │ 67 │ - ..\states-of-matter\js\common\model\engine\DiatomicPhaseStateChanger.js: 160-170 ..\states-of-matter\js\common\model\engine\WaterPhaseStateChanger.js: 98-108 160 │ 98 │ var numberOfMolecules = moleculeDataSet.getNumberOfMolecules(); 161 │ 99 │ 162 │ 100 │ // Initialize the velocities and angles of the molecules. 163 │ 101 │ for ( var i = 0; i < numberOfMolecules; i++ ) { 164 │ 102 │ 165 │ 103 │ // Assign each molecule an initial velocity. 166 │ 104 │ moleculeVelocities[ i ].setXY( temperatureSqrt * this.rand.nextGaussian(), temperatureSqrt * this.rand.nextGaussian() ); 167 │ 105 │ 168 │ 106 │ // Assign each molecule an initial rotation rate. 169 │ 107 │ moleculeRotationRates[ i ] = phet.joist.random.nextDouble() * temperatureSqrt * Math.PI * 2; 170 │ 108 │ - ..\states-of-matter\js\common\model\engine\DiatomicPhaseStateChanger.js: 159-170 ..\states-of-matter\js\common\model\engine\WaterPhaseStateChanger.js: 158-169 159 │ 158 │ var temperatureSqrt = Math.sqrt( this.multipleParticleModel.temperatureSetPointProperty.get() ); 160 │ 159 │ var numberOfMolecules = moleculeDataSet.getNumberOfMolecules(); 161 │ 160 │ 162 │ 161 │ // Initialize the velocities and angles of the molecules. 163 │ 162 │ for ( var i = 0; i < numberOfMolecules; i++ ) { 164 │ 163 │ 165 │ 164 │ // Assign each molecule an initial velocity. 166 │ 165 │ moleculeVelocities[ i ].setXY( temperatureSqrt * this.rand.nextGaussian(), temperatureSqrt * this.rand.nextGaussian() ); 167 │ 166 │ 168 │ 167 │ // Assign each molecule an initial rotation rate. 169 │ 168 │ moleculeRotationRates[ i ] = phet.joist.random.nextDouble() * temperatureSqrt * Math.PI * 2; 170 │ 169 │ - ..\states-of-matter\js\common\model\engine\DiatomicPhaseStateChanger.js: 177-206 ..\states-of-matter\js\common\model\engine\WaterPhaseStateChanger.js: 177-206 177 │ 177 │ var centerPointY = this.multipleParticleModel.normalizedContainerHeight / 4; 178 │ 178 │ var currentLayer = 0; 179 │ 179 │ var particlesOnCurrentLayer = 0; 180 │ 180 │ var particlesThatWillFitOnCurrentLayer = 1; 181 │ 181 │ for ( i = 0; i < numberOfMolecules; i++ ) { 182 │ 182 │ for ( var j = 0; j < this.MAX_PLACEMENT_ATTEMPTS; j++ ) { 183 │ 183 │ var distanceFromCenter = currentLayer * MIN_INITIAL_DIAMETER_DISTANCE * LIQUID_SPACING_FACTOR; 184 │ 184 │ var angle = (particlesOnCurrentLayer / particlesThatWillFitOnCurrentLayer * 2 * Math.PI) + 185 │ 185 │ (particlesThatWillFitOnCurrentLayer / (4 * Math.PI)); 186 │ 186 │ var xPos = centerPointX + (distanceFromCenter * Math.cos( angle )); 187 │ 187 │ var yPos = centerPointY + (distanceFromCenter * Math.sin( angle )); 188 │ 188 │ 189 │ 189 │ // Consider this spot used even if we don't actually put the particle there. 190 │ 190 │ particlesOnCurrentLayer++; 191 │ 191 │ if ( particlesOnCurrentLayer >= particlesThatWillFitOnCurrentLayer ) { 192 │ 192 │ 193 │ 193 │ // This layer is full - move to the next one. 194 │ 194 │ currentLayer++; 195 │ 195 │ particlesThatWillFitOnCurrentLayer = Math.floor( currentLayer * 2 * Math.PI / 196 │ 196 │ ( MIN_INITIAL_DIAMETER_DISTANCE * LIQUID_SPACING_FACTOR ) ); 197 │ 197 │ particlesOnCurrentLayer = 0; 198 │ 198 │ } 199 │ 199 │ 200 │ 200 │ // Check if the position is too close to the wall. Note that we don't check inter-particle distances here - 201 │ 201 │ // we rely on the placement algorithm to make sure that this is not a problem. 202 │ 202 │ if ( ( xPos > this.MIN_INITIAL_PARTICLE_TO_WALL_DISTANCE ) && 203 │ 203 │ ( xPos < this.multipleParticleModel.normalizedContainerWidth - this.MIN_INITIAL_PARTICLE_TO_WALL_DISTANCE ) && 204 │ 204 │ ( yPos > this.MIN_INITIAL_PARTICLE_TO_WALL_DISTANCE ) && 205 │ 205 │ ( xPos < this.multipleParticleModel.normalizedContainerHeight - this.MIN_INITIAL_PARTICLE_TO_WALL_DISTANCE ) ) { 206 │ 206 │ - ..\states-of-matter\js\phase-changes\view\PhaseChangesScreenView.js: 139-158 ..\states-of-matter\js\states\view\StatesScreenView.js: 117-136 139 │ 117 │ listener: function() { multipleParticleModel.stepInternal( 1 / 60 ); }, 140 │ 118 │ radius: 12, 141 │ 119 │ stroke: 'black', 142 │ 120 │ fill: '#005566', 143 │ 121 │ right: heaterCoolerNode.left - STEP_BUTTON_X_OFFSET, 144 │ 122 │ centerY: heaterCoolerNode.centerY, 145 │ 123 │ touchAreaDilation: 4 146 │ 124 │ } ); 147 │ 125 │ this.addChild( stepButton ); 148 │ 126 │ 149 │ 127 │ var playPauseButton = new PlayPauseButton( multipleParticleModel.isPlayingProperty, { 150 │ 128 │ radius: 18, stroke: 'black', 151 │ 129 │ fill: '#005566', 152 │ 130 │ y: stepButton.centerY, 153 │ 131 │ right: stepButton.left - 10, 154 │ 132 │ touchAreaDilation: 4 155 │ 133 │ } ); 156 │ 134 │ this.addChild( playPauseButton ); 157 │ 135 │ 158 │ 136 │ // add bicycle pump node - ..\atomic-interactions\js\atomic-interactions-config.js: 11-44 ..\states-of-matter\js\states-of-matter-config.js: 10-43 11 │ 10 │ deps: [ 'atomic-interactions-main' ], 12 │ 11 │ 13 │ 12 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 13 │ 15 │ 14 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 15 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 16 │ paths: { 18 │ 17 │ 19 │ 18 │ // third-party libs 20 │ 19 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 20 │ 22 │ 21 │ // PhET plugins 23 │ 22 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 23 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 24 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 25 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 26 │ 28 │ 27 │ // common directories, uppercase names to identify them in require imports 29 │ 28 │ ASSERT: '../../assert/js', 30 │ 29 │ AXON: '../../axon/js', 31 │ 30 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 32 │ 31 │ DOT: '../../dot/js', 33 │ 32 │ JOIST: '../../joist/js', 34 │ 33 │ KITE: '../../kite/js', 35 │ 34 │ NITROGLYCERIN: '../../nitroglycerin/js', 36 │ 35 │ PHET_CORE: '../../phet-core/js', 37 │ 36 │ PHET_IO: '../../phet-io/js', 38 │ 37 │ PHETCOMMON: '../../phetcommon/js', 39 │ 38 │ REPOSITORY: '..', 40 │ 39 │ SCENERY: '../../scenery/js', 41 │ 40 │ SCENERY_PHET: '../../scenery-phet/js', 42 │ 41 │ SUN: '../../sun/js', 43 │ 42 │ TANDEM: '../../tandem/js', 44 │ 43 │ - ..\molecules-and-light\js\molecules-and-light-config.js: 12-44 ..\states-of-matter-basics\js\states-of-matter-basics-config.js: 11-43 12 │ 11 │ deps: [ 'molecules-and-light-main' ], 13 │ 12 │ 14 │ 13 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 15 │ 14 │ 16 │ 15 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 17 │ 16 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 18 │ 17 │ paths: { 19 │ 18 │ 20 │ 19 │ // third-party libs 21 │ 20 │ text: '../../sherpa/lib/text-2.0.12', 22 │ 21 │ 23 │ 22 │ // PhET plugins 24 │ 23 │ image: '../../chipper/js/requirejs-plugins/image', 25 │ 24 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 26 │ 25 │ string: '../../chipper/js/requirejs-plugins/string', 27 │ 26 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 28 │ 27 │ 29 │ 28 │ // common directories, uppercase names to identify them in require imports 30 │ 29 │ AXON: '../../axon/js', 31 │ 30 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 32 │ 31 │ DOT: '../../dot/js', 33 │ 32 │ JOIST: '../../joist/js', 34 │ 33 │ KITE: '../../kite/js', 35 │ 34 │ NITROGLYCERIN: '../../nitroglycerin/js', 36 │ 35 │ PHET_CORE: '../../phet-core/js', 37 │ 36 │ PHET_IO: '../../phet-io/js', 38 │ 37 │ PHETCOMMON: '../../phetcommon/js', 39 │ 38 │ REPOSITORY: '..', 40 │ 39 │ SCENERY: '../../scenery/js', 41 │ 40 │ SCENERY_PHET: '../../scenery-phet/js', 42 │ 41 │ SUN: '../../sun/js', 43 │ 42 │ TANDEM: '../../tandem/js', 44 │ 43 │ - ..\neuron\js\neuron\model\NeuronClockModelAdapter.js: 91-105 ..\sugar-and-salt-solutions\js\common\model\ConstantDtClock.js: 49-63 91 │ 49 │ reset: function() { 92 │ 50 │ this.lastSimulationTime = 0.0; 93 │ 51 │ this.simulationTime = 0.0; 94 │ 52 │ this.speed = 1; 95 │ 53 │ PropertySet.prototype.reset.call( this ); 96 │ 54 │ 97 │ 55 │ //fire reset event callback 98 │ 56 │ for ( var i = 0; i < this.resetCallBacks.length; i++ ) { 99 │ 57 │ this.resetCallBacks[ i ](); 100 │ 58 │ } 101 │ 59 │ this.model.reset(); 102 │ 60 │ }, 103 │ 61 │ 104 │ 62 │ /** 105 │ 63 │ * Registers a callback that will be notified when the step simulation occurs - ..\sugar-and-salt-solutions\js\common\view\MacroConcentrationBarChartNode.js: 2-32 ..\sugar-and-salt-solutions\js\macro\view\MacroConcentrationBarChartNode.js: 2-32 2 │ 2 │ /** 3 │ 3 │ * Control that allows the user to expand/collapse the concentration bar chart, also contains said bar chart. 4 │ 4 │ * 5 │ 5 │ * @author Sam Reid (PhET Interactive Simulations) 6 │ 6 │ * @author Sharfudeen Ashraf (For Ghent University) 7 │ 7 │ */ 8 │ 8 │ define( function( require ) { 9 │ 9 │ 'use strict'; 10 │ 10 │ 11 │ 11 │ // modules 12 │ 12 │ var inherit = require( 'PHET_CORE/inherit' ); 13 │ 13 │ var Node = require( 'SCENERY/nodes/Node' ); 14 │ 14 │ var AccordionBox = require( 'SUN/AccordionBox' ); 15 │ 15 │ var SugarSaltBarChart = require( 'SUGAR_AND_SALT_SOLUTIONS/macro/view/SugarSaltBarChart' ); 16 │ 16 │ var SugarAndSaltConstants = require( 'SUGAR_AND_SALT_SOLUTIONS/common/SugarAndSaltConstants' ); 17 │ 17 │ var Text = require( 'SCENERY/nodes/Text' ); 18 │ 18 │ 19 │ 19 │ // strings 20 │ 20 │ var concentrationString = require( 'string!SUGAR_AND_SALT_SOLUTIONS/concentration' ); 21 │ 21 │ 22 │ 22 │ /** 23 │ 23 │ * 24 │ 24 │ * @param {Property} showConcentrationBarChart 25 │ 25 │ * @param {Property} saltConcentration 26 │ 26 │ * @param {Property} sugarConcentration 27 │ 27 │ * @param {Property} showConcentrationValues 28 │ 28 │ * @param {number} scaleFactor 29 │ 29 │ * @constructor 30 │ 30 │ */ 31 │ 31 │ function ExpandableConcentrationBarChartNode( showConcentrationBarChart, saltConcentration, sugarConcentration, showConcentrationValues, scaleFactor ) { 32 │ 32 │ var self = this; - ..\sugar-and-salt-solutions\js\common\view\MacroConcentrationBarChartNode.js: 31-62 ..\sugar-and-salt-solutions\js\macro\view\MacroConcentrationBarChartNode.js: 31-62 31 │ 31 │ function ExpandableConcentrationBarChartNode( showConcentrationBarChart, saltConcentration, sugarConcentration, showConcentrationValues, scaleFactor ) { 32 │ 32 │ var self = this; 33 │ 33 │ Node.call( self, {fill: SugarAndSaltConstants.WATER_COLOR} ); 34 │ 34 │ 35 │ 35 │ //The bar chart itself (when toggled to be visible) 36 │ 36 │ var barChartNode = new SugarSaltBarChart( saltConcentration, sugarConcentration, showConcentrationValues, 37 │ 37 │ showConcentrationBarChart, scaleFactor ); 38 │ 38 │ var titleNode = new Text( concentrationString, { font: SugarAndSaltConstants.TITLE_FONT } ); 39 │ 39 │ 40 │ 40 │ var accordionBoxNode = new AccordionBox( barChartNode, { 41 │ 41 │ //Node that says "concentration" and has a "+" button to expand the concentration bar chart 42 │ 42 │ titleNode: titleNode, 43 │ 43 │ fill: SugarAndSaltConstants.WATER_COLOR, 44 │ 44 │ contentAlign: 'center', 45 │ 45 │ titleAlignX: 'center', 46 │ 46 │ buttonAlign: 'right', 47 │ 47 │ titleYMargin: 4, 48 │ 48 │ contentXMargin: 10, 49 │ 49 │ buttonXMargin: 8, 50 │ 50 │ buttonTouchAreaXDilation: 16, 51 │ 51 │ buttonTouchAreaYDilation: 16, 52 │ 52 │ buttonLength: 20, 53 │ 53 │ contentYSpacing: 2, 54 │ 54 │ contentYMargin: 2, 55 │ 55 │ expandedProperty: showConcentrationBarChart //Only show this bar chart if the user has opted to do so 56 │ 56 │ } ); 57 │ 57 │ 58 │ 58 │ self.addChild( accordionBoxNode ); 59 │ 59 │ } 60 │ 60 │ 61 │ 61 │ return inherit( Node, ExpandableConcentrationBarChartNode ); 62 │ 62 │ - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-44 ..\sugar-and-salt-solutions\js\sugar-and-salt-solutions-config.js: 10-43 11 │ 10 │ deps: [ 'area-model-multiplication-main' ], 12 │ 11 │ 13 │ 12 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 13 │ 15 │ 14 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 15 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 16 │ paths: { 18 │ 17 │ 19 │ 18 │ // third-party libs 20 │ 19 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 20 │ 22 │ 21 │ // PhET plugins 23 │ 22 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 23 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 24 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 25 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 26 │ 28 │ 27 │ // common directories, uppercase names to identify them in require imports 29 │ 28 │ AXON: '../../axon/js', 30 │ 29 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 30 │ DOT: '../../dot/js', 32 │ 31 │ JOIST: '../../joist/js', 33 │ 32 │ KITE: '../../kite/js', 34 │ 33 │ PHET_CORE: '../../phet-core/js', 35 │ 34 │ PHET_IO: '../../phet-io/js', 36 │ 35 │ PHETCOMMON: '../../phetcommon/js', 37 │ 36 │ REPOSITORY: '..', 38 │ 37 │ SCENERY: '../../scenery/js', 39 │ 38 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 39 │ SUN: '../../sun/js', 41 │ 40 │ TANDEM: '../../tandem/js', 42 │ 41 │ 43 │ 42 │ // this sim 44 │ 43 │ AREA_MODEL_MULTIPLICATION: '.' - ..\gene-expression-essentials\js\common\util\Map.js: 28-49 ..\sugar-and-salt-solutions\js\utils\Map.js: 25-46 28 │ 25 │ return inherit( Object, Map, { 29 │ 26 │ put: function( key, value ) { 30 │ 27 │ var index = this.keys.indexOf( key ); 31 │ 28 │ if ( index === -1 ) { 32 │ 29 │ this.keys.push( key ); 33 │ 30 │ this.values.push( value ); 34 │ 31 │ } 35 │ 32 │ else { 36 │ 33 │ this.values[ index ] = value; 37 │ 34 │ } 38 │ 35 │ }, 39 │ 36 │ 40 │ 37 │ get: function( key ) { 41 │ 38 │ return this.values[ this.keys.indexOf( key ) ]; 42 │ 39 │ }, 43 │ 40 │ 44 │ 41 │ contains: function( key ) { 45 │ 42 │ return this.keys.indexOf( key ) !== -1; 46 │ 43 │ }, 47 │ 44 │ 48 │ 45 │ remove: function( key ) { 49 │ 46 │ var index = this.keys.indexOf( key ); - ..\sun\js\buttons\RadioButtonGroup.js: 85-107 ..\sun\js\buttons\RadioButtonGroupMember.js: 38-60 85 │ 38 │ // The fill for the rectangle behind the radio buttons. Default color is bluish color, as in the other button library. 86 │ 39 │ baseColor: ColorConstants.LIGHT_BLUE, 87 │ 40 │ disabledBaseColor: ColorConstants.LIGHT_GRAY, 88 │ 41 │ 89 │ 42 │ // Opacity can be set separately for the buttons and button content. 90 │ 43 │ selectedButtonOpacity: 1, 91 │ 44 │ deselectedButtonOpacity: 0.6, 92 │ 45 │ selectedContentOpacity: 1, 93 │ 46 │ deselectedContentOpacity: 0.6, 94 │ 47 │ overButtonOpacity: 0.8, 95 │ 48 │ overContentOpacity: 0.8, 96 │ 49 │ 97 │ 50 │ selectedStroke: 'black', 98 │ 51 │ deselectedStroke: new Color( 50, 50, 50 ), 99 │ 52 │ selectedLineWidth: 1.5, 100 │ 53 │ deselectedLineWidth: 1, 101 │ 54 │ 102 │ 55 │ // The following options specify highlight behavior overrides, leave as null to get the default behavior 103 │ 56 │ // Note that highlighting applies only to deselected buttons 104 │ 57 │ overFill: null, 105 │ 58 │ overStroke: null, 106 │ 59 │ overLineWidth: null, 107 │ 60 │ - ..\sun\js\buttons\RectangularButtonView.js: 231-249 ..\sun\js\buttons\RectangularButtonView.js: 346-364 231 │ 346 │ .addColorStop( 1, disabledBaseColor.colorUtilsDarker( 0.5 ) ); 232 │ 347 │ 233 │ 348 │ if ( options.stroke === null ) { 234 │ 349 │ // The stroke was explicitly set to null, so the button should have no stroke. 235 │ 350 │ enabledStroke = null; 236 │ 351 │ disabledStroke = null; 237 │ 352 │ } 238 │ 353 │ else if ( typeof( options.stroke ) === 'undefined' ) { 239 │ 354 │ // No stroke was defined, but it wasn't set to null, so default to a stroke based on the base color of the 240 │ 355 │ // button. This behavior is a bit unconventional for Scenery nodes, but it makes the buttons look much better. 241 │ 356 │ enabledStroke = baseColor.colorUtilsDarker( 0.4 ); 242 │ 357 │ disabledStroke = disabledBaseColor.colorUtilsDarker( 0.4 ); 243 │ 358 │ } 244 │ 359 │ else { 245 │ 360 │ enabledStroke = Color.toColor( options.stroke ); 246 │ 361 │ disabledStroke = disabledBaseColor.colorUtilsDarker( 0.4 ); 247 │ 362 │ } 248 │ 363 │ 249 │ 364 │ button.cachedPaints = [ - ..\sun\js\buttons\RectangularButtonView.js: 231-250 ..\sun\js\buttons\RoundButtonView.js: 205-224 231 │ 205 │ .addColorStop( 1, disabledBaseColor.colorUtilsDarker( 0.5 ) ); 232 │ 206 │ 233 │ 207 │ if ( options.stroke === null ) { 234 │ 208 │ // The stroke was explicitly set to null, so the button should have no stroke. 235 │ 209 │ enabledStroke = null; 236 │ 210 │ disabledStroke = null; 237 │ 211 │ } 238 │ 212 │ else if ( typeof( options.stroke ) === 'undefined' ) { 239 │ 213 │ // No stroke was defined, but it wasn't set to null, so default to a stroke based on the base color of the 240 │ 214 │ // button. This behavior is a bit unconventional for Scenery nodes, but it makes the buttons look much better. 241 │ 215 │ enabledStroke = baseColor.colorUtilsDarker( 0.4 ); 242 │ 216 │ disabledStroke = disabledBaseColor.colorUtilsDarker( 0.4 ); 243 │ 217 │ } 244 │ 218 │ else { 245 │ 219 │ enabledStroke = Color.toColor( options.stroke ); 246 │ 220 │ disabledStroke = disabledBaseColor.colorUtilsDarker( 0.4 ); 247 │ 221 │ } 248 │ 222 │ 249 │ 223 │ button.cachedPaints = [ 250 │ 224 │ upFillVertical, overFillVertical, downFillVertical, disabledFillVertical, disabledPressedFillVertical, - ..\sun\js\buttons\RectangularButtonView.js: 293-318 ..\sun\js\buttons\RoundButtonView.js: 265-290 293 │ 265 │ overlayForHorizGradient.fill = disabledFillHorizontal; 294 │ 266 │ break; 295 │ 267 │ 296 │ 268 │ default: 297 │ 269 │ throw new Error( 'upsupported interactionState: ' + interactionState ); 298 │ 270 │ } 299 │ 271 │ } 300 │ 272 │ 301 │ 273 │ // Do the initial update explicitly, then lazy link to the properties. This keeps the number of initial updates to 302 │ 274 │ // a minimum and allows us to update some optimization flags the first time the base color is actually changed. 303 │ 275 │ updateFillsAndStrokes( baseColorProperty.value ); 304 │ 276 │ updateAppearance( interactionStateProperty.value ); 305 │ 277 │ 306 │ 278 │ baseColorProperty.lazyLink( function( baseColor ) { 307 │ 279 │ // Do the appearance updates. 308 │ 280 │ updateFillsAndStrokes( baseColor ); 309 │ 281 │ updateAppearance( interactionStateProperty.value ); 310 │ 282 │ } ); 311 │ 283 │ 312 │ 284 │ interactionStateProperty.lazyLink( function( interactionState ) { 313 │ 285 │ updateAppearance( interactionState ); 314 │ 286 │ } ); 315 │ 287 │ }; 316 │ 288 │ 317 │ 289 │ /** 318 │ 290 │ * Strategy for buttons that look flat, i.e. no shading or highlighting, but that change color on mouseover, press, - ..\sun\js\buttons\RectangularButtonView.js: 339-413 ..\sun\js\buttons\RoundButtonView.js: 310-384 339 │ 310 │ var disabledStroke; 340 │ 311 │ 341 │ 312 │ function updateFillsAndStrokes( baseColor ) { 342 │ 313 │ upFill = baseColor; 343 │ 314 │ overFill = baseColor.colorUtilsBrighter( 0.4 ); 344 │ 315 │ downFill = baseColor.colorUtilsDarker( 0.4 ); 345 │ 316 │ disabledFill = disabledBaseColor; 346 │ 317 │ disabledPressedFillVertical = disabledFill; 347 │ 318 │ if ( options.stroke === null ) { 348 │ 319 │ // The stroke was explicitly set to null, so the button should have no stroke. 349 │ 320 │ enabledStroke = null; 350 │ 321 │ disabledStroke = null; 351 │ 322 │ } 352 │ 323 │ else if ( typeof( options.stroke ) === 'undefined' ) { 353 │ 324 │ // No stroke was defined, but it wasn't set to null, so default to a stroke based on the base color of the 354 │ 325 │ // button. This behavior is a bit unconventional for Scenery nodes, but it makes the buttons look much better. 355 │ 326 │ enabledStroke = baseColor.colorUtilsDarker( 0.4 ); 356 │ 327 │ disabledStroke = disabledBaseColor.colorUtilsDarker( 0.4 ); 357 │ 328 │ } 358 │ 329 │ else { 359 │ 330 │ enabledStroke = Color.toColor( options.stroke ); 360 │ 331 │ disabledStroke = disabledBaseColor.colorUtilsDarker( 0.4 ); 361 │ 332 │ } 362 │ 333 │ 363 │ 334 │ button.cachedPaints = [ 364 │ 335 │ upFill, overFill, downFill, disabledFill, disabledPressedFillVertical, 365 │ 336 │ enabledStroke, disabledStroke 366 │ 337 │ ]; 367 │ 338 │ } 368 │ 339 │ 369 │ 340 │ function updateAppearance( interactionState ) { 370 │ 341 │ switch( interactionState ) { 371 │ 342 │ 372 │ 343 │ case 'idle': 373 │ 344 │ button.fill = upFill; 374 │ 345 │ button.stroke = enabledStroke; 375 │ 346 │ break; 376 │ 347 │ 377 │ 348 │ case 'over': 378 │ 349 │ button.fill = overFill; 379 │ 350 │ button.stroke = enabledStroke; 380 │ 351 │ break; 381 │ 352 │ 382 │ 353 │ case 'pressed': 383 │ 354 │ button.fill = downFill; 384 │ 355 │ button.stroke = enabledStroke; 385 │ 356 │ break; 386 │ 357 │ 387 │ 358 │ case 'disabled': 388 │ 359 │ button.fill = disabledFill; 389 │ 360 │ button.stroke = disabledStroke; 390 │ 361 │ break; 391 │ 362 │ 392 │ 363 │ case 'disabled-pressed': 393 │ 364 │ button.fill = disabledPressedFillVertical; 394 │ 365 │ button.stroke = disabledStroke; 395 │ 366 │ break; 396 │ 367 │ 397 │ 368 │ default: 398 │ 369 │ throw new Error( 'upsupported interactionState: ' + interactionState ); 399 │ 370 │ } 400 │ 371 │ } 401 │ 372 │ 402 │ 373 │ baseColorProperty.link( function( baseColor ) { 403 │ 374 │ updateFillsAndStrokes( baseColor ); 404 │ 375 │ updateAppearance( interactionStateProperty.value ); 405 │ 376 │ } ); 406 │ 377 │ 407 │ 378 │ // Lazy link to interaction state to avoid two updates at init. 408 │ 379 │ interactionStateProperty.lazyLink( function( interactionState ) { 409 │ 380 │ updateAppearance( interactionState ); 410 │ 381 │ } ); 411 │ 382 │ }; 412 │ 383 │ 413 │ 384 │ /** - ..\sun\js\buttons\RectangularButtonView.js: 436-466 ..\sun\js\buttons\RoundButtonView.js: 406-436 436 │ 406 │ assert && assert( typeof value === 'boolean', 'RectangularButtonView.enabled must be a boolean value' ); 437 │ 407 │ this.buttonModel.enabledProperty.set( value ); 438 │ 408 │ }, 439 │ 409 │ set enabled( value ) { this.setEnabled( value ); }, 440 │ 410 │ 441 │ 411 │ /** 442 │ 412 │ * Gets the enabled state. 443 │ 413 │ * @returns {boolean} 444 │ 414 │ * @public 445 │ 415 │ */ 446 │ 416 │ getEnabled: function() { return this.buttonModel.enabledProperty.get(); }, 447 │ 417 │ get enabled() { return this.getEnabled(); }, 448 │ 418 │ 449 │ 419 │ /** 450 │ 420 │ * Sets the base color, which is the main background fill color used for the button. 451 │ 421 │ * @param {Color|String} baseColor 452 │ 422 │ * @public 453 │ 423 │ */ 454 │ 424 │ setBaseColor: function( baseColor ) { this.baseColorProperty.value = Color.toColor( baseColor ); }, 455 │ 425 │ set baseColor( baseColor ) { this.setBaseColor( baseColor ); }, 456 │ 426 │ 457 │ 427 │ /** 458 │ 428 │ * Gets the base color for this button. 459 │ 429 │ * @returns {Color} 460 │ 430 │ * @public 461 │ 431 │ */ 462 │ 432 │ getBaseColor: function() { return this.baseColorProperty.value; }, 463 │ 433 │ get baseColor() { return this.getBaseColor(); } 464 │ 434 │ } ); 465 │ 435 │ } ); - ..\scenery-phet\js\NumberControl.js: 233-244 ..\sun\js\NumberSpinner.js: 265-276 233 │ 265 │ VBox.prototype.dispose.call( this ); 234 │ 266 │ }, 235 │ 267 │ 236 │ 268 │ // @public 237 │ 269 │ setEnabled: function( enabled ) { this.enabledProperty.set( enabled ); }, 238 │ 270 │ set enabled( value ) { this.setEnabled( value ); }, 239 │ 271 │ 240 │ 272 │ // @public 241 │ 273 │ getEnabled: function() { return this.enabledProperty.get(); }, 242 │ 274 │ get enabled() { return this.getEnabled(); } 243 │ 275 │ 244 │ 276 │ }, { - ..\shred\js\shred-config.js: 3-37 ..\sun\js\sun-config.js: 3-37 3 │ 3 │ require.config( { 4 │ 4 │ deps: [ 'sun-main' ], 5 │ 5 │ 6 │ 6 │ paths: { 7 │ 7 │ 8 │ 8 │ // third party libs 9 │ 9 │ text: '../../sherpa/lib/text-2.0.12', 10 │ 10 │ 11 │ 11 │ // plugins 12 │ 12 │ image: '../../chipper/js/requirejs-plugins/image', 13 │ 13 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 14 │ 14 │ string: '../../chipper/js/requirejs-plugins/string', 15 │ 15 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 16 │ 16 │ 17 │ 17 │ // PhET libs, uppercase names to identify them in require.js imports 18 │ 18 │ AXON: '../../axon/js', 19 │ 19 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 20 │ 20 │ DOT: '../../dot/js', 21 │ 21 │ JOIST: '../../joist/js', 22 │ 22 │ KITE: '../../kite/js', 23 │ 23 │ PHETCOMMON: '../../phetcommon/js', 24 │ 24 │ REPOSITORY: '..', 25 │ 25 │ PHET_CORE: '../../phet-core/js', 26 │ 26 │ PHET_IO: '../../phet-io/js', 27 │ 27 │ SCENERY: '../../scenery/js', 28 │ 28 │ SCENERY_PHET: '../../scenery-phet/js', 29 │ 29 │ SHERPA: '../../sherpa', 30 │ 30 │ SUN: '../../sun/js', 31 │ 31 │ TANDEM: '../../tandem/js', 32 │ 32 │ VEGAS: '../../vegas/js', 33 │ 33 │ SHRED: '.', 34 │ 34 │ VIBE: '../../vibe/js' 35 │ 35 │ }, 36 │ 36 │ 37 │ 37 │ // optional cache buster to make browser refresh load all included scripts, can be disabled with ?cacheBuster=false - ..\sun\js\ComboBox.js: 311-321 ..\sun\js\UIComponent.js: 71-81 311 │ 71 │ this.disposeComboBox(); 312 │ 72 │ }, 313 │ 73 │ 314 │ 74 │ // @public 315 │ 75 │ setEnabled: function( enabled ) { this.enabledProperty.value = enabled; }, 316 │ 76 │ set enabled( value ) { this.setEnabled( value ); }, 317 │ 77 │ 318 │ 78 │ // @public 319 │ 79 │ getEnabled: function() { return this.enabledProperty.value; }, 320 │ 80 │ get enabled() { return this.getEnabled(); } 321 │ 81 │ } ); - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-44 ..\trig-tour\js\trig-tour-config.js: 10-43 11 │ 10 │ deps: [ 'area-model-multiplication-main' ], 12 │ 11 │ 13 │ 12 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 13 │ 15 │ 14 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 15 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 16 │ paths: { 18 │ 17 │ 19 │ 18 │ // third-party libs 20 │ 19 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 20 │ 22 │ 21 │ // PhET plugins 23 │ 22 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 23 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 24 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 25 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 26 │ 28 │ 27 │ // common directories, uppercase names to identify them in require imports 29 │ 28 │ AXON: '../../axon/js', 30 │ 29 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 30 │ DOT: '../../dot/js', 32 │ 31 │ JOIST: '../../joist/js', 33 │ 32 │ KITE: '../../kite/js', 34 │ 33 │ PHET_CORE: '../../phet-core/js', 35 │ 34 │ PHET_IO: '../../phet-io/js', 36 │ 35 │ PHETCOMMON: '../../phetcommon/js', 37 │ 36 │ REPOSITORY: '..', 38 │ 37 │ SCENERY: '../../scenery/js', 39 │ 38 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 39 │ SUN: '../../sun/js', 41 │ 40 │ TANDEM: '../../tandem/js', 42 │ 41 │ 43 │ 42 │ // this sim 44 │ 43 │ AREA_MODEL_MULTIPLICATION: '.' - ..\griddle\js\griddle-config.js: 4-32 ..\under-pressure\js\under-pressure-config.js: 4-32 4 │ 4 │ deps: [ 'griddle-main' ], 5 │ 5 │ 6 │ 6 │ paths: { 7 │ 7 │ 8 │ 8 │ // third party libs 9 │ 9 │ text: '../../sherpa/lib/text-2.0.12', 10 │ 10 │ 11 │ 11 │ // plugins 12 │ 12 │ image: '../../chipper/js/requirejs-plugins/image', 13 │ 13 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 14 │ 14 │ string: '../../chipper/js/requirejs-plugins/string', 15 │ 15 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 16 │ 16 │ 17 │ 17 │ // PhET libs, uppercase names to identify them in require.js imports 18 │ 18 │ AXON: '../../axon/js', 19 │ 19 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 20 │ 20 │ DOT: '../../dot/js', 21 │ 21 │ JOIST: '../../joist/js', 22 │ 22 │ KITE: '../../kite/js', 23 │ 23 │ PHETCOMMON: '../../phetcommon/js', 24 │ 24 │ REPOSITORY: '..', 25 │ 25 │ PHET_CORE: '../../phet-core/js', 26 │ 26 │ PHET_IO: '../../phet-io/js', 27 │ 27 │ SCENERY: '../../scenery/js', 28 │ 28 │ SCENERY_PHET: '../../scenery-phet/js', 29 │ 29 │ SHERPA: '../../sherpa', 30 │ 30 │ SUN: '../../sun/js', 31 │ 31 │ TANDEM: '../../tandem/js', 32 │ 32 │ - ..\area-model-multiplication\js\area-model-multiplication-config.js: 11-44 ..\unit-rates\js\unit-rates-config.js: 11-44 11 │ 11 │ deps: [ 'area-model-multiplication-main' ], 12 │ 12 │ 13 │ 13 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 14 │ 14 │ 15 │ 15 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 16 │ 16 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 17 │ 17 │ paths: { 18 │ 18 │ 19 │ 19 │ // third-party libs 20 │ 20 │ text: '../../sherpa/lib/text-2.0.12', 21 │ 21 │ 22 │ 22 │ // PhET plugins 23 │ 23 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 24 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 25 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 26 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 27 │ 28 │ 28 │ // common directories, uppercase names to identify them in require imports 29 │ 29 │ AXON: '../../axon/js', 30 │ 30 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 31 │ DOT: '../../dot/js', 32 │ 32 │ JOIST: '../../joist/js', 33 │ 33 │ KITE: '../../kite/js', 34 │ 34 │ PHET_CORE: '../../phet-core/js', 35 │ 35 │ PHET_IO: '../../phet-io/js', 36 │ 36 │ PHETCOMMON: '../../phetcommon/js', 37 │ 37 │ REPOSITORY: '..', 38 │ 38 │ SCENERY: '../../scenery/js', 39 │ 39 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 40 │ SUN: '../../sun/js', 41 │ 41 │ TANDEM: '../../tandem/js', 42 │ 42 │ 43 │ 43 │ // this sim 44 │ 44 │ AREA_MODEL_MULTIPLICATION: '.' - ..\griddle\js\griddle-config.js: 4-33 ..\vegas\js\vegas-config.js: 4-33 4 │ 4 │ deps: [ 'griddle-main' ], 5 │ 5 │ 6 │ 6 │ paths: { 7 │ 7 │ 8 │ 8 │ // third party libs 9 │ 9 │ text: '../../sherpa/lib/text-2.0.12', 10 │ 10 │ 11 │ 11 │ // plugins 12 │ 12 │ image: '../../chipper/js/requirejs-plugins/image', 13 │ 13 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 14 │ 14 │ string: '../../chipper/js/requirejs-plugins/string', 15 │ 15 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 16 │ 16 │ 17 │ 17 │ // PhET libs, uppercase names to identify them in require.js imports 18 │ 18 │ AXON: '../../axon/js', 19 │ 19 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 20 │ 20 │ DOT: '../../dot/js', 21 │ 21 │ JOIST: '../../joist/js', 22 │ 22 │ KITE: '../../kite/js', 23 │ 23 │ PHETCOMMON: '../../phetcommon/js', 24 │ 24 │ REPOSITORY: '..', 25 │ 25 │ PHET_CORE: '../../phet-core/js', 26 │ 26 │ PHET_IO: '../../phet-io/js', 27 │ 27 │ SCENERY: '../../scenery/js', 28 │ 28 │ SCENERY_PHET: '../../scenery-phet/js', 29 │ 29 │ SHERPA: '../../sherpa', 30 │ 30 │ SUN: '../../sun/js', 31 │ 31 │ TANDEM: '../../tandem/js', 32 │ 32 │ 33 │ 33 │ // this app - ..\expression-exchange\js\expression-exchange-config.js: 10-44 ..\vibe\js\vibe-config.js: 10-44 10 │ 10 │ deps: [ 'expression-exchange-main' ], 11 │ 11 │ 12 │ 12 │ // baseUrl: don't bother trying to set it here, it is overridden by data-main in the top-level HTML file 13 │ 13 │ 14 │ 14 │ // Path mappings for module names not found directly under baseUrl. The path settings are assumed to be 15 │ 15 │ // relative to baseUrl unless the paths setting starts with a '/' or has a URL protocol. 16 │ 16 │ paths: { 17 │ 17 │ 18 │ 18 │ // third-party libs 19 │ 19 │ text: '../../sherpa/lib/text-2.0.12', 20 │ 20 │ 21 │ 21 │ // PhET plugins 22 │ 22 │ audio: '../../chipper/js/requirejs-plugins/audio', 23 │ 23 │ image: '../../chipper/js/requirejs-plugins/image', 24 │ 24 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 25 │ 25 │ string: '../../chipper/js/requirejs-plugins/string', 26 │ 26 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 27 │ 27 │ 28 │ 28 │ // common directories, uppercase names to identify them in require imports 29 │ 29 │ AXON: '../../axon/js', 30 │ 30 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 31 │ 31 │ DOT: '../../dot/js', 32 │ 32 │ JOIST: '../../joist/js', 33 │ 33 │ KITE: '../../kite/js', 34 │ 34 │ PHET_CORE: '../../phet-core/js', 35 │ 35 │ PHET_IO: '../../phet-io/js', 36 │ 36 │ PHETCOMMON: '../../phetcommon/js', 37 │ 37 │ REPOSITORY: '..', 38 │ 38 │ SCENERY: '../../scenery/js', 39 │ 39 │ SCENERY_PHET: '../../scenery-phet/js', 40 │ 40 │ SUN: '../../sun/js', 41 │ 41 │ TANDEM: '../../tandem/js', 42 │ 42 │ VEGAS: '../../vegas/js', 43 │ 43 │ VIBE: '../../vibe/js', 44 │ 44 │ - ..\area-builder\js\area-builder-config.js: 10-40 ..\wave-on-a-string\js\wave-on-a-string-config.js: 12-42 10 │ 12 │ deps: [ 'area-builder-main' ], 11 │ 13 │ 12 │ 14 │ paths: { 13 │ 15 │ 14 │ 16 │ // third-party libs 15 │ 17 │ text: '../../sherpa/lib/text-2.0.12', 16 │ 18 │ 17 │ 19 │ // PhET plugins 18 │ 20 │ audio: '../../chipper/js/requirejs-plugins/audio', 19 │ 21 │ image: '../../chipper/js/requirejs-plugins/image', 20 │ 22 │ mipmap: '../../chipper/js/requirejs-plugins/mipmap', 21 │ 23 │ string: '../../chipper/js/requirejs-plugins/string', 22 │ 24 │ ifphetio: '../../chipper/js/requirejs-plugins/ifphetio', 23 │ 25 │ 24 │ 26 │ // PhET libs, uppercase names to identify them in require.js imports 25 │ 27 │ AXON: '../../axon/js', 26 │ 28 │ BRAND: '../../brand/' + phet.chipper.brand + '/js', 27 │ 29 │ DOT: '../../dot/js', 28 │ 30 │ JOIST: '../../joist/js', 29 │ 31 │ KITE: '../../kite/js', 30 │ 32 │ PHET_CORE: '../../phet-core/js', 31 │ 33 │ PHET_IO: '../../phet-io/js', 32 │ 34 │ PHETCOMMON: '../../phetcommon/js', 33 │ 35 │ REPOSITORY: '..', 34 │ 36 │ SCENERY: '../../scenery/js', 35 │ 37 │ SCENERY_PHET: '../../scenery-phet/js', 36 │ 38 │ SHERPA: '../../sherpa', 37 │ 39 │ SUN: '../../sun/js', 38 │ 40 │ TANDEM: '../../tandem/js', 39 │ 41 │ VIBE: '../../vibe/js', 40 │ 42 │ VEGAS: '../../vegas/js', 1.77% (9125 lines) duplicated lines out of 514499 total lines of code. warn: output file is not provided info: Generate report time: durationMs=522 Done.