[iOS] Global hitTest bug? Touch does not work at the edges of the iPad/iPhone screen

Hello Juce,

There is a very important thing that I have implemented in the usual Swift project. But not working in Juce.

It’s when you touch down your finger to the edge of the iPad frame, on the right side (ONLY) and slide your finger towards the screen. Then touch won’t work and I don’t see event mouseDown or mouseDrag.

I tried to debug hitTest function and figured out that it won’t work only in case if localPoint.x is same as comp.getWidth().

i.e. if it’s

  1. localPoint.x: 1366, comp x:0, comp width:1366 (NOT WORKING)

  2. localPoint.x: 1365 or lower, comp x:0, comp width:1366 (WORKING FINE)

I tried to add corrections by adding comp.parentComponent == nullptr then return true, but the hit test works, but still no mouseDown, mouseDrag event. So maybe the developers of Juce will be best who fix it or suggest ready-made solutions.

 static bool hitTest (Component& comp, Point<int> localPoint)
{
    return comp.parentComponent == nullptr || (isPositiveAndBelow (localPoint.x, comp.getWidth())
        && isPositiveAndBelow (localPoint.y, comp.getHeight())
        && comp.hitTest (localPoint.x, localPoint.y));
}

*Perhaps someone will ask why I need such accuracy that touch location 1366 == width: 1366. The problem is trite that my synthesizer keys are drawn at full width. And when I slide my finger from right to left to play all the keys, they do not work and this is annoying, I do not want to position my finger exactly at the end of the screen, but I just want to slide my finger from the frame to the other desired end. I remember this stupid issue with UIView on my swift project. And basically what I did it’s added 0.5f of width to the Main view :slight_smile: *

Thanks as always!