Hello,
I am having trouble determining the parameters to pass to ModifierTouchEventArgs when overriding GestureModifierBase in the latest SciChart versions. I can’t figure out where to get the now required source and target values – the super class returns null when asked.. Code snippet below…
class MyCustomGestureModifier() : GestureModifierBase() {
override fun onLongPress(e: MotionEvent?) {
super.onLongPress(e)
/* This worked in SciChart v4.2.0.4557, but no longer does due to ModifierTouchEvents now requiring source and target
val args = ModifierTouchEventArgs()
args.e = e
args.isHandled = false
args.isMaster = true
args.isInSourceBounds = true
*/
// create touch event args for rollover modifier
// 4.3.0.4646 wants additional parameters for source and target
val orgEvent = originalTouchEvent // this is null, so where should we get source and target?
val args = ModifierTouchEventArgs(orgEvent.source, orgEvent.target)
args.e = e
args.isHandled = false
rolloverModifier.onTouch(args)
args.clear()
}
In case it helps, the above snippet is based on a previous discussion at https://www.scichart.com/questions/android/separating-rollover-tootips-and-pan-drag
Thank you.
- C Bolton asked 2 years ago
- last edited 2 years ago
- You must login to post comments
Hi there,
We’ve added these parameters because we had a bug with handling touch events when touch events are shared between several charts ( to correctly handle and transform touch coordinates we need to know source of touch event and target which should handle this event ). By default ModifierTouchEventArgs is created internally by our MotionEventManager implementation which manages Android touch event subscriptions.
If you need to create ModifierTouchEventArgs instance you can override onTouch() method in your modifier and store source and target into private fields before calling super.onTouch(). Then you can read these values when long press is detected.
The other way is you use single chart and don’t share touch events between many charts is to specify parent SciChartSurface of modifier as source and rollover modiier as target.
Is this suitable for your needs?
Best regards,
Yura
- Yura Khariton answered 2 years ago
-
Thank you. That got it working again.
- You must login to post comments
Please login first to submit.