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

Revise the rulers implementation. #263

Closed
pixelzoom opened this issue Oct 28, 2021 · 2 comments
Closed

Revise the rulers implementation. #263

pixelzoom opened this issue Oct 28, 2021 · 2 comments
Assignees

Comments

@pixelzoom
Copy link
Contributor

pixelzoom commented Oct 28, 2021

A couple of problems with the current implementation of rulers:

(1) The rulers toolbox uses some elements of the Creator pattern, but it's not quite right. And it needs to be right in order to support (and possibly facilitate) alt input design for the toolbox, in #258.

(2) It creates a new RulerNode each time the scale changes (zoom in/out). This will be a problem for PhET-iO, where it is very-much preferred to have static elements (because dynamic elements are painful).

Relevant classes are:

  • RulersToolbox
  • GeometricOpticsRulersLayer
  • GeometricOpticsRulerNode
@pixelzoom pixelzoom self-assigned this Oct 28, 2021
@pixelzoom pixelzoom changed the title Use Creator pattern for rulers toolbox. Revise the rulers implementation. Oct 28, 2021
pixelzoom added a commit that referenced this issue Oct 28, 2021
pixelzoom added a commit that referenced this issue Dec 7, 2021
pixelzoom added a commit that referenced this issue Dec 7, 2021
pixelzoom added a commit that referenced this issue Dec 7, 2021
pixelzoom added a commit that referenced this issue Dec 7, 2021
pixelzoom added a commit that referenced this issue Dec 7, 2021
pixelzoom added a commit that referenced this issue Dec 7, 2021
@pixelzoom
Copy link
Contributor Author

pixelzoom commented Dec 8, 2021

Lots of work on this today, including a chunk of PhET-iO instrumentation.

The relevant classes are now:

  • RulersToolbox
  • RulerIconNode
  • GeometricOpticsRulerNode
  • GeometricOpticsRuler

TODO:

  • Convert GeometricOpticsRuler.positionProperty and GeometricOpticsRulerNode.dragBoundsProperty to model coordinates
  • Figure out why we need zoomScaleProperty in GeometricOpticsScreenView. Can everything be done with zoomTransformProperty?

@pixelzoom
Copy link
Contributor Author

I'm going to revise transforms in #277.

In summary, I used a modified version of the Creator pattern. It's really not creating anything, but is instead using 2 static instances of rulers. This works better for PhET-iO, where static instance are preferred.

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

1 participant