rendered paste body//
// Startup
//
var _isDown, _strokes, _r, _g, _rc; // global variables
onselectstart = function() { return false; }
onmousedown = function() { return false; }
useBoundedRotationInvariance = true
_points = new Array();
_strokes = new Array();
_x = 0
_y = 0
_l = 0
_h = 0
startX = 0
startY = 0
function loadbang()
{
// _r = new NDollarRecognizer(document.getElementById('useBoundedRotationInvariance').checked);
_isDown = false;
// point array for current stroke
// array of point arrays\
}
// assign area for gesture recognition - useful if you don't want to use the entire screen
function makeArea(x, y, x2, y2)
{
x = arguments [0]
y = arguments [1]
x2 = arguments [2]
y2 = arguments [3]
var l = x2-x;
var h = y2-y;
_x = x
_y = y
_l = l
_h = h
post (_x, _y, _l, _h)
}
function showVar()
{
post (_x)
}
//
// Events
//
function mouseDownEvent(x, y)
{
startX = x;
startY = y;
if (_points.length == 0)
{
_strokes.length = 0;
// _g.clearRect(0, 0, _rc.width, _rc.height); clear named lcds
}
_points.length = 1; //clear
_points[0] = new Point(x, y);
post("Recording unistroke...", startX, startY);
_isDown = true;
}
function mouseMoveEvent(x, y)
{
if (_isDown)
{
startX = x;
startY = y;
_points[_points.length] = new Point(x, y); // append
}
}
function mouseUpEvent(x, y)
{
if (_isDown)
{
_isDown = false;
if (_points.length >= 10)
{
// var result = _r.Recognize(_points, document.getElementById('useProtractor').checked);
// outlet ("Result: " + result.Name + " (" + round(result.Score,2) + ").");
post ("enough points")
}
else // fewer than 10 points were inputted
{
post("Too few points made. Please try again.");
}
}
}