Simulating a double click for a tool?

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Simulating a double click for a tool?

Post by heyvern »

Has anyone tried this or would this be possible?

Of course I am assuming a double click is not already available in lua or Moho... I didn't see one in the reference.

-------------------

It would have to be some kind of timer that could determine how quickly two mousedown/mouseups have occurred.

A timer that expires very quickly after the "first click" but if multiple mousedowns within that time a variable is assigned which would activate a different action within a tool function thingy.

I would like to add something like this in the modified universal select tool for selecting an entire mesh by double clicking.

This could add a lot of "extra" gizmos to existing tools... er... if it works.

------------------

I will try to play around with this and see what happens.

-Vern
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

Huh...

I am actually able to register a double-click using os.clock().

I store self.elapsedTime at the beginning of the tool script.

on mouse up I compare the time that has elapsed. If you are "using" a tool while the mouse is down then the time will always be larger than a "default" range.

For my script the default time it takes to process the whole mouse down/up procedure is about .08. But if you double-click on a point really fast... it goes faster... so that is what I am checking.

It isn't perfect... but if it limited to a specific spot... like double clicking a selected point or something... it might be useful.

It would have to be adjusted for each persons computer. Some would process the script faster.

Currently... it is only a "fake" double-click... not quite ready for prime time...

"I'm not a real double-click but I play one on TV"

This is probably a lost cause... but... a fun experiment.

-Vern
User avatar
rylleman
Posts: 750
Joined: Tue Feb 15, 2005 5:22 pm
Location: sweden
Contact:

Post by rylleman »

Cool experiment, will probably be useful.
Post Reply