phetsims / circuit-construction-kit-dc

"Circuit Construction Kit: DC" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
11 stars 8 forks source link

Circuit elements should pop up above touch events #119

Closed samreid closed 7 years ago

samreid commented 7 years ago

On iPad2, the finger obscures the circuit element when dragged out of the toolbox. It would be better to pop it up some pixels or grab it near the bottom so it is easier to see. Not sure if this should be same "grab point" for touch and mouse, or if touch should be a special case. @arouinfar what do you think?

arouinfar commented 7 years ago

@samreid it looks like the "grab point" is currently the middle of the object. I think you could move it down to the bottom and that would alleviate the issue on iPad. I would use the same grab point for touch and mouse -- no need to create a special case.

samreid commented 7 years ago

My gut reaction on seeing a wire drag out by the bottom center (by the mouse) is that it feels buggy--I'm sure this is to some extent because I'm used to the center drag. But it makes me wonder how complex it would be to separate these (touch vs mouse)--if it is just a few lines of code, we should maybe go for it.

arouinfar commented 7 years ago

if it is just a few lines of code, we should maybe go for it.

Sounds good @samreid

samreid commented 7 years ago

Proposed fix is here. @arouinfar can you please test? http://www.colorado.edu/physics/phet/dev/html/circuit-construction-kit-dc/1.0.0-dev.116/circuit-construction-kit-dc_en.html

arouinfar commented 7 years ago

@samreid did you end up going the touch-only route? Things look the same on my Mac.

samreid commented 7 years ago

Yes, the modified vertical translation is for touch only, the behavior for dragging should still be the same (except the centering was fixed for the light bulb.)

samreid commented 7 years ago

By the way, on Mac Chrome you can open the console and click the 2nd icon (that looks like a phone next to an iPad).

image

That will let you choose a device profile: image

and then you can simulate touch events using the mouse. This should not replace on-device testing, but may come in handy sometimes.

arouinfar commented 7 years ago

Thanks for the tip @samreid! Tested the latest dev on iPad, and the popping elements look really nice.