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?
- Hubert Weid asked 5 years ago
- You must login to post comments
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:
yourChartSurface.gestureController.disablePanGesture()
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).
- Andriy Shkinder answered 5 years ago
- You must login to post comments
I built a small sample project to demonstrate this behaviour
https://uploads.mobivention.eu/7c4b5d895940
As you can see from the console output, onTouchesCancelled is always called prematurely and onTouchesEnded will never get called
- Hubert Weid answered 5 years ago
- You must login to post comments
Please login first to submit.