The solution to this problem is to detach the mouse cursor from the mouse hardware (typically called capturing the mouse) whenever a touch event is active so that the cursor is not moved by touch events. In addition, since a "stuck" mouse cursor may be cause for concern to our App user, we can hide the mouse cursor when touches are active.
In Xcode, click on the file named
BTSFingerView.h
in the project navigator and add the following flag to the interface:@interface BTSFingerView : NSView { // Define a flag so that touch methods can behave // differently depending on the visibility of // the mouse cursor BOOL m_cursorIsHidden; }
In Xcode, click on the file named
BTSFingerView.m
in the project navigator.Add the following code to the beginning of the
touchesBeganWithEvent:
method to detach and hide the mouse cursor when a touch begins. We only want to do this one time so it is guarded by aBOOL
flag and an...