mapbox/mapbox-gl-native

Can't get MGLFeature from "visibleFeaturesInRect: inStyleLayersWithIdentifiers:"

codevond opened this issue · 0 comments

This is my code

` if (tap.state == UIGestureRecognizerStateEnded) {

    CGPoint touchpoint = [tap locationInView:self];
    
    CGRect fishRect = CGRectMake(Tp.x-1, Tp.y-1, 2, 2);
    NSSet *fishSet = [NSSet setWithObject:self.fishLay.identifier];
    NSArray<id<MGLFeature>> * fishFeatures = [self visibleFeaturesInRect:fishRect inStyleLayersWithIdentifiers:fishSet];
    if (fishFeatures.count > 0) {
       /// do something
        }
    }`

But the MGLFeature alway is empty, even if I click exactly.
And there is also a issue of offset, the direction is random.