Skip to content

Commit

Permalink
doc, #262
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Mar 8, 2023
1 parent d3ab194 commit 5db386f
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 18 deletions.
2 changes: 1 addition & 1 deletion js/common/CalculusGrapherConstants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2020-2023, University of Colorado Boulder

/**
* Constants used in multiple locations within the 'Calculus Grapher' simulation. All fields are static.
* Constants used throughout this simulation.
*
* @author Brandon Li
* @author Martin Veillette
Expand Down
2 changes: 1 addition & 1 deletion js/common/CalculusGrapherSymbols.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022-2023, University of Colorado Boulder

/**
* Symbols used to label graphs and checkboxes.
* Symbols used throughout this simulation.
*
* This is also where MathSymbolFont is applied to symbols. By adding RichText markup to a symbol with
* MathSymbolFont.getRichTextMarkup, all occurrences of that symbol will be rendered using MathSymbolFont.
Expand Down
13 changes: 9 additions & 4 deletions js/common/view/CurveNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ type SelfOptions = {
// Color used to stroke the curve path.
stroke: TColor;

// Line plots
// options propagated to LinePlots
continuousLinePlotOptions?: StrictOmit<LinePlotOptions, 'stroke'>;
discontinuousLinePlotOptions?: StrictOmit<LinePlotOptions, 'stroke'>;

// Scatter plots, with optional plots for debugging
// options propagated to the ScatterPlot for point of discontinuity
discontinuousPointsScatterPlotOptions?: StrictOmit<ScatterPlotOptions, 'stroke'>;

// options propagated to the ScatterPlot for debugging
cuspsScatterPlotOptions?: ScatterPlotOptions;
allPointsScatterPlotOptions?: ScatterPlotOptions;

Expand All @@ -64,9 +66,13 @@ export default class CurveNode extends Node {
// The curve that this Node displays
public readonly curve: Curve;

// plots
// Plots the continuous parts of the curve
protected readonly continuousLinePlot: LinePlot;

// Plots the optional dashed lines that connect discontinuities (see Discontinuities in the Preferences dialog)
private readonly discontinuousLinePlot: LinePlot;

// Plots points at discontinuities
private readonly discontinuousPointsScatterPlot: ScatterPlot;

// These plots are created conditionally for debugging. See ?allPoints and ?cuspPoints.
Expand Down Expand Up @@ -108,7 +114,6 @@ export default class CurveNode extends Node {
radius: 1
},

// NodeOptions
plotBoundsMethod: 'accurate'

}, providedOptions );
Expand Down
9 changes: 7 additions & 2 deletions js/common/view/GraphNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ assert && assert( _.every( Y_ZOOM_INFO, zoomInfo => zoomInfo.tickSpacing <= zoom
assert && assert( _.every( Y_ZOOM_INFO, ( zoomInfo, index, Y_ZOOM_INFO ) =>
( index === 0 || Y_ZOOM_INFO[ index - 1 ].max > zoomInfo.max ) ), 'must be sorted by descending max' );

const DEFAULT_ZOOM_LEVEL = 3;
const DEFAULT_MAX_Y = Y_ZOOM_INFO[ DEFAULT_ZOOM_LEVEL ].max;
const DEFAULT_ZOOM_LEVEL = 3; // default value for yZoomLevelProperty
const DEFAULT_MAX_Y = Y_ZOOM_INFO[ DEFAULT_ZOOM_LEVEL ].max; // default y-range (symmetrical) of the ChartTransform

type SelfOptions = {

Expand All @@ -105,8 +105,13 @@ export type GraphNodeOptions = SelfOptions &

export default class GraphNode extends Node {

// The type of graph that this GraphNode renders
public readonly graphType: GraphType;

// bamboo model-view transform
public readonly chartTransform: ChartTransform;

// Outer rectangle of the chart
protected readonly chartRectangle: ChartRectangle;

// The model curve to be plotted
Expand Down
2 changes: 1 addition & 1 deletion js/common/view/LabeledLineNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import optionize from '../../../../phet-core/js/optionize.js';

type SelfOptions = {

// see setLineTopAndBottom
// The top and bottom y-coordinates of the vertical line, in GraphsNode view coordinate frame.
lineTop?: number;
lineBottom?: number;
};
Expand Down
2 changes: 1 addition & 1 deletion js/common/view/LabeledLinesNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import optionize from '../../../../phet-core/js/optionize.js';
import StrictOmit from '../../../../phet-core/js/types/StrictOmit.js';

type SelfOptions = {
labeledLineOptions?: LabeledLineNodeOptions;
labeledLineOptions?: LabeledLineNodeOptions; // propagated to LabeledLineNode
};

type LabeledLinesNodeOptions = SelfOptions & PickRequired<NodeOptions, 'tandem'>;
Expand Down
13 changes: 7 additions & 6 deletions js/common/view/ScrubberNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ import Multilink from '../../../../axon/js/Multilink.js';
import AncillaryTool from '../model/AncillaryTool.js';

type SelfOptions = {
handleColor?: TColor;
lineStroke?: TColor;
lineWidth?: number;
lineDash?: number[];
handleColor?: TColor; // color of the scrubber's handle
lineStroke?: TColor; // color used to stroke the vertical line
lineWidth?: number; // width of the vertical line
lineDash?: number[]; // line dash for the vertical line, [] is a solid line

// The top and bottom coordinates of the vertical line, in GraphsNode view coordinate frame.
// The top and bottom y-coordinates of the vertical line, in GraphsNode view coordinate frame.
lineTop?: number;
lineBottom?: number;
};
Expand All @@ -34,9 +34,10 @@ export type ScrubberNodeOptions = SelfOptions &

export default class ScrubberNode extends Node {

// vertical line displayed by the tool
// vertical line displayed by the scrubber
protected readonly line: Line;

// spherical handle for dragging the scrubber
protected readonly handleNode: Node;

protected constructor( scrubber: AncillaryTool, chartTransform: ChartTransform,
Expand Down
4 changes: 2 additions & 2 deletions js/common/view/XDragHandleNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import CalculusGrapherConstants from '../CalculusGrapherConstants.js';

type SelfOptions = {

// Radius of the sphere of the handle - in view coordinates
// Radius of the handle, in view coordinates
radius?: number;

// y coordinate of the drag handler, in model coordinate frame
// y-coordinate of the handle, in model coordinate frame
yModel?: number;
};

Expand Down

0 comments on commit 5db386f

Please sign in to comment.