Skip to content

Commit

Permalink
rename AxisNode to AxisArrowNode, #38
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Jul 6, 2021
1 parent 0ce0d23 commit b667271
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 20 deletions.
11 changes: 5 additions & 6 deletions js/AxisNode.js → js/AxisArrowNode.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// Copyright 2020-2021, University of Colorado Boulder

/**
* Shows a line that depicts an axis. This is typically bolder than any grid line (if any), and typically at x=0 or
* y=0, but those defaults can be overridden with options. It has a double sided arrow, but those won't be shown if
* this is added to the clipping area of a chart.
* AxisArrowNode shows an axis with arrows at one or both ends. An axis is typically bolder than any grid line (if any),
* and typically at x=0 or y=0, but those defaults can be overridden with options.
*
* @author Sam Reid (PhET Interactive Simulations)
*/
Expand All @@ -13,7 +12,7 @@ import Orientation from '../../phet-core/js/Orientation.js';
import ArrowNode from '../../scenery-phet/js/ArrowNode.js';
import bamboo from './bamboo.js';

class AxisNode extends ArrowNode {
class AxisArrowNode extends ArrowNode {

/**
* @param {ChartTransform} chartTransform
Expand Down Expand Up @@ -77,5 +76,5 @@ class AxisNode extends ArrowNode {
}
}

bamboo.register( 'AxisNode', AxisNode );
export default AxisNode;
bamboo.register( 'AxisArrowNode', AxisArrowNode );
export default AxisArrowNode;
6 changes: 3 additions & 3 deletions js/demo/DemoLinePlot.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import PhetFont from '../../../scenery-phet/js/PhetFont.js';
import PlusMinusZoomButtonGroup from '../../../scenery-phet/js/PlusMinusZoomButtonGroup.js';
import Node from '../../../scenery/js/nodes/Node.js';
import Text from '../../../scenery/js/nodes/Text.js';
import AxisNode from '../AxisNode.js';
import AxisArrowNode from '../AxisArrowNode.js';
import bamboo from '../bamboo.js';
import ChartRectangle from '../ChartRectangle.js';
import ChartTransform from '../ChartTransform.js';
Expand Down Expand Up @@ -95,8 +95,8 @@ class DemoLinePlot extends Node {
new GridLineSet( chartTransform, Orientation.VERTICAL, 0.5, { stroke: 'lightGray' } ),

// Axes nodes are clipped in the chart
new AxisNode( chartTransform, Orientation.HORIZONTAL ),
new AxisNode( chartTransform, Orientation.VERTICAL ),
new AxisArrowNode( chartTransform, Orientation.HORIZONTAL ),
new AxisArrowNode( chartTransform, Orientation.VERTICAL ),

// Some data
new LinePlot( chartTransform, createDataSet( -2, 2, 5 ), { stroke: 'red', lineWidth: 2 } ),
Expand Down
6 changes: 3 additions & 3 deletions js/demo/DemoLinearEquationPlot.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import RichText from '../../../scenery/js/nodes/RichText.js';
import Text from '../../../scenery/js/nodes/Text.js';
import VBox from '../../../scenery/js/nodes/VBox.js';
import VSlider from '../../../sun/js/VSlider.js';
import AxisNode from '../AxisNode.js';
import AxisArrowNode from '../AxisArrowNode.js';
import bamboo from '../bamboo.js';
import ChartRectangle from '../ChartRectangle.js';
import ChartTransform from '../ChartTransform.js';
Expand Down Expand Up @@ -130,12 +130,12 @@ class DemoLinearEquationPlot extends Node {

// Axes
const axisFont = new PhetFont( 16 );
const xAxis = new AxisNode( chartTransform, Orientation.HORIZONTAL );
const xAxis = new AxisArrowNode( chartTransform, Orientation.HORIZONTAL );
const xAxisLabel = new RichText( xSymbol, {
font: axisFont,
leftCenter: chartRectangle.rightCenter.plusXY( 4, 0 )
} );
const yAxis = new AxisNode( chartTransform, Orientation.VERTICAL );
const yAxis = new AxisArrowNode( chartTransform, Orientation.VERTICAL );
const yAxisLabel = new RichText( ySymbol, {
font: axisFont,
centerBottom: chartRectangle.centerTop.minusXY( 0, 4 )
Expand Down
6 changes: 3 additions & 3 deletions js/demo/DemoMultiplePlots.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Node from '../../../scenery/js/nodes/Node.js';
import Text from '../../../scenery/js/nodes/Text.js';
import VBox from '../../../scenery/js/nodes/VBox.js';
import VerticalAquaRadioButtonGroup from '../../../sun/js/VerticalAquaRadioButtonGroup.js';
import AxisNode from '../AxisNode.js';
import AxisArrowNode from '../AxisArrowNode.js';
import BarPlot from '../BarPlot.js';
import ChartTransform from '../ChartTransform.js';
import ChartRectangle from '../ChartRectangle.js';
Expand Down Expand Up @@ -97,8 +97,8 @@ class DemoMultiplePlots extends VBox {
chartClip,

// axes nodes not clipped
new AxisNode( chartTransform, Orientation.VERTICAL ),
new AxisNode( chartTransform, Orientation.HORIZONTAL ),
new AxisArrowNode( chartTransform, Orientation.VERTICAL ),
new AxisArrowNode( chartTransform, Orientation.HORIZONTAL ),

// Tick marks outside the chart
new TickMarkSet( chartTransform, Orientation.HORIZONTAL, 2, { edge: 'min' } ),
Expand Down
6 changes: 3 additions & 3 deletions js/demo/DemoScatterPlot.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Orientation from '../../../phet-core/js/Orientation.js';
import Node from '../../../scenery/js/nodes/Node.js';
import VBox from '../../../scenery/js/nodes/VBox.js';
import HSlider from '../../../sun/js/HSlider.js';
import AxisNode from '../AxisNode.js';
import AxisArrowNode from '../AxisArrowNode.js';
import BarPlot from '../BarPlot.js';
import ChartTransform from '../ChartTransform.js';
import ChartRectangle from '../ChartRectangle.js';
Expand Down Expand Up @@ -88,8 +88,8 @@ class DemoScatterPlot extends VBox {
new GridLineSet( chartTransform, Orientation.VERTICAL, 0.2, { stroke: 'black' } ),

// axes nodes not clipped
new AxisNode( chartTransform, Orientation.VERTICAL ),
new AxisNode( chartTransform, Orientation.HORIZONTAL ),
new AxisArrowNode( chartTransform, Orientation.VERTICAL ),
new AxisArrowNode( chartTransform, Orientation.HORIZONTAL ),

// Tick marks outside the chart
new TickMarkSet( chartTransform, Orientation.VERTICAL, 0.2, { edge: 'min' } ),
Expand Down
4 changes: 2 additions & 2 deletions js/demo/DemoUpDownArrowPlot.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Range from '../../../dot/js/Range.js';
import Vector2 from '../../../dot/js/Vector2.js';
import Orientation from '../../../phet-core/js/Orientation.js';
import AxisNode from '../AxisNode.js';
import AxisArrowNode from '../AxisArrowNode.js';
import bamboo from '../bamboo.js';
import ChartRectangle from '../ChartRectangle.js';
import ChartTransform from '../ChartTransform.js';
Expand Down Expand Up @@ -57,7 +57,7 @@ class DemoUpDownArrowPlot extends Node {
return { fill: c };
}
} );
const xAxis = new AxisNode( chartTransform, Orientation.HORIZONTAL );
const xAxis = new AxisArrowNode( chartTransform, Orientation.HORIZONTAL );

// anything you want clipped goes in here
const chartClip = new Node( {
Expand Down

0 comments on commit b667271

Please sign in to comment.