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

Grabbed tool should pop to the front #450

Open
samreid opened this issue Sep 16, 2019 · 12 comments
Open

Grabbed tool should pop to the front #450

samreid opened this issue Sep 16, 2019 · 12 comments

Comments

@samreid
Copy link
Member

samreid commented Sep 16, 2019

From #434

When grabbing a tool, it should go to the front (in z-ordering) relative to other grabbable tools. This will not be fixed for 2.0.

@samreid
Copy link
Member Author

samreid commented Jun 1, 2020

Measuring tape now moves to the front in the mentioned issue.

@samreid
Copy link
Member Author

samreid commented Jun 1, 2020

Implemented and would be nice to have some QA testing for this feature.

@brooklynlash
Copy link

Works in dev.24

@KatieWoe
Copy link
Contributor

I noticed in 1.1.0 rc.3 that this works in most cases, but if the stopwatch is behind another tool, and you press one of its buttons, it does not jump to the top. It does if you grab a non-button area.
moveforwardbuttons

@samreid
Copy link
Member Author

samreid commented Jan 29, 2021

There is a natural place we could add a moveToFront listener in the restart button. But the play pause button is a BooleanRectangularToggleButton and has no apparent places to listen for press. We could listen to the play/pause property and move to front when it changes, but then it would also move to front when it changes without a button press. @jonathanolson and @pixelzoom I noticed you have commits in StopwatchNode, can you please recommend how to proceed?

@samreid samreid assigned jonathanolson and pixelzoom and unassigned samreid Jan 29, 2021
@jonathanolson
Copy link
Contributor

What is the desired behavior? I'm still very uneasy about having a default "moveToFront" inside a component (but I guess you can always wrap it with a Node if desired?)

But the play pause button is a BooleanRectangularToggleButton and has no apparent places to listen for press.

That seems like something that might be nice to have for this and other reasons.

I think the better approach is to NOT have moveToFront baked into StopwatchNode (especially just in the dragTarget!!!), but instead a client can add a listener to it that moves it to the front when interacted with.

@samreid
Copy link
Member Author

samreid commented Jan 29, 2021

I discussed with @arouinfar and we agreed that it's not a blocking publication issue that clicking the buttons doesn't bring the stopwatch to the front. Since waves intro 1.1.0-rc.3 moves the stopwatch node to front for all except for the buttons, I'll remove this issue from the milestone.

I think the better approach is to NOT have moveToFront baked into StopwatchNode (especially just in the dragTarget!!!), but instead a client can add a listener to it that moves it to the front when interacted with.

That seems like a nontrivial issue which would probably need to be discussed with the dev team, and may go against parts of the decision in phetsims/scenery-phet#608 (comment). Up to @jonathanolson if we should open an issue for that.

@samreid samreid removed this from the sonify + basic keyboard nav milestone Jan 29, 2021
@jonathanolson
Copy link
Contributor

Or, presumably we'd want all StopwatchNodes to moveToFront with the buttons, so StopwatchNode could create a listener on ALL of itself?

@samreid
Copy link
Member Author

samreid commented Jan 29, 2021

This patch seems to be working OK, is it what you had in mind?

Index: js/StopwatchNode.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/StopwatchNode.js b/js/StopwatchNode.js
--- a/js/StopwatchNode.js	(revision 18007999e489b1f4709ac13fb18695329d80b9d4)
+++ b/js/StopwatchNode.js	(date 1611963761694)
@@ -159,7 +159,7 @@
     const stopwatchVisibleListener = visible => {
       this.visible = visible;
       if ( visible ) {
-        this.moveToFront();
+        // this.moveToFront();
       }
       else {
 
@@ -205,7 +205,7 @@
       // The StopwatchNode always calls moveToFront on drag start
       const startOption = dragListenerOptions.start;
       dragListenerOptions.start = () => {
-        this.moveToFront();
+        // this.moveToFront();
         startOption && startOption();
       };
 
@@ -238,6 +238,10 @@
     // @private
     this.numberDisplay = numberDisplay;
 
+    this.addInputListener( {
+      down: () => this.moveToFront()
+    } );
+
     // support for binder documentation, stripped out in builds and only runs when ?binder is specified
     assert && phet.chipper.queryParameters.binder && InstanceRegistry.registerDataURL( 'scenery-phet', 'StopwatchNode', this );
   }
@@ -293,7 +297,7 @@
    * @param {Object} [options]
    * @returns {function(time:number):string} - see NumberDisplay options.numberFormatter
    */
-  static createRichTextNumberFormatter( options ){
+  static createRichTextNumberFormatter( options ) {
 
     options = merge( {
 

@samreid
Copy link
Member Author

samreid commented Jan 29, 2021

I noticed the patch doesn't pop it to the front when dragging out of the toolbox though.

@jonathanolson
Copy link
Contributor

I noticed the patch doesn't pop it to the front when dragging out of the toolbox though.

Presumably we'd want to handle touch-snag and the toolbox pattern! Having a DragListener with attach:false would handle the first, however the second would almost require information from the actual DragListener being triggered, right?

@jonathanolson jonathanolson removed their assignment Jan 30, 2021
@samreid
Copy link
Member Author

samreid commented Jan 30, 2021

I'll move the latter part of the conversation to a new issue in scenery-phet.

@samreid
Copy link
Member Author

samreid commented Jan 30, 2021

Since this issue is non-blocking for Waves Intro, I'm unassigning. We can continue in phetsims/scenery-phet#659 as appropriate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants