Closed pixelzoom closed 1 year ago
Ready for review by @amanda-phet. First, confirm that this change is desired. Then confirm that it is working correctly: Open the sim in Studio, select tools.referenceLine.xProperty
in the tree, then drag the Reference Line scrubber. Confirm that the xProperty
snaps to 1 decimal place when the Reference Line scrubber is released.
@amanda-phet stated in a Slack conversation:
Yes, I agree the change is a good one (the lack of precision's of the line actually came up in a meeting I was in Friday!) ... I think it is a good change.
Unassigning @amanda-phet, I'll test that it is working properly in Studio.
I can confirm that the xProperty in Studio snaps to 1 decimal place when the Reference Line scrubber is released.
I realized that one downside to this behavior is that the snapping is present even when values
are not on. As a result, it is not possible to put the reference line at particular point of interest.
A typical usage of the reference line would be to create a curve, and align the reference line at the maximum of f(x) and observe that derivative curve is zero at this point. The maximum of f(x) is unlikely to be at multiplies of 0.1, so it is slightly off the maximum. (see below where one cannot quite get the maximum of the integral ).
I see two options
I would vote for two, but I am happy to be outvoted.
I thought it would be an easy issue to review and close 😞. Reassigning to @amanda-phet for input.
In today's standup meeting, @amanda-phet and @catherinecarter said that they'd like to revert the snapping, and that it's OK that the displayed value and Property value may be slightly different. I've done that in the above commit.
So the next question is... When the model value and the displayed value may be different, we typically both the model and displayed value in the PhET-iO API. We currently do not provide a way to get the displayed value.
@amanda-phet please choose one of these 3 options:
(1) Do nothing.
(2) Instrument referenceLineNode.numberDisplay
. The Studio tree is shown below. The value will contain a lot of markup, which makes it more difficult for the client to parse, for example:
"<span style='font-family: \"Times New Roman\", Times, serif;font-style: italic'>‪x‬</span> = 5.5"
(3) Add new Property referenceLineNode.xDisplayProperty
. The Studio tree is shown below. The value will look like (for example): 5.5
Option (3) sounds best to me. Thanks for thinking about all of these implications!
Option (3) is done, closing. Feel free to have a look in master.
For https://github.com/phetsims/qa/issues/921 ...
While working on other issues, I noticed that with "Value" preference on, the Reference Line displays only 1 decimal place for the x value. For example:
But inspecting
tools.referenceLine.xProperty
in Studio, the value is actually5.496479633520075
.So much like sliders, I believe that we should be snapping to 1 decimal place at the end of a drag cycle. I'm going to go ahead and do this, and confirm later during review.
Other scrubbers (tangent, area) do not need to be snapped, because they do not display the x coordinate.