Skip to content

Commit

Permalink
add stopwatchNode to pdomOrder, #213
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Mar 19, 2024
1 parent f4b2048 commit 931cc16
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
10 changes: 5 additions & 5 deletions js/common/view/CollisionCounterNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ export default class CollisionCounterNode extends Node {
// NodeOptions
cursor: 'pointer',
visibleProperty: collisionCounter.visibleProperty,
isDisposable: false
isDisposable: false,
tagName: 'div', // for KeyboardDragListener
focusable: true // for KeyboardDragListener
}, providedOptions );

const wallCollisionsText = new Text( GasPropertiesStrings.wallCollisionsStringProperty, {
Expand Down Expand Up @@ -152,9 +154,7 @@ export default class CollisionCounterNode extends Node {

// The background include the bezel and rectangle.
const backgroundNode = new Node( {
children: [ bezelNode, rectangleNode ],
tagName: 'div', // for KeyboardDragListener
focusable: true // for KeyboardDragListener
children: [ bezelNode, rectangleNode ]
} );

content.center = backgroundNode.center;
Expand Down Expand Up @@ -211,7 +211,7 @@ export default class CollisionCounterNode extends Node {
start: onPress,
tandem: options.tandem.createTandem( 'dragListener' )
} ) );
backgroundNode.addInputListener( new RichKeyboardDragListener( {
this.addInputListener( new RichKeyboardDragListener( {
positionProperty: collisionCounter.positionProperty,
dragBoundsProperty: dragBoundsProperty,
start: onPress,
Expand Down
7 changes: 5 additions & 2 deletions js/common/view/IdealGasLawScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export default class IdealGasLawScreenView extends BaseScreenView {
protected readonly thermometerNode: Node;
protected readonly pressureGaugeNode: Node;
protected readonly collisionCounterNode?: Node;
protected readonly stopwatchNode: Node;

protected constructor( model: IdealGasLawModel,
particleTypeProperty: StringUnionProperty<ParticleType>,
Expand Down Expand Up @@ -295,10 +296,11 @@ export default class IdealGasLawScreenView extends BaseScreenView {
}

// Stopwatch
toolsParent.addChild( new GasPropertiesStopwatchNode( model.stopwatch, {
const stopwatchNode = new GasPropertiesStopwatchNode( model.stopwatch, {
dragBoundsProperty: this.visibleBoundsProperty,
tandem: tandem.createTandem( 'stopwatchNode' )
} ) );
} );
toolsParent.addChild( stopwatchNode );

// Show how the collision detection space is partitioned into regions
let regionsNode = null;
Expand Down Expand Up @@ -356,6 +358,7 @@ export default class IdealGasLawScreenView extends BaseScreenView {
this.thermometerNode = thermometerNode;
this.pressureGaugeNode = pressureGaugeNode;
this.collisionCounterNode = collisionCounterNode;
this.stopwatchNode = stopwatchNode;
}

protected override reset(): void {
Expand Down
1 change: 1 addition & 0 deletions js/diffusion/view/DiffusionScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ export default class DiffusionScreenView extends BaseScreenView {
// Control Area focus order, see https://github.com/phetsims/gas-properties/issues/213.
this.pdomControlAreaNode.pdomOrder = [
//TODO https://github.com/phetsims/gas-properties/issues/213
stopwatchNode,
dataAccordionBox,
controlPanel,
this.timeControlNode,
Expand Down
1 change: 1 addition & 0 deletions js/energy/view/EnergyScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export default class EnergyScreenView extends IdealGasLawScreenView {
this.pdomControlAreaNode.pdomOrder = [
//TODO https://github.com/phetsims/gas-properties/issues/213
leftPanels,
this.stopwatchNode,
this.returnLidButton,
this.containerNode,
this.thermometerNode,
Expand Down
1 change: 1 addition & 0 deletions js/explore/view/ExploreScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export default class ExploreScreenView extends IdealGasLawScreenView {
this.pdomControlAreaNode.pdomOrder = [
//TODO https://github.com/phetsims/gas-properties/issues/213
this.collisionCounterNode!,
this.stopwatchNode,
this.returnLidButton,
this.containerNode,
this.thermometerNode,
Expand Down
1 change: 1 addition & 0 deletions js/ideal/view/IdealScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export default class IdealScreenView extends IdealGasLawScreenView {
this.pdomControlAreaNode.pdomOrder = [
//TODO https://github.com/phetsims/gas-properties/issues/213
this.collisionCounterNode!,
this.stopwatchNode,
this.returnLidButton,
this.containerNode,
this.thermometerNode,
Expand Down

0 comments on commit 931cc16

Please sign in to comment.