Skip to content

Commit

Permalink
Instrument NumberLineNode.ts visibility, see: phetsims/mean-share-and…
Browse files Browse the repository at this point in the history
  • Loading branch information
marlitas committed May 21, 2024
1 parent fd30f45 commit ec3ed14
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
10 changes: 7 additions & 3 deletions js/view/NumberLineNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@ import Orientation from '../../../phet-core/js/Orientation.js';
import TickLabelSet from '../../../bamboo/js/TickLabelSet.js';
import Utils from '../../../dot/js/Utils.js';
import { Shape } from '../../../kite/js/imports.js';
import StrictOmit from '../../../phet-core/js/types/StrictOmit.js';

type SelfOptions = {
color?: TPaint;
includeXAxis: boolean;
showTickMarks?: boolean;
};
export type NumberLineNodeOptions = SelfOptions & StrictOmit<NodeOptions, 'tandem'>;
export type NumberLineNodeOptions = SelfOptions & NodeOptions;

export default class NumberLineNode extends Node {

Expand All @@ -43,10 +42,15 @@ export default class NumberLineNode extends Node {
providedOptions: NumberLineNodeOptions
) {


const options = optionize<NumberLineNodeOptions, SelfOptions, NodeOptions>()( {
color: 'white',
isDisposable: false,
showTickMarks: true
showTickMarks: true,

// When the Node is instrumented we want clients to be able to toggle visibility.
// https://github.com/phetsims/mean-share-and-balance/issues/253
phetioVisiblePropertyInstrumented: !!providedOptions.tandem
}, providedOptions );

super();
Expand Down
8 changes: 6 additions & 2 deletions js/view/SoccerScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ import GroupSortInteractionView from '../../../scenery-phet/js/accessibility/gro
import dragIndicatorHand_png from '../../../scenery-phet/images/dragIndicatorHand_png.js';
import Vector2 from '../../../dot/js/Vector2.js';
import { SoccerBallPhase } from '../model/SoccerBallPhase.js';
import Tandem from '../../../tandem/js/Tandem.js';

type SelfOptions = {
physicalRange: Range;
chartViewWidth: number;
numberLineXMargin: number;
groundPositionY?: number;
numberLineNodeTandem?: Tandem | null;
};

export const DRAG_CUE_SCALE = 0.8;
Expand All @@ -53,7 +55,8 @@ export default class SoccerScreenView<T extends SoccerSceneModel, Q extends Socc

const options = optionize<SoccerScreenViewOptions, SelfOptions, ScreenViewOptions>()( {
isDisposable: false,
groundPositionY: SoccerCommonConstants.GROUND_POSITION_Y
groundPositionY: SoccerCommonConstants.GROUND_POSITION_Y,
numberLineNodeTandem: null
}, providedOptions );

super( options );
Expand All @@ -74,7 +77,8 @@ export default class SoccerScreenView<T extends SoccerSceneModel, Q extends Socc
options.physicalRange, {
includeXAxis: false,
x: options.numberLineXMargin,
y: groundPositionY
y: groundPositionY,
tandem: options.numberLineNodeTandem ? options.numberLineNodeTandem : undefined
} );

/**
Expand Down

0 comments on commit ec3ed14

Please sign in to comment.