Skip to content

Commit

Permalink
add a tandem through DescriptionRegistry to control the GrabDragInter…
Browse files Browse the repository at this point in the history
…action with the prototype plugin, see #292
  • Loading branch information
jessegreenberg committed Oct 3, 2024
1 parent 7616511 commit 69c9a16
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions js/macro/view/MacroPHProbeNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@
* @author Chris Malley (PixelZoom, Inc.)
*/

import { DragListener, InteractiveHighlighting, KeyboardDragListener, Node } from '../../../../scenery/js/imports.js';
import ProbeNode, { ProbeNodeOptions } from '../../../../scenery-phet/js/ProbeNode.js';
import PHMovable from '../../common/model/PHMovable.js';
import ModelViewTransform2 from '../../../../phetcommon/js/view/ModelViewTransform2.js';
import optionize, { EmptySelfOptions } from '../../../../phet-core/js/optionize.js';
import Property from '../../../../axon/js/Property.js';
import optionize, { EmptySelfOptions } from '../../../../phet-core/js/optionize.js';
import PickRequired from '../../../../phet-core/js/types/PickRequired.js';
import phScale from '../../phScale.js';
import PHScaleQueryParameters from '../../common/PHScaleQueryParameters.js';
import ModelViewTransform2 from '../../../../phetcommon/js/view/ModelViewTransform2.js';
import GrabDragInteraction from '../../../../scenery-phet/js/accessibility/grab-drag/GrabDragInteraction.js';
import WASDCueNode from '../../../../scenery-phet/js/accessibility/nodes/WASDCueNode.js';
import ProbeNode, { ProbeNodeOptions } from '../../../../scenery-phet/js/ProbeNode.js';
import { DragListener, InteractiveHighlighting, KeyboardDragListener, Node } from '../../../../scenery/js/imports.js';
import DescriptionRegistry from '../../../../tandem/js/DescriptionRegistry.js';
import Tandem from '../../../../tandem/js/Tandem.js';
import PHMovable from '../../common/model/PHMovable.js';
import PHScaleQueryParameters from '../../common/PHScaleQueryParameters.js';
import phScale from '../../phScale.js';

type SelfOptions = EmptySelfOptions;
type MacroPHProbeNodeOptions = SelfOptions & PickRequired<ProbeNodeOptions, 'tandem'>;
Expand Down Expand Up @@ -107,6 +108,11 @@ export class MacroPHProbeNode extends InteractiveHighlighting( Node ) {
}
} );

// TODO https://github.com/phetsims/ph-scale/issues/292, https://github.com/phetsims/ph-scale/issues/294, So the GrabDragInteraction can be controlled by the prototype description plugin
if ( phet.chipper.queryParameters.supportsDescriptionPlugin ) {
DescriptionRegistry.add( options.tandem.createTandem( 'grabDragInteraction' ), grabDragInteraction );
}

//TODO https://github.com/phetsims/scenery-phet/issues/872 This should be unnecessary if matrix stuff is fixed in GrabDragInteraction.
this.boundsProperty.link( () => {
grabDragInteraction.grabCueNode.centerTop = probeNode.centerBottom.plusXY( 0, 6 );
Expand Down

1 comment on commit 69c9a16

@pixelzoom
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.