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

multi-touch: cancel interactions when switching screens #70

Closed
pixelzoom opened this issue Oct 28, 2013 · 20 comments
Closed

multi-touch: cancel interactions when switching screens #70

pixelzoom opened this issue Oct 28, 2013 · 20 comments

Comments

@pixelzoom
Copy link
Contributor

This is a general problem with multi-touch that affects all sims.

First reported by @orejolaphet in this beers-law-lab issue: phetsims/beers-law-lab#57.

If you change between screens while interacting with an object, that object will freeze and be immovable when you return to that screen. Resetting the screen will move objects to original position, but the object will still be frozen. You can also freeze the reset button and the selections to different screens themselves. The only way to correct the problem is to reload the sim.

@pixelzoom
Copy link
Contributor Author

Somewhat similar to phetsims/scenery#109, which deals with what to do when the "Reset All" button is pressed while manipulating an object.

@pixelzoom
Copy link
Contributor Author

@jonathanolson recommended in Skype: discussing general canceling, and when it should happen by default. for instance, if a Node is removed from the tree / set invisible, should its listeners be notified?

@samreid
Copy link
Member

samreid commented Oct 8, 2014

Can this be handled centrally in scenery? Like scenery.scene.cancelAllInput()?

@jonathanolson
Copy link
Contributor

It will require some Scenery input work to handle nicely.

@jonathanolson
Copy link
Contributor

@ariel-phet, this is also a probably-multi-day issue tagged for the redeploy, should I bump up the priority of this Scenery work (currently tagged as medium priority)?

@jonathanolson
Copy link
Contributor

Removed redeploy label since we're not running into it much right now.

@pixelzoom
Copy link
Contributor Author

5/28/15 dev meeting: @ariel-phet said "don’t worry about it for now".

@ariel-phet
Copy link

I attempted to reproduce this issue on Beer's Law lab on iPad2 iOS 9.3.5 and it is not longer present, I can switch screens while manipulating objects with no obvious consequences. Closing

@pixelzoom
Copy link
Contributor Author

pixelzoom commented Nov 29, 2016

Reopening.

It's probably no longer present in Beer's Law Lab because I worked around it in client code. Depending on how the client implements interaction, I still stand by my original statement: "This is a general problem with multi-touch that affects all sims." There needs to be common-code support for cancelling interactions, and that support needs to be wired into joist for screen switching.

Unfortunately there is still no such common-code support. The plan is to address this in scenery, but the issue hasn't gotten any traction (see phetsims/scenery#218, over 3 years old).

My recommendation is to leave this issue open, so that if/when phetsims/scenery#218 gets some love, we remember to wire it into joist.

@pixelzoom pixelzoom reopened this Nov 29, 2016
@pixelzoom pixelzoom changed the title multi-touch: switching screens while manipulating an object has dire consequences multi-touch: cancel interactions when switching screens Nov 29, 2016
@pixelzoom
Copy link
Contributor Author

I renamed this issue to indicate what we need to remember to do.

@pixelzoom
Copy link
Contributor Author

@jonathanolson Now that we have an API for canceling interactions... Your thoughts on how to cancel interactions when switching screens? It seems like this is something that should be handled automatically in joist, whenever screen selection changes.

@samreid
Copy link
Member

samreid commented Apr 27, 2017

Your thoughts on how to cancel interactions when switching screens?

I wonder if it should be even more general and handled in scenery. Something like "when a node is no longer in the scene graph, interaction is automatically cancelled". Not sure if we would need to expand this to "no longer in the scene graph or visible".

@jonathanolson
Copy link
Contributor

Now that we have an API for canceling interactions... Your thoughts on how to cancel interactions when switching screens? It seems like this is something that should be handled automatically in joist, whenever screen selection changes.

Yes, presumably Joist would call interruptSubtreeInput on the screenView and any listeners using this (phetsims/scenery#131) would handle it properly.

@jonathanolson
Copy link
Contributor

Something like "when a node is no longer in the scene graph, interaction is automatically cancelled".

I had thought about that, but was concerned enough about when children of a node is changed, it triggers removal of everything and then adds everything (potentially adding nodes back), and figured that would break things.

@samreid
Copy link
Member

samreid commented Apr 27, 2017

OK it sounds good to have explicit triggers for breaking interaction, but we should make sure it is general and flexible so it works for screens/scenes or other types of modal behavior.

@samreid
Copy link
Member

samreid commented Apr 27, 2017

@jonathanolson and @pixelzoom will talk about this.

@pixelzoom
Copy link
Contributor Author

4/27/17 dev meeting: @jonathanolson and I will talk about ways to do this.

@pixelzoom pixelzoom self-assigned this Apr 27, 2017
@pixelzoom
Copy link
Contributor Author

pixelzoom commented Jun 12, 2017

Skype:

[6/12/17, 2:42:57 PM] Jonathan Olson: Pushing input interruption changes to common code. If you notice anything going wrong, contact me or comment in phetsims/scenery#218 (has commits that would need to be reverted).
[6/12/17, 2:47:16 PM] Jonathan Olson: Note that now, subtypes of DownUpListener/SimpleDragHandler (like almost all of our listeners that matter), can be interrupted properly by calling interruptSubtreeInput() on a Node. It will "interrupt" the listeners on all descendants
[6/12/17, 2:48:11 PM] Chris Malley: Could this be a simple way to interrupt interactions when switching Screens? #70
[6/12/17, 2:48:30 PM] Jonathan Olson: My commit interrupts the freshly-inactive screen
[6/12/17, 2:48:52 PM] Jonathan Olson: So, that issue might have just been handled for almost all listeners
[6/12/17, 2:49:29 PM] Jonathan Olson: Haven't tested fully, but it should presumably be fixed

So this may have been handled.

@pixelzoom
Copy link
Contributor Author

pixelzoom commented Jun 14, 2017

@jonathanolson indicated "haven't tested fully" and I'm unclear on how to test. So unassigning myself for now. Feel free to assign to me if this needs future test or review.

@pixelzoom pixelzoom removed their assignment Jun 14, 2017
@pixelzoom
Copy link
Contributor Author

pixelzoom commented Dec 30, 2018

This has been handled since 6/12/2017 by Sim.js, using scenery's interruptSubtreeInput feature. I.e.:

    // When the user switches screens, interrupt the input on the previous screen.
    // See https://github.com/phetsims/scenery/issues/218
    this.currentScreenProperty.lazyLink( function( newScreen, oldScreen ) {
      if ( oldScreen === null ) {
        self.homeScreen.view.interruptSubtreeInput();
      }
      else {
        oldScreen.view.interruptSubtreeInput();
      }
    } );

See also phetsims/scenery#218 and b35547e.

So... closing

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

4 participants