From 8190b3495114d88019a5a4214923c3ed14c129da Mon Sep 17 00:00:00 2001 From: pixelzoom Date: Tue, 25 Apr 2023 11:06:19 -0600 Subject: [PATCH] https://github.com/phetsims/graphing-lines/issues/139 --- js/common/view/LineNode.ts | 8 +++----- js/linegame/view/ChallengeGraphNode.ts | 1 + js/pointslope/view/PointSlopeGraphNode.ts | 1 - js/slope/view/SlopeGraphNode.ts | 1 - js/slopeintercept/view/SlopeInterceptGraphNode.ts | 1 - 5 files changed, 4 insertions(+), 8 deletions(-) diff --git a/js/common/view/LineNode.ts b/js/common/view/LineNode.ts index 61e12f30..0745d6ab 100644 --- a/js/common/view/LineNode.ts +++ b/js/common/view/LineNode.ts @@ -41,8 +41,6 @@ const SCENERY_LINE_OPTIONS = { lineWidth: TAIL_WIDTH }; -type LineProperty = Property | Property; - // Options for SelfOptions.createDynamicLabel export type CreateDynamicLabelOptions = { pickable?: boolean; @@ -54,7 +52,7 @@ export type CreateDynamicLabelOptions = { slopeUndefinedVisible?: boolean; }; -export type CreateDynamicLabelFunction = ( lineProperty: LineProperty, providedOptions?: CreateDynamicLabelOptions ) => Node; +export type CreateDynamicLabelFunction = ( lineProperty: Property, providedOptions?: CreateDynamicLabelOptions ) => Node; type SelfOptions = { @@ -69,7 +67,7 @@ type LineNodeOptions = SelfOptions; export default class LineNode extends Node { - public readonly lineProperty: LineProperty; + public readonly lineProperty: Property; private readonly graph: Graph; private readonly modelViewTransform: ModelViewTransform2; private readonly xExtent: number; @@ -86,7 +84,7 @@ export default class LineNode extends Node { private readonly disposeLineNode: () => void; - public constructor( lineProperty: LineProperty, + public constructor( lineProperty: Property, graph: Graph, modelViewTransform: ModelViewTransform2, providedOptions?: LineNodeOptions ) { diff --git a/js/linegame/view/ChallengeGraphNode.ts b/js/linegame/view/ChallengeGraphNode.ts index 4c2d09e8..f3991a66 100644 --- a/js/linegame/view/ChallengeGraphNode.ts +++ b/js/linegame/view/ChallengeGraphNode.ts @@ -76,6 +76,7 @@ export default class ChallengeGraphNode extends GraphNode { this.answerPointNode.translation = challenge.modelViewTransform.modelToViewXY( challenge.answer.x1, challenge.answer.y1 ); // guess + // @ts-expect-error Property this.guessLineNode = new LineNode( challenge.guessProperty, challenge.graph, challenge.modelViewTransform ); this.guessPointNode = new PlottedPointNode( pointRadius, LineGameConstants.GUESS_COLOR ); diff --git a/js/pointslope/view/PointSlopeGraphNode.ts b/js/pointslope/view/PointSlopeGraphNode.ts index 9c2d4243..17d842d3 100644 --- a/js/pointslope/view/PointSlopeGraphNode.ts +++ b/js/pointslope/view/PointSlopeGraphNode.ts @@ -19,7 +19,6 @@ export default class PointSlopeGraphNode extends LineFormsGraphNode { public constructor( model: PointSlopeModel, viewProperties: LineFormsViewProperties ) { - // @ts-expect-error Property super( model, viewProperties, PointSlopeEquationNode.createDynamicLabel ); const manipulatorRadius = model.modelViewTransform.modelToViewDeltaX( model.manipulatorRadius ); diff --git a/js/slope/view/SlopeGraphNode.ts b/js/slope/view/SlopeGraphNode.ts index dbee3f05..bc1b3151 100644 --- a/js/slope/view/SlopeGraphNode.ts +++ b/js/slope/view/SlopeGraphNode.ts @@ -19,7 +19,6 @@ export default class SlopeGraphNode extends LineFormsGraphNode { public constructor( model: SlopeModel, viewProperties: LineFormsViewProperties ) { - // @ts-expect-error Property super( model, viewProperties, SlopeEquationNode.createDynamicLabel ); const manipulatorRadius = model.modelViewTransform.modelToViewDeltaX( model.manipulatorRadius ); diff --git a/js/slopeintercept/view/SlopeInterceptGraphNode.ts b/js/slopeintercept/view/SlopeInterceptGraphNode.ts index 63a003d2..023f1aec 100644 --- a/js/slopeintercept/view/SlopeInterceptGraphNode.ts +++ b/js/slopeintercept/view/SlopeInterceptGraphNode.ts @@ -19,7 +19,6 @@ export default class SlopeInterceptGraphNode extends LineFormsGraphNode { public constructor( model: SlopeInterceptModel, viewProperties: LineFormsViewProperties ) { - // @ts-expect-error Property super( model, viewProperties, SlopeInterceptEquationNode.createDynamicLabel ); const manipulatorRadius = model.modelViewTransform.modelToViewDeltaX( model.manipulatorRadius );