/** * @param {SymbolToCountsChallenge} symbolToCountsChallenge * @param {Bounds2} layoutBounds * @param {Tandem} tandem * @constructor */ function SymbolToCountsChallengeView( symbolToCountsChallenge, layoutBounds, tandem ) { // Interactive particle count node - must be defined before call to super constructor. this.interactiveParticleCountsNode = new InteractiveParticleCountsNode( tandem ); ChallengeView.call( this, symbolToCountsChallenge, layoutBounds, tandem ); // Add interactive particle count. this.interactiveAnswerNode.addChild( this.interactiveParticleCountsNode ); // Symbol var interactiveSymbolNode = new InteractiveSymbolNode( symbolToCountsChallenge.answerAtom, tandem.createTandem( 'interactiveSymbolNode' ) ); interactiveSymbolNode.scale( 0.75 ); this.challengePresentationNode.addChild( interactiveSymbolNode ); // Layout interactiveSymbolNode.centerX = layoutBounds.width * 0.25; interactiveSymbolNode.centerY = layoutBounds.height * 0.54; this.interactiveParticleCountsNode.centerX = layoutBounds.width * 0.75; this.interactiveParticleCountsNode.centerY = layoutBounds.height * 0.49; // @private called by dispose this.disposeSymbolToCountsChallengeView = function() { interactiveSymbolNode.dispose(); this.interactiveParticleCountsNode.dispose(); }; }
/** * @param {CountsToMassNumberChallenge} countsToMassNumberChallenge * @param {Bounds2} layoutBounds * @param {Tandem} tandem * @constructor */ function CountsToMassNumberChallengeView( countsToMassNumberChallenge, layoutBounds, tandem ) { // Must be defined before call to super constructor. this.massNumberAnswerProperty = new NumberProperty( 0, { tandem: tandem.createTandem( 'massNumberAnswerProperty' ), numberType: 'Integer' } ); ChallengeView.call( this, countsToMassNumberChallenge, layoutBounds, tandem ); var self = this; // Particle counts var particleCountsNode = new ParticleCountsNode( countsToMassNumberChallenge.answerAtom ); self.challengePresentationNode.addChild( particleCountsNode ); var questionPrompt = new MultiLineText( whatIsTheMassNumberString, { align: 'left', font: new PhetFont( 24 ), maxWidth: 200, tandem: tandem.createTandem( 'questionPrompt' ) } ); self.interactiveAnswerNode.addChild( questionPrompt ); // Node for entering the answer var numberEntryNode = new NumberEntryNode( self.massNumberAnswerProperty, tandem.createTandem( 'numberEntryNode' ), { minValue: 0, maxValue: 99 } ); self.interactiveAnswerNode.addChild( numberEntryNode ); // Layout particleCountsNode.centerX = layoutBounds.width * 0.3; particleCountsNode.centerY = layoutBounds.height * 0.5; questionPrompt.centerX = layoutBounds.width * 0.65; questionPrompt.centerY = layoutBounds.height * 0.5; numberEntryNode.left = questionPrompt.right + 10; numberEntryNode.centerY = questionPrompt.centerY; // @private - called by dispose this.disposeCountsToMassNumberChallengeView = function() { particleCountsNode.dispose(); questionPrompt.dispose(); numberEntryNode.dispose(); this.massNumberAnswerProperty.dispose(); }; }