diff --git a/js/common/view/GraphNode.ts b/js/common/view/GraphNode.ts index 88e72b0a..2c797ddc 100644 --- a/js/common/view/GraphNode.ts +++ b/js/common/view/GraphNode.ts @@ -86,8 +86,8 @@ const DEFAULT_MAX_Y = Y_ZOOM_INFO[ DEFAULT_ZOOM_LEVEL ].max; // default y-range type SelfOptions = { - // height of the graph, in view coordinates - graphHeight: number; + // height of the ChartRectangle, in view coordinates + chartRectangleHeight: number; // options to the bamboo ChartRectangle chartRectangleOptions?: PickOptional; @@ -178,7 +178,7 @@ export default class GraphNode extends Node { // chart transform for the graph this.chartTransform = new ChartTransform( { viewWidth: CalculusGrapherConstants.GRAPH_VIEW_WIDTH, - viewHeight: options.graphHeight, + viewHeight: options.chartRectangleHeight, modelXRange: CalculusGrapherConstants.CURVE_X_RANGE, modelYRange: new Range( -DEFAULT_MAX_Y, DEFAULT_MAX_Y ) } ); diff --git a/js/common/view/GraphSetsAnimator.ts b/js/common/view/GraphSetsAnimator.ts index 7288b1f5..a48e70f4 100644 --- a/js/common/view/GraphSetsAnimator.ts +++ b/js/common/view/GraphSetsAnimator.ts @@ -73,14 +73,14 @@ export default class GraphSetsAnimator { * @param graphSetNode - parent Node for the GraphNodes * @param oldGraphNodes - the current children of graphSetNode, null if it has no children * @param newGraphNodes - the new children of graphSetNode - * @param graphHeight - the height of one GraphNode's ChartRectangle + * @param chartRectangleHeight - the height of one GraphNode's ChartRectangle * @param ySpacing - the vertical spacing between GraphNode instances * @param [endCallback] - called when animation has completed */ public changeGraphSets( graphSetNode: Node, oldGraphNodes: GraphNode[] | null, newGraphNodes: GraphNode[], - graphHeight: number, + chartRectangleHeight: number, ySpacing: number, endCallback?: () => void ): void { @@ -93,7 +93,7 @@ export default class GraphSetsAnimator { const x = newGraphNodes[ 0 ].x; const yEndCoordinates = [ 0 ]; for ( let i = 1; i < newGraphNodes.length; i++ ) { - yEndCoordinates.push( yEndCoordinates[ i - 1 ] + graphHeight + ySpacing ); + yEndCoordinates.push( yEndCoordinates[ i - 1 ] + chartRectangleHeight + ySpacing ); } // Move immediately to the new state if: diff --git a/js/common/view/GraphsNode.ts b/js/common/view/GraphsNode.ts index 01feea6e..c8e8b271 100644 --- a/js/common/view/GraphsNode.ts +++ b/js/common/view/GraphsNode.ts @@ -57,8 +57,8 @@ export default class GraphsNode extends Node { // The parent for all GraphNode instances that are part model.graphSetProperty.value private readonly graphSetNode: Node; - // Height of the graph, in view coordinates - private readonly graphHeight: number; + // Height of the ChartRectangles, in view coordinates + private readonly chartRectangleHeight: number; // A reference line that extends vertically through all graphs private readonly referenceLineNode: ReferenceLineNode; @@ -79,14 +79,14 @@ export default class GraphsNode extends Node { super(); // The (view) height of the graph based on the number of visible graphs. - this.graphHeight = CalculusGrapherConstants.SINGLE_GRAPH_HEIGHT / model.graphSetProperty.value.length; + this.chartRectangleHeight = CalculusGrapherConstants.SINGLE_GRAPH_HEIGHT / model.graphSetProperty.value.length; // Creates a GraphNode instance, and instruments it if its GraphType is included in graphSets. const createGraphNode = ( graphType: GraphType, curve: Curve ) => { assert && assert( graphType !== GraphType.ORIGINAL, 'does not support GraphType.ORIGINAL' ); return new GraphNode( graphType, curve, model.gridVisibleProperty, { - graphHeight: this.graphHeight, + chartRectangleHeight: this.chartRectangleHeight, tandem: GraphSet.includes( model.graphSets, graphType ) ? options.tandem.createTandem( `${graphType.tandemNamePrefix}GraphNode` ) : Tandem.OPT_OUT @@ -95,7 +95,7 @@ export default class GraphsNode extends Node { // OriginalGraphNode is always instrumented, because it should always be present. this.originalGraphNode = new OriginalGraphNode( model, { - graphHeight: this.graphHeight, + chartRectangleHeight: this.chartRectangleHeight, tandem: options.tandem.createTandem( 'originalGraphNode' ) } ); @@ -133,7 +133,8 @@ export default class GraphsNode extends Node { const oldGraphNodes = oldGraphSet ? this.getGraphNodes( oldGraphSet ) : null; const newGraphNodes = this.getGraphNodes( newGraphSet ); - this.graphSetsAnimator.changeGraphSets( this.graphSetNode, oldGraphNodes, newGraphNodes, this.graphHeight, GRAPH_NODE_Y_SPACING ); + this.graphSetsAnimator.changeGraphSets( this.graphSetNode, oldGraphNodes, newGraphNodes, + this.chartRectangleHeight, GRAPH_NODE_Y_SPACING ); } ); // Reference Line, length adjusted depending on whether values are visible. @@ -198,7 +199,8 @@ export default class GraphsNode extends Node { */ private getChartRectanglesBottom(): number { const numberOfGraphNodes = this.graphSetNode.getChildrenCount(); - return this.getChartRectanglesTop() + ( numberOfGraphNodes * this.graphHeight ) + ( ( numberOfGraphNodes - 1 ) * GRAPH_NODE_Y_SPACING ); + return this.getChartRectanglesTop() + ( numberOfGraphNodes * this.chartRectangleHeight ) + + ( ( numberOfGraphNodes - 1 ) * GRAPH_NODE_Y_SPACING ); } /** diff --git a/js/common/view/OriginalGraphNode.ts b/js/common/view/OriginalGraphNode.ts index 3da6268c..78b5deda 100644 --- a/js/common/view/OriginalGraphNode.ts +++ b/js/common/view/OriginalGraphNode.ts @@ -46,7 +46,7 @@ import BooleanProperty from '../../../../axon/js/BooleanProperty.js'; type SelfOptions = EmptySelfOptions; -type OriginalGraphNodeOptions = SelfOptions & PickRequired; +type OriginalGraphNodeOptions = SelfOptions & PickRequired; export default class OriginalGraphNode extends GraphNode {