Mouse gestures for every application?

Uncategorized 1 Comment »

Opera users know them since the year 2001 and Lionhead's computer game Black and White made them famous: mouse gestures.

mouse gestures example
A typical usage of mouse gestures: navigating to the next tab.

Hold down the mouse button and move the cursor to draw a special sign which will lead the active program to perform a specified task. For example, draw a line from the right to the left to navigate backwards in your web browser or draw a line from the left to the right to navigate forwards.
After an initial period of settling in, using mouse gestures feels so natural you will not want to miss them again. I guess that comes from the fact, that you use your hands to perform most tasks and so using the mouse to point and click is not as abstractly as using the keyboard.

The big advance of mouse gestures is that you do not have to leave the field of action. For example, if you want to undo the last step you have two possibilities:
a) move the mouse cursor to the undo icon and click it
b) take your hand from the mouse to perform the keyboard shortcut
In both cases you have to restore the initial situation before you can continue working: you either to move your hand back on the mouse or the mouse cursor back to the old position on the screen. By using mouse gestures you just have to correct the position of the cursor a little bit.

While using mouse gestures in every browser, I was a bit disappointed that I can not use them in other applications. Actually, there are a few programs which add them supplementary to the operation systems, but in my opinion this functionality should by directly in the OS, offering the developers an adequate API.
Nevertheless, in the next weeks I will try some of these programs on my daily work and report about my experiences with them and a possibly change in my workflow. :-)

Optimization Monday — Part II: function handles

Optimization Monday No Comments »

This entry is a little late, due my holiday (prearrangement), but nevertheless here is the hint for August 2007: use function handles instead of strings for window.setTimeout() and window.setInterval().
By using function handles you avoid an unnecessary evaluation of a string.

So instead of

var myHandle = window.setTimeout("doStuff()", 100);

use

var myHandle = window.setTimeout(doStuff, 100);

Of course this hint is only useful if want to call a parameter less function — which should be no problem in connection with window.setTimeout() or window.setInterval(). ;-)

Update:
Actually, there is a way for having a function call with parameters. All we need is a wrapper function and a little bit closures magic:

function wrapperFunc(firstParam, secondParam){
  return (function(){
    doStuff(firstParam, secondParam);
  });
}
 
var myWrapper = wrapperFunc('foo', 'bar');
var myHandle = window.setTimeout(myWrapper, 100);

The real trick is that the myWrapper variable contains an anonymous function together with two variables, which were set when wrapperFunc() was called. By applying this variable to windows.setTimeout() method, the anonymous function (containing the call of doStuff()) will be executed after the given timeout.


WordPress Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in