sinisterchipmunk / jax

Framework for creating rich WebGL-enabled applications using JavaScript and Ruby
http://jaxgl.com
MIT License
96 stars 16 forks source link

Would be handy if buildMouseEvent method were public #61

Closed nat-n closed 12 years ago

nat-n commented 12 years ago

Referring to https://github.com/sinisterchipmunk/jax/blob/55f6d07f85e3dea55232dfbf768517f34c3850e1/lib/assets/javascripts/jax/events.js#L87

This would be useful as a public method for instance, when layering another non Jax cavas (such as Raphael SVG canvas) above part of the Jax WebGL canvas, and wanting mouse move and click events to be easily re-routable so they fire in the active controller as if the higher canvas weren't there.

sinisterchipmunk commented 12 years ago

A lot of private APIs are going to be made public in the next release. I'll make sure this tops the list.

sinisterchipmunk commented 12 years ago

Event handling has been completely rewritten in v3.0, and this functionality has been moved from Jax.Context into Jax.Input.Mouse. See mouse.js.coffee#L44.

The trigger method is used to create DOM events and dispatch them to the underlying canvas element, which will then dispatch the event to Jax and anything else listening to the canvas. The processEvent method works one level higher, bypassing the canvas element and dispatching events directly to Jax.