Skip to content

Commit

Permalink
[NEW] Only 60% top-bias badge for flickr.com.
Browse files Browse the repository at this point in the history
  • Loading branch information
rentzsch committed Aug 25, 2009
1 parent 00a3911 commit 65e0762
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions Plugin/Plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ THE SOFTWARE.
BOOL mouseInside;
BOOL _isLoadingFromWhitelist;
BOOL _fromYouTube;
BOOL _fromFlickr;
BOOL _embeddedYouTubeView;
BOOL _hasH264Version;
BOOL _hasHDH264Version;
Expand Down
11 changes: 8 additions & 3 deletions Plugin/Plugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ - (id) initWithArguments:(NSDictionary *)arguments
}
}
}


_fromFlickr = [[self host] rangeOfString:@"flickr.com"].location != NSNotFound;

#if LOGGING_ENABLED
NSLog( @"arguments = %@", arguments );
Expand Down Expand Up @@ -844,7 +845,7 @@ - (void) _drawBadgeWithPressed: (BOOL) pressed

float maxW = NSWidth( bounds ) - kMinMargin;
// the 9/10 factor here is to account for the 60% vertical top-biasing
float maxH = NSHeight( bounds )*9/10 - kMinMargin;
float maxH = _fromFlickr ? NSHeight( bounds )*9/10 - kMinMargin : NSHeight( bounds ) - kMinMargin;
float minW = kMinHeight * w / h;

BOOL rotate = NO;
Expand Down Expand Up @@ -883,7 +884,11 @@ - (void) _drawBadgeWithPressed: (BOOL) pressed

NSAffineTransform* xform = [ NSAffineTransform transform ];
// vertical top-bias by 60% here
[ xform translateXBy: NSWidth( bounds ) / 2 yBy: NSHeight( bounds ) / 10 * 6 ];
if (_fromFlickr) {
[ xform translateXBy: NSWidth( bounds ) / 2 yBy: NSHeight( bounds ) / 10 * 6 ];
} else {
[ xform translateXBy: NSWidth( bounds ) / 2 yBy: NSHeight( bounds ) / 2 ];
}
[ xform scaleBy: scaleFactor ];
if( rotate )
[ xform rotateByDegrees: 90 ];
Expand Down

0 comments on commit 65e0762

Please sign in to comment.