committed by
Minh Nguyễn
parent
c4b3c0142c
commit
df1cae8d3a
@@ -405,7 +405,11 @@ static const CLLocationCoordinate2D WorldTourDestinations[] = {
|
||||
- (void)handlePressGesture:(NSPressGestureRecognizer *)gestureRecognizer {
|
||||
if (gestureRecognizer.state == NSGestureRecognizerStateBegan) {
|
||||
NSPoint location = [gestureRecognizer locationInView:self.mapView];
|
||||
[self dropPinAtPoint:location];
|
||||
if (!NSPointInRect([gestureRecognizer locationInView:self.mapView.compass], self.mapView.compass.bounds)
|
||||
&& !NSPointInRect([gestureRecognizer locationInView:self.mapView.zoomControls], self.mapView.zoomControls.bounds)
|
||||
&& !NSPointInRect([gestureRecognizer locationInView:self.mapView.attributionView], self.mapView.attributionView.bounds)) {
|
||||
[self dropPinAtPoint:location];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1344,7 +1344,8 @@ public:
|
||||
|
||||
/// Click or tap to select an annotation.
|
||||
- (void)handleClickGesture:(NSClickGestureRecognizer *)gestureRecognizer {
|
||||
if (gestureRecognizer.state != NSGestureRecognizerStateEnded) {
|
||||
if (gestureRecognizer.state != NSGestureRecognizerStateEnded
|
||||
|| [self subviewContainingGesture:gestureRecognizer]) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1375,7 +1376,8 @@ public:
|
||||
|
||||
/// Double-click or double-tap to zoom in.
|
||||
- (void)handleDoubleClickGesture:(NSClickGestureRecognizer *)gestureRecognizer {
|
||||
if (!self.zoomEnabled || gestureRecognizer.state != NSGestureRecognizerStateEnded) {
|
||||
if (!self.zoomEnabled || gestureRecognizer.state != NSGestureRecognizerStateEnded
|
||||
|| [self subviewContainingGesture:gestureRecognizer]) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1461,6 +1463,20 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the subview that the gesture is located in.
|
||||
- (NSView *)subviewContainingGesture:(NSGestureRecognizer *)gestureRecognizer {
|
||||
if (NSPointInRect([gestureRecognizer locationInView:self.compass], self.compass.bounds)) {
|
||||
return self.compass;
|
||||
}
|
||||
if (NSPointInRect([gestureRecognizer locationInView:self.zoomControls], self.zoomControls.bounds)) {
|
||||
return self.zoomControls;
|
||||
}
|
||||
if (NSPointInRect([gestureRecognizer locationInView:self.attributionView], self.attributionView.bounds)) {
|
||||
return self.attributionView;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark Keyboard events
|
||||
|
||||
- (void)keyDown:(NSEvent *)event {
|
||||
|
||||
Reference in New Issue
Block a user