Skip to content

Commit

Permalink
Convert to TypeScript, see #1617
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Mar 2, 2024
1 parent 728ad13 commit 1099513
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions js/accessibility/pdom/PartialPDOMTrail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,22 @@
* @author Jonathan Olson <[email protected]>
*/

import { scenery } from '../../imports.js';
import { PDOMInstance, scenery, Trail } from '../../imports.js';

class PartialPDOMTrail {
/**
* @param {PDOMInstance} pdomInstance
* @param {Trail} trail
* @param {boolean} isRoot
*/
constructor( pdomInstance, trail, isRoot ) {
export default class PartialPDOMTrail {

// @public
this.pdomInstance = pdomInstance;
this.trail = trail;
// a full Trail (rooted at our display) to our trail's final node.
public readonly fullTrail: Trail;

public constructor(
public readonly pdomInstance: PDOMInstance,
public readonly trail: Trail,
public readonly isRoot: boolean // TODO: remove this, since it can be computed from the pdomInstance https://github.com/phetsims/scenery/issues/1581
) {

// TODO: remove this, since it can be computed from the pdomInstance https://github.com/phetsims/scenery/issues/1581
this.isRoot = isRoot;
this.fullTrail = this.pdomInstance.trail!.copy();

// @public {Trail} - a full Trail (rooted at our display) to our trail's final node.
this.fullTrail = this.pdomInstance.trail.copy();
// NOTE: Only if the parent instance is the root instance do we want to include our partial trail's root.
// For other instances, this node in the trail will already be included
// TODO: add Trail.concat() https://github.com/phetsims/scenery/issues/1581
Expand All @@ -34,5 +31,4 @@ class PartialPDOMTrail {
}
}

scenery.register( 'PartialPDOMTrail', PartialPDOMTrail );
export default PartialPDOMTrail;
scenery.register( 'PartialPDOMTrail', PartialPDOMTrail );

0 comments on commit 1099513

Please sign in to comment.