Pre loader

Parameters for ModifierTouchEventArgs

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

Answered
0
0

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.

Version
4.3.0.4646
  • You must to post comments
Best Answer
0
0

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

  • C Bolton
    Thank you. That got it working again.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies