Hand-writing recognition directive for canvas elements