-
Notifications
You must be signed in to change notification settings - Fork 8
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
CT failure with PressListener integration into RoundButtonView #71
Comments
…pensing property for the dropper, see phetsims/ph-scale#71
The easiest way to add a workaround to this failure would cause a slight difference in sim behavior: the dropper button would not appear to be pressed while the dropper is dispensing the initial liquid. See https://www.colorado.edu/physics/phet/dev/html/ph-scale/1.3.0-dev.3/phet/ph-scale_en_phet.html for the behavior with the workaround, and https://www.colorado.edu/physics/phet/dev/html/ph-scale/1.2.11/ph-scale_en.html for reference behavior. @ariel-phet, is this an acceptable change, or should we look into modifying our buttons so they can be synthetically pressed with no actual press? |
Internally, having a PressListener start as "pressed" leaves it in an invalid state, since any call to things like interrupt/release would try to remove its listener from a pointer (which would be a null reference). |
I don't think this issue belongs in ph-scale. It's a general issue with the implementation of PressListener. Autofill on startup is a required feature of the “Macro” screen in ph-scale. A further requirement is that the momentary button on the eyedropper must be pressed while the dropper is dispensing fluid. See MacroModel Other sims are likely to have similar issue, where the state of buttons (and other UI components that can be "pressed") is supposed to reflect the state of the model, regardless of whether the user is interacting with the button. So I don't agree that with the assumption that the initial state of |
@jonathanolson proposed:
No - this is not an acceptable change. It affects not only this sim, but the ability of all sims to have buttons (or anything use that uses PressListener) that reflect the state of the model. The state of buttons should reflect the state of the model, not the state of user interaction. |
I'll be looking into it, but I disagree about the concept of the PressListener being a view. It allows you to pass in a Property to be used as a model, but it was meant to be fully in-charge of that model state. If a more general change is required, it should probably be a separation of the "view" property from the press state of the PressListener. I will look into the ability to have synthetic external control of any properties passed to PressListener. |
Requiring |
If this is true, presumably we shouldn't allow passing in properties to be used. PressListener can just always create isPressedProperty, can mark it read-only (so clients shouldn't use it), and you can link to it? Same for things like DragListener, where instead of the convenience of being able to pass in your isUserControlled property, we should instead have multiple properties and link one of their states to the other? |
Why is |
Are you available to join a zoom call about this? It's taking up a lot of time back-and-forth to write down explanations.
ph-scale is passing in a model property to be used as the "tracking whether it is pressed" by the input listener. |
PressListener also seems to be responsible for a lot more than "pressing" . I see several things that have nothing to do with pressing: isOverProperty, isHoveringProperty, isHighlightedProperty. |
I might be available for a Zoom call later today. Depends on where I'm at with EqEx. |
I'm happy to discuss other names. |
I am going to tag this for dev-meeting currently, since it seems like there are some things worth discussing. Feel free to untag if a resolution is reached before then. |
@pixelzoom - I think pH scale predates me being on every design team...but I am a bit surprised by the autofill honestly -- not suggesting we change it necessarily, but one of our conventions has been to in general never begin sim with an animation. I believe this paradigm started with Energy Skate Park, when in the original the skater was already on the track and moving. Every other sim I can think of is "begun" with some user interaction. Maybe this autofilling has a reason, but it seems the sim could just start out with 1/2 a liter (sims like molarity, concentration begin this way). So, it seems like there are larger issues around MVC patterns and such in this issue, but I am unclear on the autofill rationale for this sim. |
To clarify why I said "this is not an acceptable change" in #71 (comment) ... First, this change would need to be run past the design team. The current behavior is present in both the Java and HTML5 versions. It was arrived at after discussion, and I recall deciding to keep it during the HTML5 redesign. I personally don't care whether the vessel autofills on startup or not. But if it does autofill, then the dropper behavior (including its button state) should make sense (which is does not in the proposed 1.3.0-dev.3 demonstration). I'm also not excited to revisit the design issue, since this was not a problem until PressListener was integrated. More importantly... The behavior of ph-scale could indeed be changed to make the CT failure go away. But it does not explain why this new constraint is necessary/desirable, or address the limitations that this constraint will impose on UX design. |
Relevant bits from pH Scale HTML5 design document are shown below. Whenever you change solutions in this sim, the beaker auto-fills to 0.50L. So the idea was that it should also auto-fill with the initial solution on startup. "P" in the "Reason" column stands for "Pedagogical": Changes made to meet the learning goals of the sim, or to improve that student sense-making in interviews around those learning goals, or to better meet with discipline specific practices and conventions Identical to pH scale basics, except that beaker animates auto-fill to 0.50 L upon startup and when solution type is switched.
|
Also note... The beaker auto-fills every time the solution is changed, not just at startup. And the proposal in #71 (comment) prevents the dropper button from looking "pressed" in all cases, not just at startup. So this has very little to do with whether it's appropriate to auto-fill the beaker with the initial solution. |
@pixelzoom thanks much for clarifications. I did not realize about he autofill when changing solutions. That behavior makes sense. So even if we did not autofill on startup, this autofill behavior would still be required, good to know. Then I definitely agree that this constraint is not desirable and we should not limit our UX with this constraint if possible. |
@jonathanolson kicking back to you. Feel free to punt until dev meeting if you feel that is appropriate and more discussion is warranted. |
Keeping the behavior sounds best. I was curious if no one would care about the change. It sounds like we'll need to decouple the sun buttons' "button model is pressed" ( I'd have a few questions about how flexible would this need to be (possibly relevant for the design team):
I see a few current approaches to this:
@pixelzoom, @samreid and @jbphet, thoughts? |
Yes, the model should be able to programmatically trigger the release of the button. I can imagine this happening when certain conditions in the model are met (such as the solution being saturated, etc). I suspect that should change the mouse cursor back to normal (though I'm not sure how important that is).
I'm not sure, I think we could construct cases either way (sometimes the mouse should be able to "take over" from the model, but sometimes the model should remain in control).
It would be unconventional to pair a model start with a user end, but I think as long as researchers know that's possible, they could parse it correctly.
So far we haven't signified property initial values on the data stream (thinking we can get them from the state stream), but maybe one day we'll have to investigate that. It would be odd for a release before a press, but as long as researchers know that's possible, I'm sure they could deal with it.
To clarify, it seems to me that |
Hmm, not ready for review. This change caused problems with CT, ill investigate. |
Same change added back, the issue was with disposing Multilink and moved to phetsims/axon#192. Back to @jonathanolson for review. |
What's the status of this issue? Labeling for developer meeting. |
I'm reviewing now. |
So it appears there were cases where createListener() was called multiple times on a single button model, but do we need to handle the case where we need to remove any? (Hopefully don't need to handle it) Changes look good to me. |
Also had an above commit that did a bit of cleanup, can you do a brief review? |
Refactoring in phetsims/sun@b0cbd63 looks nice, thanks.
No, the problem in phetsims/axon#192 was that listeners on dependencies of a multilink could still be called after the multilink had been disposed. Not that createListener was called multiple times on a button model. Since that is the case, can this be closed? |
Assigning back to myself to test ph-scale. |
ph-scale tested, look good, closing. |
Noted in phetsims/sun#336:
The text was updated successfully, but these errors were encountered: