CPSplitView: do not track events outside of a divider.

Added private method -_dividerAtIndex:
This commit is contained in:
cacaodev committed 2017-05-13 19:46:39 +02:00
1 parent 7a02cd794b
commit d1addcab91
1 file changed
+19 -6
+19 -6
View File
@@ -454,15 +454,25 @@ var ShouldSuppressResizeNotifications = 1,
return nil;
var point = [self convertPoint:aPoint fromView:[self superview]],
count = [_subviews count] - 1;
dividerIndex = [self _dividerAtPoint:point];
if (dividerIndex !== CPNotFound)
return self;
return [super hitTest:aPoint];
}
- (CPInteger)_dividerAtPoint:(CGPoint)aPoint
{
var count = [_subviews count] - 1;
for (var i = 0; i < count; i++)
{
if ([self cursorAtPoint:point hitDividerAtIndex:i])
return self;
if ([self cursorAtPoint:aPoint hitDividerAtIndex:i])
return i;
}
return [super hitTest:aPoint];
return CPNotFound;
}
/*
@@ -568,8 +578,11 @@ var ShouldSuppressResizeNotifications = 1,
- (void)mouseDown:(CPEvent)anEvent
{
// FIXME: This should not trap events if not on a divider!
[self trackDivider:anEvent];
var point = [self convertPoint:[anEvent locationInWindow] fromView:nil],
dividerIndex = [self _dividerAtPoint:point];
if (dividerIndex !== CPNotFound)
[self trackDivider:anEvent];
}
- (void)viewDidMoveToWindow