phetsims / scenery

Scenery is an HTML5 scene graph.
MIT License
55 stars 12 forks source link

Support showing pointer locations #111

Open jonathanolson opened 11 years ago

jonathanolson commented 11 years ago

Useful for recordings. We could provide a default graphic behavior, but allow plugging in other ways of displaying them?

jonathanolson commented 11 years ago

Ideally, this should be done almost exactly like Scene's focusRingSVGContainer / focusRingPath. It is drawn in SVG directly, has pointer-events none (so it is pass-through on all browsers for DOM elements below), and is updated on updateScene().

It could be a dot, crosshair, ring, circle, etc. Not sure what will work best.

Code to do this should only be active once scene.input is created (it's a scenery.Input, and is created in Scene.initialize*Events). Hook into Input.addPointer / Input.removePointer for touches (and pen events also). If you want the mouse to be recorded, do this on the pointer instance that is created in the Input constructor.

To record pointer movements, add a 'move' input listener onto pointers when they are added (addPointer), and remove the listener when they disappear (removePointer).

I was imagining experimenting with ghosting (fade out previous locations instead of only showing a graphic at the current location), or possibly trails, so that it is easy to visualize the path.

Additionally, I thought it would be useful to show something for state changes (either a change of color when the pointer is up/down, which is important for the mouse, or some other visual way of indicating something).

jonathanolson commented 11 years ago

Also, this should be toggle-able during runtime.

jonathanolson commented 11 years ago

We should also most likely place https://github.com/phetsims/scenery/issues/79 in the same area.

samreid commented 11 years ago

Merged changes to master, closing.

samreid commented 11 years ago

Outstanding TODOs from this week's meeting:

samreid commented 10 years ago

Does scenery 02 have any effort done on the task of showing pointers?

jonathanolson commented 10 years ago

I believe I ported the overlay. Besides that no extra effort.

samreid commented 9 years ago

I marked this for scenery 02, not needed in scenery/01.

jonathanolson commented 9 years ago

@ariel-phet and @samreid, this is marked as high-priority and remaining-work-for-0.2. Is there a deadline on this particular feature?

samreid commented 9 years ago

As far as I know, there is no deadline and we could safely drop the high-priority label.

samreid commented 9 years ago

This feature was requested by ETS for playback of pointers for research. Would be great for me to get @jonathanolson help on the best way to store the pointer locations as a function of time.

samreid commented 8 years ago

@kathy-phet reminded me that we wish to have pointers displayed during input event playback, and I wanted to check in on the status of this issue. @jonathanolson what is the status? What is your current recommendation for how to proceed?

jonathanolson commented 8 years ago

@jonathanolson what is the status? What is your current recommendation for how to proceed?

Your original implementation seems to be working, just add ?showPointers.

It's different if you want to store pointer locations as a function of time, in addition to the Scenery events. You only need the Scenery events in order to show pointer locations.

samreid commented 8 years ago

Wow, neat! Looks great. Looks like this is just open to address the issues in this comment? https://github.com/phetsims/scenery/issues/111#issuecomment-25262533

Unassigning for now.