SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components
i want to implement a custom modifier to track the users touch, similar to rollover but without displaying a view
I tried to do this by implementing SCIGestureModifier and overriding all the onTouches methods, but – no matter the user behaviour – the modifier will always receive an onTouchesCancelled event after about a second and receive no more of these events after that.
What does work is implement onPanGesture to actually track all the user’s movement but i don’t see any way of how you would receive a touch up event this way (which i do need)
Is there any fundamental misunderstanding on how this should work on my side?
Internally SCIChart surface uses a UIPanGestureRecognizer to track panning, which has default value YES for cancelsTouchesInView property, thats why you receive touchesCancelled callback as soon as pan was recognised.
So I can suggest you several workarounds for you, please chose the one which covers your needs the best:
1) Disable handling pan on your surface (only in case if you don’t need to use SCICursorModifier, SCITooltipModifier or SCIRolloverModifier).
This can be done using following code:
2) Or, use callback from GestureRecognizer to track finger movement instead of overriding onTouchesMoved – override
-(BOOL) onPanGesture:(UIPanGestureRecognizer*)gesture At:(UIView*)view;
and place your finger movement handling logic there. Thats how you can start handling finger position when touch occurs (before even gesture was recognised) and continue after recognising a movement, until the gesture is finished (check on gestureRecognizer.state to know when the finger released).
I built a small sample project to demonstrate this behaviour
As you can see from the console output, onTouchesCancelled is always called prematurely and onTouchesEnded will never get called
Please login first to submit.