phetsims / faradays-law

"Faraday's Law" is an educational simulation in HTML5, by PhET Interactive Simulations.
http://phet.colorado.edu/en/simulation/faradays-law
GNU General Public License v3.0
1 stars 7 forks source link

1, 2, and 3 buttons don't change magnet direction if magnet caught on object #196

Closed KatieWoe closed 3 years ago

KatieWoe commented 4 years ago

Test device MacBook Air Operating System MacOS 10.15.7 Browser Chrome Problem description For https://github.com/phetsims/QA/issues/568 Fairly minor issue. The keyboard nav dialog describes the 1, 2, and 3 buttons as having the ability to "toggle slide direction." If you press the same button while the magnet is in motion, or when it is on one side of the screen, the magnet switches directions and goes back the other way. If, however, the magnet stops by catching on an object, in this case the wire loops, pressing any of the three buttons don't switch directions. You can use the arrow keys to uncatch it, so this may not need to be addressed.

Visuals ezgif com-gif-maker

Troubleshooting information:

!!!!! DO NOT EDIT !!!!! Name: ‪Faraday's Law‬ URL: https://phet-dev.colorado.edu/html/faradays-law/1.4.0-dev.65/phet/faradays-law_en_phet.html Version: 1.4.0-dev.65 2020-10-27 23:56:15 UTC Features missing: applicationcache, applicationcache, touch User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36 Language: en-US Window: 1308x686 Pixel Ratio: 1/1 WebGL: WebGL 1.0 (OpenGL ES 2.0 Chromium) GLSL: WebGL GLSL ES 1.0 (OpenGL ES GLSL ES 1.0 Chromium) Vendor: WebKit (WebKit WebGL) Vertex: attribs: 16 varying: 15 uniform: 1024 Texture: size: 16384 imageUnits: 16 (vertex: 16, combined: 80) Max viewport: 16384x16384 OES_texture_float: true Dependencies JSON: {}
KatieWoe commented 4 years ago

Further bug that is much odder and may need it's own issue (let me know if you want one @jbphet) If you do this catching behavior on the top loop, the "ghost" magnet appears on the other side of the screen it is trying to get to. If you do it on the bottom loop then the "ghost" magnet appears caught on that loop. wherestheghost

brooklynlash commented 4 years ago

faradaykeyboard2 Another small issue, don't know if this will be resolved with fixing the other problems or is related to being caught on the objects. While holding the 1,2,3 buttons and moving the magnet around a second ghost magnet pops up when moving vertically

jbphet commented 4 years ago

@emily-phet, @Ashton-Morris, and I discussed the current behavior of the 1,2,3 buttons with respect to reversing the motion of the magnet and decided that it would be better if the magnet always reversed direction when one of these keys is pressed rather than doing what it does now, which is to switch directions only once it has crossed the center line. This should resolve the initially reported problem and hopefully will result in more intuitive behavior.

KatieWoe commented 4 years ago

Should https://github.com/phetsims/faradays-law/issues/196#issuecomment-719841531 get its own issue?

jbphet commented 4 years ago

Should https://github.com/phetsims/faradays-law/issues/196#issuecomment-719841531 get its own issue?

No, at least not yet. I am making some pretty major changes to this code, so I'll try to make sure that the inconsistency described there is fixed as well. I came across some buggy code that I think was the root of the discrepancy and have fixed it, so I'm optimistic that it will no longer be a problem when I'm done with this issue.

jbphet commented 4 years ago

I've made a lot of changes to this feature, which I'm referring to in the code as the "auto-slide" feature since that's what @terracoda called it in the keyboard help dialog.

@KatieWoe - Can you please test this on master and verify that the two primary problems you reported are resolved? I'm not concerned about the issue that @brooklynlash reported in https://github.com/phetsims/faradays-law/issues/196#issuecomment-720572500. Please assign back to me with your results.

KatieWoe commented 4 years ago

Looks ok on master

jbphet commented 4 years ago

Unassigning for now, will have QA verify this on the upcoming release.

KatieWoe commented 3 years ago

I ended up seeing this in 1.4.0-rc.1, but it then stopped and I can't seem to reproduce it again. I'm not sure what caused it and what fixed it.

KatieWoe commented 3 years ago

I'm still not sure of the cause. It seems to be triggered by going back and forth and then hitting the coil. It also makes the metallic ding sound, which it doesn't seem to normally when it hits the coil after using the number buttons. I have also seemed to have more success after refreshing the page. ezgif com-gif-maker Edit: linking to rc. https://github.com/phetsims/QA/issues/581

jbphet commented 3 years ago

Indeed, it was still possible to get the magnet stuck. To do so, the user would have to press one of the auto-slide keys at the moment the magnet hit the coil. There was a single frame time (i.e. a 16 ms window) where the animation was still in progress but the target position had actually been reached, and pressing an auto-slide key at this moment caused the code to get a bit confused. I've modified it so that the animation flag is set to false immediately when the target position is reached, thus eliminating the vulnerability.

I also fixed the problem where the coil-bump sound was not being played on auto-slide key movements.

@KatieWoe - Please test both things on master. In other words, please:

Please assign this back to me with your results so that I can make sure I remember to move the change to the release branch.

KatieWoe commented 3 years ago

Those look good, but I found a similar behavior. If you press more than one of the autoslide keys while the magnet is fully on the right side of the screen, then it gets stuck there until you use the arrow keys to move the magnet. I haven't seen this on the left side of the screen or against magnets, or in the middle of the screen. pressmultiple

jbphet commented 3 years ago

Hmm, multiple simultaneous speed-key presses, eh? Well there's a test I never thought to run. I've added code to handle that case, please test on master.

jbphet commented 3 years ago

The fixes for the problems related to this issue found in 1.4.0-rc.1 have now been cherry picked to the 1.4 release branch.

phet-steele commented 3 years ago

I think this is fixed? There is a lot in this issue, and I am somewhat distracted by #214. It's hard for me to know if #214 is one of the bugs listed in this issue, or a regression from one of their fixes, or what. So I am not entirely sure if I want to close this?

KatieWoe commented 3 years ago

I still see differing behavior on that right size, but it no longer seems to make it so you can't use the number sliders.

KatieWoe commented 3 years ago

Other than what @phet-steele saw with https://github.com/phetsims/faradays-law/issues/214, the aspects mentioned here seemed fixed. It's a bit hard to tell with https://github.com/phetsims/faradays-law/issues/196#issuecomment-739050300, since it apparently requires such exact timing, but I haven't managed to reproduce it.

jbphet commented 3 years ago

We decided to go with it, and the sim has been published. Closing.