Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Implementing support for changing scale factor.

  • Loading branch information...
commit 4f7890b75684fd3405cd32b7ddc337392473187c 1 parent a88ef43
Jan Weiß authored
Showing with 13 additions and 0 deletions.
  1. +13 −0 ScrollingAboutWindow/AboutWindowController.m
View
13 ScrollingAboutWindow/AboutWindowController.m
@@ -180,6 +180,7 @@ - (CATextLayer *)creditsTextLayer {
_creditsTextLayer.frame = CGRectMake(0.0, 0.0, size.width, size.height);
_creditsTextLayer.contentsScale = self.scaleFactor;
+ _creditsTextLayer.delegate = self;
return _creditsTextLayer;
}
@@ -194,6 +195,7 @@ - (CAGradientLayer *)creditsTopFadeLayer {
_creditsTopFadeLayer.frame = CGRectMake(0.0, 0.0, self.creditsView.bounds.size.width, height);
_creditsTopFadeLayer.contentsScale = self.scaleFactor;
+ _creditsTopFadeLayer.delegate = self;
return _creditsTopFadeLayer;
}
@@ -208,6 +210,7 @@ - (CAGradientLayer *)creditsBottomFadeLayer {
_creditsBottomFadeLayer.frame = CGRectMake(0.0, self.creditsView.bounds.size.height - height, self.creditsView.bounds.size.width, height);
_creditsBottomFadeLayer.contentsScale = self.scaleFactor;
+ _creditsBottomFadeLayer.delegate = self;
return _creditsBottomFadeLayer;
}
@@ -220,6 +223,7 @@ - (CALayer *)creditsRootLayer {
[_creditsRootLayer addSublayer:self.creditsBottomFadeLayer];
_creditsRootLayer.contentsScale = self.scaleFactor;
+ _creditsRootLayer.delegate = self;
return _creditsRootLayer;
}
@@ -241,6 +245,15 @@ - (CGSize)sizeForAttributedString:(NSAttributedString *)string inWidth:(CGFloat)
return CGSizeMake(width, ceil(height));
}
+- (BOOL)layer:(CALayer *)layer shouldInheritContentsScale:(CGFloat)newScale fromWindow:(NSWindow *)window
+{
+ if (layer == _creditsRootLayer) {
+ _scaleFactor = newScale; // Just to keep the value consistent
+ }
+
+ return YES;
+}
+
@end
#pragma mark -
Please sign in to comment.
Something went wrong with that request. Please try again.