I see a similar fix being done with touch events. Tablet events have the same issue. When tablet press and tablet release events get fired, there are also mouse press and mouse release events that get fired as well.
The issue I came across was that while holding Spacebar, you could only pan one time. After that, the cursor turned back into a brush - even though the Spacebar is still held down.
I am setting the tabletevent flag to false on the mouse release event. Why?
Because the mouse release event gets called after the tablet release. If you set the value to false in the tablet release event, the mouse release event will get called as it thinks there is no tablet event. The problem will show itself then.
I am not sure if this is the best coding solution, but it fixes the issue and you should get the idea.