Debounces the draw function.