Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward from the toolbox directly to the group sort interaction mode #20

Open
samreid opened this issue Feb 24, 2025 · 2 comments
Open

Comments

@samreid
Copy link
Member

samreid commented Feb 24, 2025

From discussion with @zepumph, we would like to share interaction code by forwarding from the toolbox channel "grab" direction to the group sort interaction mode.

I wrote this patch, but it doesn't know how to tell the group sort interaction that the current item is grabbed. @zepumph can you please advise?

Subject: [PATCH] Add TODO
---
Index: ../../phet/root/membrane-channels/js/common/view/MembraneChannelsScreenView.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/../../phet/root/membrane-channels/js/common/view/MembraneChannelsScreenView.ts b/../../phet/root/membrane-channels/js/common/view/MembraneChannelsScreenView.ts
--- a/../../phet/root/membrane-channels/js/common/view/MembraneChannelsScreenView.ts	(revision 05638f0f2ae18126e7b6f12a7dd51aebf54c368d)
+++ b/../../phet/root/membrane-channels/js/common/view/MembraneChannelsScreenView.ts	(date 1740426266196)
@@ -271,7 +271,10 @@
     this.addChild( channelDragNode );
 
     if ( focus ) {
-      channelDragNode.focus();
+      // channelDragNode.focus();
+      this.observationWindow.membraneGroupSortInteractionView.model.selectedGroupItemProperty.value = this.model.getSlotIndex( slot );
+      this.observationWindow.membraneGroupSortInteractionView.model.hasKeyboardGrabbedGroupItemProperty.value = true;
+      this.observationWindow.focus();
     }
 
     // TODO: once keyboarded, prevent mouse+touch, or do this on init
Index: ../../phet/root/scenery-phet/js/accessibility/group-sort/view/GroupSelectView.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/../../phet/root/scenery-phet/js/accessibility/group-sort/view/GroupSelectView.ts b/../../phet/root/scenery-phet/js/accessibility/group-sort/view/GroupSelectView.ts
--- a/../../phet/root/scenery-phet/js/accessibility/group-sort/view/GroupSelectView.ts	(revision 4a7900c0b5578adf1a036b021df30de3b5b99d29)
+++ b/../../phet/root/scenery-phet/js/accessibility/group-sort/view/GroupSelectView.ts	(date 1740426069883)
@@ -88,7 +88,7 @@
   private readonly getNodeFromModelItem: ( model: ItemModel ) => ItemNode | null;
 
   public constructor(
-    protected readonly model: GroupSelectModel<ItemModel>,
+    public readonly model: GroupSelectModel<ItemModel>,
     primaryFocusedNode: Node, // Client is responsible for setting accessibleName and nothing else!
     providedOptions: GroupSelectViewOptions<ItemModel, ItemNode> ) {
 
Index: ../../phet/root/membrane-channels/js/common/view/ObservationWindow.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/../../phet/root/membrane-channels/js/common/view/ObservationWindow.ts b/../../phet/root/membrane-channels/js/common/view/ObservationWindow.ts
--- a/../../phet/root/membrane-channels/js/common/view/ObservationWindow.ts	(revision 05638f0f2ae18126e7b6f12a7dd51aebf54c368d)
+++ b/../../phet/root/membrane-channels/js/common/view/ObservationWindow.ts	(date 1740426069888)
@@ -40,7 +40,7 @@
   private readonly stepEmitter = new Emitter<[ number ]>( {
     parameters: [ { valueType: 'number' } ]
   } );
-  private readonly membraneGroupSortInteractionView: MembraneGroupSortInteractionView;
+  public readonly membraneGroupSortInteractionView: MembraneGroupSortInteractionView;
 
   public constructor( private readonly model: MembraneChannelsModel, view: MembraneChannelsScreenView,
                       public readonly modelViewTransform: ModelViewTransform2, canvasBounds: Bounds2, tandem: Tandem ) {
@zepumph
Copy link
Member

zepumph commented Feb 24, 2025

I think things are working above. I want to pass it back to review, but then I still want to try to factor out all the Property values into a single, public, API function that can set us up better for forwarding in the future.

@samreid
Copy link
Member Author

samreid commented Feb 25, 2025

Changes and behavior look good. @zepumph want to continue here or in a new issue in scenery-phet?

@samreid samreid assigned zepumph and unassigned samreid Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants