add function stroke detect