Skip to content

Commit

Permalink
Refactored scene graph to move grid lines to back
Browse files Browse the repository at this point in the history
  • Loading branch information
Saurabh Totey authored and Saurabh Totey committed Jun 28, 2019
1 parent 7842616 commit bc510f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,19 +207,19 @@ define( function( require ) {
true,
{ canvasBounds: new Bounds2( 0, 0, this.graphWidth, this.graphHeight ) }
);
this.addChild( this.interactionPotentialCanvasNode );

// Update interactivity state.
this.updateInteractivityState();

// Redraw the potential curve.
this.drawPotentialCurve();
this.addChild( this.horizontalAxisLabel );

// Add children
this.addChild( this.horizontalAxisLabel );
this.addChild( this.verticalAxisLabel );

this.addChild( this.verticalAxis );
this.addChild( this.horizontalAxis );
this.addChild( this.interactionPotentialCanvasNode );
this.addChild( this.ljPotentialGraph );

// applying color scheme to lj graph elements
Expand Down
12 changes: 4 additions & 8 deletions js/common/view/InteractionPotentialDiagramNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ define( function( require ) {
var inherit = require( 'PHET_CORE/inherit' );
var LjPotentialCalculator = require( 'STATES_OF_MATTER/common/model/LjPotentialCalculator' );
var Node = require( 'SCENERY/nodes/Node' );
var Path = require( 'SCENERY/nodes/Path' );
var PhetFont = require( 'SCENERY_PHET/PhetFont' );
var PositionMarker = require( 'STATES_OF_MATTER/atomic-interactions/view/PositionMarker' );
var Shape = require( 'KITE/Shape' );
var SOMColorProfile = require( 'STATES_OF_MATTER/common/view/SOMColorProfile' );
var SOMConstants = require( 'STATES_OF_MATTER/common/SOMConstants' );
var statesOfMatter = require( 'STATES_OF_MATTER/statesOfMatter' );
Expand Down Expand Up @@ -104,11 +102,6 @@ define( function( require ) {
( SOMConstants.MAX_EPSILON * SOMConstants.K_BOLTZMANN );
this.horizontalLineCount = 5;

// Create and add the center axis line for the graph.
var centerAxis = new Path( Shape.lineSegment( 0, 0, this.graphWidth, 0 ), { lineWidth: 0.8, stroke: '#A7A7A7' } );
this.ljPotentialGraph.addChild( centerAxis );
centerAxis.setTranslation( 0, this.graphHeight / 2 );

// Add the arrows and labels that will depict sigma and epsilon.
this.epsilonArrow = new ArrowNode( 0, 0, 0, 0, {
headHeight: 8,
Expand Down Expand Up @@ -224,7 +217,10 @@ define( function( require ) {

if ( wide ) {
this.gridNode = new ZoomableGridNode( this, 0, 0, this.graphWidth, this.graphHeight );
this.ljPotentialGraph.addChild( this.gridNode );
this.gridNode.x = this.graphXOrigin;
this.gridNode.y = this.graphYOrigin - this.graphHeight;
this.addChild( this.gridNode );

// adjusting zoom buttons position on interaction diagram
this.gridNode.zoomInButton.right = this.verticalAxis.left - this.gridNode.zoomInButton.width;
this.gridNode.zoomOutButton.right = this.verticalAxis.left - this.gridNode.zoomInButton.width;
Expand Down

0 comments on commit bc510f7

Please sign in to comment.