Changeset 14706


Ignore:
Timestamp:
Mar 3, 2016, 10:27:45 PM (2 years ago)
Author:
mikedld
Message:

Fix constraints issues on Yosemite when hiding web seed view (OS X)

Location:
trunk/macosx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/InfoPeersView.xib

    r14685 r14706  
    1010                <outlet property="fConnectedPeersField" destination="3" id="31"/>
    1111                <outlet property="fPeerTable" destination="9" id="37"/>
    12                 <outlet property="fPeerTableTopConstraint" destination="1HX-la-u47" id="zd4-80-4DZ"/>
    1312                <outlet property="fWebSeedTable" destination="22" id="38"/>
    14                 <outlet property="fWebSeedTableHeightConstraint" destination="4th-jd-ByN" id="hUk-mR-d0k"/>
     13                <outlet property="fWebSeedTableTopConstraint" destination="IMm-aI-A03" id="3qg-eC-YGm"/>
    1514                <outlet property="view" destination="2" id="32"/>
    1615            </connections>
     
    213212            </subviews>
    214213            <constraints>
    215                 <constraint firstItem="5" firstAttribute="top" secondItem="4" secondAttribute="bottom" constant="4" id="1HX-la-u47"/>
     214                <constraint firstItem="5" firstAttribute="top" secondItem="4" secondAttribute="bottom" priority="998" constant="4" id="1HX-la-u47"/>
    216215                <constraint firstItem="4" firstAttribute="leading" secondItem="2" secondAttribute="leading" constant="12" id="5f9-U1-5ZR"/>
    217216                <constraint firstItem="3" firstAttribute="leading" secondItem="2" secondAttribute="leading" constant="12" id="7lL-BM-0yj"/>
     
    219218                <constraint firstAttribute="trailing" secondItem="3" secondAttribute="trailing" constant="12" id="PfO-Qp-6s2"/>
    220219                <constraint firstAttribute="bottom" secondItem="3" secondAttribute="bottom" constant="12" id="R8j-Z7-6VA"/>
    221                 <constraint firstItem="3" firstAttribute="top" secondItem="5" secondAttribute="bottom" constant="4" id="ksH-yX-eMF"/>
     220                <constraint firstItem="3" firstAttribute="top" secondItem="5" secondAttribute="bottom" priority="998" constant="4" id="ksH-yX-eMF"/>
    222221                <constraint firstItem="5" firstAttribute="leading" secondItem="2" secondAttribute="leading" constant="12" id="lcP-Pq-CY0"/>
     222                <constraint firstItem="5" firstAttribute="top" relation="greaterThanOrEqual" secondItem="4" secondAttribute="bottom" constant="4" id="pIJ-b4-EP1"/>
     223                <constraint firstItem="5" firstAttribute="top" secondItem="2" secondAttribute="top" priority="999" constant="12" id="t9u-iC-TTZ"/>
    223224                <constraint firstAttribute="trailing" secondItem="5" secondAttribute="trailing" constant="12" id="tCQ-be-4sj"/>
    224225                <constraint firstAttribute="trailing" secondItem="4" secondAttribute="trailing" constant="12" id="zRK-YF-yfr"/>
  • trunk/macosx/InfoPeersViewController.h

    r14685 r14706  
    3838    IBOutlet NSTableView * fPeerTable;
    3939    IBOutlet WebSeedTableView * fWebSeedTable;
    40     CGFloat fWebSeedTableHeight, fSpaceBetweenWebSeedAndPeer;
    4140   
    4241    IBOutlet NSTextField * fConnectedPeersField;
    4342
    44     IBOutlet NSLayoutConstraint * fWebSeedTableHeightConstraint;
    45     IBOutlet NSLayoutConstraint * fPeerTableTopConstraint;
     43    CGFloat fViewTopMargin;
     44    IBOutlet NSLayoutConstraint * fWebSeedTableTopConstraint;
    4645}
    4746
  • trunk/macosx/InfoPeersViewController.m

    r14685 r14706  
    3333#import "utils.h"
    3434
     35#define ANIMATION_ID_KEY @"animationId"
     36#define WEB_SEED_ANIMATION_ID @"webSeed"
     37
    3538@interface InfoPeersViewController (Private)
    3639
     
    9396   
    9497    //prepare for animating peer table and web seed table
    95     NSRect webSeedTableFrame = [[fWebSeedTable enclosingScrollView] frame];
    96     fWebSeedTableHeight = webSeedTableFrame.size.height;
    97     fSpaceBetweenWebSeedAndPeer = webSeedTableFrame.origin.y - NSMaxY([[fPeerTable enclosingScrollView] frame]);
     98    fViewTopMargin = fWebSeedTableTopConstraint.constant;
    9899   
    99100    CABasicAnimation * webSeedTableAnimation = [CABasicAnimation animation];
    100     webSeedTableAnimation.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionLinear];
    101     webSeedTableAnimation.duration = 0.125;
    102     [fWebSeedTableHeightConstraint setAnimations: [NSDictionary dictionaryWithObject: webSeedTableAnimation
    103                                                                               forKey: @"constant"]];
    104     [fPeerTableTopConstraint setAnimations: [NSDictionary dictionaryWithObject: webSeedTableAnimation
    105                                                                         forKey: @"constant"]];
    106 
     101    [webSeedTableAnimation setTimingFunction: [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionLinear]];
     102    [webSeedTableAnimation setDuration: 0.125];
     103    [webSeedTableAnimation setDelegate: self];
     104    [webSeedTableAnimation setValue: WEB_SEED_ANIMATION_ID forKey: ANIMATION_ID_KEY];
     105    [fWebSeedTableTopConstraint setAnimations: @{ @"constant": webSeedTableAnimation }];
     106   
    107107    [self setWebSeedTableHidden: YES animate: NO];
    108108}
     
    451451}
    452452
     453- (void) animationDidStart: (CAAnimation *) animation
     454{
     455    if (![[animation valueForKey: ANIMATION_ID_KEY] isEqualToString: WEB_SEED_ANIMATION_ID])
     456        return;
     457
     458    [[fWebSeedTable enclosingScrollView] setHidden: NO];
     459}
     460
     461- (void) animationDidStop: (CAAnimation *) animation finished: (BOOL) finished
     462{
     463    if (![[animation valueForKey: ANIMATION_ID_KEY] isEqualToString: WEB_SEED_ANIMATION_ID])
     464        return;
     465
     466    [[fWebSeedTable enclosingScrollView] setHidden: finished && fWebSeedTableTopConstraint.constant < 0];
     467}
     468
    453469@end
    454470
     
    496512        animate = NO;
    497513
    498     const CGFloat webSeedTableHeight = hide ? 1 : fWebSeedTableHeight;
    499     const CGFloat spaceBetweenWebSeedAndPeer = hide ? -2 : fSpaceBetweenWebSeedAndPeer;
    500    
    501     [(animate ? [fWebSeedTableHeightConstraint animator] : fWebSeedTableHeightConstraint) setConstant: webSeedTableHeight];
    502     [(animate ? [fPeerTableTopConstraint animator] : fPeerTableTopConstraint) setConstant: spaceBetweenWebSeedAndPeer];
    503 
    504     [[fWebSeedTable enclosingScrollView] setHidden: hide];
     514    const CGFloat webSeedTableTopMargin = hide ? -NSHeight([[fWebSeedTable enclosingScrollView] frame]) : fViewTopMargin;
     515   
     516    [(animate ? [fWebSeedTableTopConstraint animator] : fWebSeedTableTopConstraint) setConstant: webSeedTableTopMargin];
    505517}
    506518
Note: See TracChangeset for help on using the changeset viewer.