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

Incorrect ruler length with shuffleListeners query parameter #133

Closed
veillette opened this issue Jul 27, 2021 · 4 comments
Closed

Incorrect ruler length with shuffleListeners query parameter #133

veillette opened this issue Jul 27, 2021 · 4 comments
Assignees

Comments

@veillette
Copy link
Contributor

As part of the work on #129, we found that run the simulation with the query parameters ea&shuffleListeners lead to an unexpected behavior.

Putting a ruler within the playArea and zooming out leas to a ruler that is twice as long as expected.

image

@veillette veillette mentioned this issue Jul 30, 2021
@pixelzoom pixelzoom changed the title Incorrect Length of ruler when the listener order is shuffled. Incorrect ruler length with ?shuffleListeners Sep 18, 2021
@pixelzoom
Copy link
Contributor

It would not be tragic if this sim did not support ?shuffleListeners. So I'm going to unassign this for now, and we can decide whether we want to spend time on it when we get closer to public deployment.

@pixelzoom pixelzoom changed the title Incorrect ruler length with ?shuffleListeners Incorrect ruler length with shuffleListeners query parameter Sep 18, 2021
@pixelzoom
Copy link
Contributor

The problem is in GeometricOpticsRulerNode:

    zoomScaleProperty.link( zoomScale => {

      // update model length, so that view length remains the same
      ruler.scaleLength( zoomScale );

      // update view
      this.removeAllChildren();
      this.addChild( createRulerNode( this.ruler.length, zoomTransformProperty.value, zoomScale, options.rulerOptions ) );
    } );

This listener depends on zoomScaleProperty and zoomTransformProperty, but is only listenening to zoomScaleProperty. It assumes that zoomTransformProperty is updated before zoomScaleProperty.

@pixelzoom
Copy link
Contributor

The rulers went through a major rewrite. But this is still a problem, as indicated by this TODO in GORulerNode.js:

    //TODO https://github.com/phetsims/geometric-optics/issues/133 this listener also depends on zoomTransformProperty, so there's a problematic ordering dependency there
    zoomScaleProperty.link( zoomScale => {

@pixelzoom
Copy link
Contributor

Fixed in the above commit, tested with shuffleListeners, closing.

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

2 participants