some questions on modifying mouse event handling

I'm trying to revise 3d picking to generate events on mouse-over rather than on mouse-up. i've got something working, but it seems to me to be more than a bit of a hack, so i wanted to see if there was any better way to do it.

The general approach that I took was to modify the behavior in MouseHelper.processEvent(), adding code similar to the block for if (function[DIRECT]) to the handling of all mouseMoved events. This will have lead to calls to direct_renderer.drag_direct(), which will then generate the correct events.

This sounds simple enough in theory, except for the thorny problem that MouseHelper as written is difficult to subclass. Lots of private variables, etc.

So, I created a new file MouseOverHelper, which is a subclass of MouseHelper, contaiing the _exact_same_ code as MouseHelper. I then created a subclass of MouseBehavior to use this new mouse helper, installed it in my renderer, and it works great.

but, as I said, it's more than a bit of a hack.

so, my first question is this: is there a cleaner way to do this?

My second question: what about modifying MouseHelper to make it more easily subclassed? I can imagine abstracting out some of the bits in processEvents to make them easily subclassable. Alternatively, the "private" members in MouseHelper could be changed to protected. I'd be glad to try to sketch up such a revised version if it would be helpful.



  • 2004 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: