phetsims / molecules-and-light

"Molecules and Light" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
2 stars 5 forks source link

Using the right mouse button while interacting with sim causes freeze #342

Closed loganbraywork closed 4 years ago

loganbraywork commented 4 years ago

Test device

Windows 10 Laptop

Operating System

Windows 10 v. 1903

Browser

Chrome 83.0.4103.61 (Official Build) (64-bit)

Problem description

For https://github.com/phetsims/QA/issues/503

This occurs when interacting with any functional part of the sim, including the pause button, reset all button, and the radio buttons. An error log does appear in the console. While holding a button down (i.e. keeping it in the depressed animation by holding the left mouse button down, or in the case of the sliders highlighted), if the right mouse button is pressed the sim will then freeze completely.

Steps to reproduce

  1. Use the left mouse button to hold down the reset all button, do not release the left mouse button
  2. Without releasing the left mouse button, use the right mouse button

Visuals

2020-05-20Mlc LghtFreeze

Troubleshooting information: !!!!! DO NOT EDIT !!!!! Name: ‪Molecules and Light‬ URL: https://phet-dev.colorado.edu/html/molecules-and-light/1.5.0-dev.50/phet/molecules-and-light_all_phet.html?zoom=true Version: 1.5.0-dev.50 2020-05-12 15:11:56 UTC Features missing: generatedcontent, csstransforms3d, touch Flags: pixelRatioScaling User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36 Language: en-US Window: 1576x776 Pixel Ratio: 1.21875/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: 30 uniform: 4095 Texture: size: 16384 imageUnits: 16 (vertex: 16, combined: 32) Max viewport: 32767x32767 OES_texture_float: true Dependencies JSON: {}
An error appeared in the console as follows molecules-and-light_all_phet.html?zoom=true:912 Uncaught TypeError: Cannot read property 'initialPoint' of null at Object.move (molecules-and-light_all_phet.html?zoom=true:912) at q.value (molecules-and-light_all_phet.html?zoom=true:912) at q.value (molecules-and-light_all_phet.html?zoom=true:912) at q.value (molecules-and-light_all_phet.html?zoom=true:912) at q.value (molecules-and-light_all_phet.html?zoom=true:912) at molecules-and-light_all_phet.html?zoom=true:912 at e.value (molecules-and-light_all_phet.html?zoom=true:912) at q.value (molecules-and-light_all_phet.html?zoom=true:912) at q.value (molecules-and-light_all_phet.html?zoom=true:912) at ba.run (molecules-and-light_all_phet.html?zoom=true:912)
loganbraywork commented 4 years ago

Interestingly, this bug does not occur on Firefox but does occur on Edge and another unsupported Chromium browser

KatieWoe commented 4 years ago

Good catch @loganbraywork

jessegreenberg commented 4 years ago

Error is specifically "cannot read initialPoint of null". When I try on chrome though (unbuilt) i first get "Attempted to add an input listener that was already added", so Ill start there. Probably similar issues, but the assertion indicates why initialPoint cannot be read off of null.

jessegreenberg commented 4 years ago

Also important, this only happens when zoomed all the way out. And the steps for me to produce are 1) press and hold left button on interactive item. 2) Press and hold right mouse button 3) Release both mouse buttons 4) Press left mouse button.

jessegreenberg commented 4 years ago

In Chrome, we don't get a left mouse "up" event when the context window from the right mouse button is open. But it does in FF. That explains why this doesn't happen on that browser.

So since we don't get a left mouse up event, we don't remove the listener that was added on the first mouse down, which is why this is happening.

jessegreenberg commented 4 years ago

OK, this issue has been fixed in the above commit, which prevents a listener from being added to a press Pointer if it is already in the list of background presses.