+- (void)mouseUp:(NSEvent *)event {
+ if (_draggedTab && [self allowsDragging]) {
+ NSPoint releasedPoint = [self convertPoint:[event locationInWindow] fromView:[[self window] contentView]];
+ NSTabViewItem *releasedTab = [self tabViewItemAtPoint:releasedPoint];
+ if (releasedTab && ![releasedTab isEqualTo:_draggedTab]) {
+ [self moveTab:_draggedTab toIndex:[self indexOfTabViewItem:releasedTab]];
+ }
+ _draggedTab = nil;
+ }
+ [super mouseUp:event];
+}
+
+- (void)mouseDragged:(NSEvent *)event {
+ if (_draggedTab && [self allowsDragging]) {
+ NSPoint currentPoint = [self convertPoint:[event locationInWindow] fromView:[[self window] contentView]];
+ NSTabViewItem *curTab = [self tabViewItemAtPoint:currentPoint];
+ if (curTab && ![curTab isEqualTo:_draggedTab]) {
+ [self moveTab:_draggedTab toIndex:[self indexOfTabViewItem:curTab]];
+ [self selectTabViewItem:_draggedTab];
+ }
+ }
+ [super mouseDragged:event];
+}
+
+@end
\ No newline at end of file