PointerPressed issues in Android and iOS

Hey,

<Panel Pointer.Pressed="MyCustomComponent.PointerPressed" />

Has some issues in Android and iOS.

Android preview: I get the error (I used to get on iOS) : Member not found: CustomComponent.PointerPressed .

iOS: Seems to work ok, but I only get one args.PointIndex . It doesn’t give anything from second touch.

Here’s an example project: http://www.simppa.fi/fuse/TestPointer020.zip

Fuse version 0.20.2 (6524) OSX

Hey,

This is weird. Is the “member not found”-error a runtime or compile time error?

Runtime error

Ah, you are using Uno code behinds in preview? Whenever you change Uno code or an UX file with a code behind you have to recompile the preview app for the changes to be reflected correctly.

Yes, I know that. The android error comes when building a preview to Android. It happens when the app start.

The iOS bug that doesn’t give PointIndex for second touch is more critical. I need that to zoom in/out my custom component.

This use of a non-static handler in another object is not supported. I’m not actually certain why it works on some of the platforms. The handlers, like Pointer.Pressed can only take a function reference within the current class.

You’re getting an error in the preview because it’s look for the full name MyCustomComponent.PointerPressed in the current class. It of coure doesn’t find it.

I keep on coming to this issue with every new release. It gets broken each time. You always fix it after some forum spamming.

If the Pointer.Pressed is not the way to do this, then what is?

I need to get touch events to my custom component which is a RenderNode. I need args.PointIndex and args.WindowPoint

I tried to add those PointerPressed methods to MainView.ux.uno and then call the MyCustomComponent’s methods but I get :

    MainView.ux.uno(22.3): E3104: 'CustomComponent' does not contain a member called 'PointPressed'. Could you be missing a package reference?

I would like to find a way to do this in a way that would work in the future as well.

Using Pointer.Pressed is fine, it just needs to be a handler on the same class. The UX must look like Pointer.Pressed="PointerPressed" without any mention of an object instance (it’s implicitly on the current class). The fact that it works sometimes with a secondary object is odd, as we haven’t intended on that working. There is a long-term feature that would allow for arbitrary instance paths.

If you need this separated into a behaviour then you can also add the handler during rooting of that behaviour. This would be done in the Uno code during OnRooted something like Pointer.Pressed.AddHandler(Parent, OnPointerPressed)

Thanks, I got it working now, but iOS PointIndex bug remains. It only give pointIndex for first touch. Works on Android.

Current setup is:

<App>

    <Panel>

        <CustomComponent ux:Name="MyCustomComponent" />

        <!-- This Panel needs to be here in order to get touch events to MyCustomComponent -->
        <Panel HitTestMode="LocalBounds" />

    </Panel>

</App>

<RenderNode ux:Class="CustomComponent" ux:AutoCtor="false" > 

</RenderNode>

using Uno;
using Fuse;

public partial class CustomComponent
{
    public CustomComponent()
    {
        InitializeUX();
    }


    override protected void OnRooted()
    {
        Fuse.Input.Pointer.Pressed.AddHandler(Parent, OnPointerPressed);
    }

    public void OnPointerPressed(object sender, Fuse.Input.PointerPressedArgs args)
    {
        debug_log "OnPointerPressed pointIndex: " + args.PointIndex+" windowPoint: "+args.WindowPoint;
    }


}

Here’s the test project:

http://www.simppa.fi/fuse/TestPointer020_b.zip

See https://www.fusetools.com/community/forums/bug_reports/no_second_touch_pointindex_on_ios