Is there a plugin [this is definitely not a behavior but a plugin] that can detect what is the current vertical and horizontal mouse direction ?
For example:
mouse.getHorizontal :: returns "left" or "right"
mouse.getVertical :: returns "up" or "down"
I can handle the javaScript code:
addEventListener("mousemove", getMouseDirection, false);
var xDirection = "";
var yDirection = "";
var oldX = 0;
var oldY = 0;
function getMouseDirection(e)
{
//deal with the horizontal case
if (oldX < e.pageX)
{
xDirection = "right";
}
else
{
xDirection = "left";
}
//deal with the vertical case
if (oldY < e.pageY)
{
yDirection = "down";
}
else
{
yDirection = "up";
}
oldX = e.pageX;
oldY = e.pageY;
console.log(xDirection + " " + yDirection);
}
But I do not know how to "package" this into a plugin, does anyone know how to pack this into a plugin ?