@@ -343,30 +343,16 @@ - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
343343
344344 // Check other views of other plugins before this plugin
345345 // e.g. PhoneGap-Plugin-ListPicker, etc
346- UIView *subview;
347- NSArray *subviews = [self .webView.superview subviews ];
348- // CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
349- // CGPoint subviewPoint = CGPointMake(browserClickPoint.x, browserClickPoint.y - statusBarFrame.size.height);
350-
351- for (int i = ((int )[subviews count ] - 1 ); i >= 0 ; i--) {
352- subview = [subviews objectAtIndex: i];
353- // NSLog(@"--->subview[%d] = %@", i, subview);
346+ for (UIView *subview in [self .webView.superview.subviews reverseObjectEnumerator ]) {
354347 // we only want to check against other views
355- if (subview == self.pluginScrollView ) {
356- continue ;
357- }
358-
359- if (subview.isHidden || !subview.isUserInteractionEnabled ) {
360- continue ;
361- }
348+ if (subview == self.pluginScrollView ) continue ;
349+ if (subview.isHidden || !subview.isUserInteractionEnabled ) continue ;
362350
363351 CGPoint subviewPoint = CGPointMake (point.x , point.y - subview.frame .origin .y );
364352 UIView *hit = [subview hitTest: subviewPoint withEvent: event];
365353
366354 if (hit) {
367- if (subview == self.webView ) {
368- break ;
369- }
355+ if (subview == self.webView ) break ;
370356 return hit;
371357 }
372358 }
@@ -390,34 +376,23 @@ - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
390376 float webviewWidth = self.webView .frame .size .width ;
391377 float webviewHeight = self.webView .frame .size .height ;
392378
393-
394- CGRect rect;
395- NSEnumerator *mapIDs = [self .pluginScrollView.mapCtrls keyEnumerator ];
396- PluginMapViewController *mapCtrl;
397- id mapId;
398- NSString *clickedDomId;
399-
400379 CGFloat zoomScale = [[UIScreen mainScreen ] scale ];
401380 offsetY *= zoomScale;
402381 offsetX *= zoomScale;
403382 webviewWidth *= zoomScale;
404383 webviewHeight *= zoomScale;
405384
406- NSDictionary *domInfo;
407-
408385 @synchronized (self.pluginScrollView .HTMLNodes ) {
409386 // NSLog(@"--->browserClickPoint = %f, %f", browserClickPoint.x, browserClickPoint.y);
410- clickedDomId = [self findClickedDom: @" root" withPoint: browserClickPoint isMapChild: NO overflow: nil ];
387+ NSString * clickedDomId = [self findClickedDom: @" root" withPoint: browserClickPoint isMapChild: NO overflow: nil ];
411388 // NSLog(@"--->clickedDomId = %@", clickedDomId);
412389
413- while (mapId = [mapIDs nextObject ]) {
414- mapCtrl = [self .pluginScrollView.mapCtrls objectForKey: mapId];
415- if (!mapCtrl.divId ) {
416- continue ;
417- }
418- domInfo =[self .pluginScrollView.HTMLNodes objectForKey: mapCtrl.divId];
419-
420- rect = CGRectFromString ([domInfo objectForKey: @" size" ]);
390+ for (id mapId in [[self .pluginScrollView.mapCtrls keyEnumerator ] allObjects ]) {
391+ PluginMapViewController *mapCtrl = [self .pluginScrollView.mapCtrls objectForKey: mapId];
392+ if (!mapCtrl.divId ) continue ;
393+
394+ NSDictionary *domInfo = [self .pluginScrollView.HTMLNodes objectForKey: mapCtrl.divId];
395+ CGRect rect = CGRectFromString ([domInfo objectForKey: @" size" ]);
421396
422397 // Is the map clickable?
423398 if (mapCtrl.clickable == NO ) {
0 commit comments