diff --git a/CHANGELOG.md b/CHANGELOG.md index eca7f1d..addcd18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## 3.1.2 + +Released on 16-9-2016 + +#### Fixed +- Scrolling performance slowed #145 + ## 3.1.1 Released on 15-9-2016 diff --git a/SKPhotoBrowser.podspec b/SKPhotoBrowser.podspec index 023cbf3..daef9dd 100644 --- a/SKPhotoBrowser.podspec +++ b/SKPhotoBrowser.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "SKPhotoBrowser" - s.version = "3.1.1" + s.version = "3.1.2" s.summary = "Simple PhotoBrowser/Viewer inspired by facebook, twitter photo browsers written by swift2.0." s.homepage = "https://github.com/suzuki-0000/SKPhotoBrowser" s.license = { :type => "MIT", :file => "LICENSE" } diff --git a/SKPhotoBrowser/SKPhotoBrowserOptions.swift b/SKPhotoBrowser/SKPhotoBrowserOptions.swift index b6d7901..7d18df3 100644 --- a/SKPhotoBrowser/SKPhotoBrowserOptions.swift +++ b/SKPhotoBrowser/SKPhotoBrowserOptions.swift @@ -30,13 +30,14 @@ public struct SKPhotoBrowserOptions { public static var enableZoomBlackArea: Bool = true public static var enableSingleTapDismiss: Bool = false - public static var imagePaddingX: CGFloat = 0 - public static var imagePaddingY: CGFloat = 0 - public static var backgroundColor = UIColor.blackColor() public static var textAndIconColor = UIColor.whiteColor() public static var toolbarTextShadowColor = UIColor.darkTextColor() public static var toolbarFont = UIFont(name: "Helvetica", size: 16.0) public static var captionFont = UIFont.systemFontOfSize(17.0) -} \ No newline at end of file + + // FIXED: Scrolling performance slowed #145 + // public static var imagePaddingX: CGFloat = 0 + // public static var imagePaddingY: CGFloat = 0 +} diff --git a/SKPhotoBrowser/SKZoomingScrollView.swift b/SKPhotoBrowser/SKZoomingScrollView.swift index 4977349..53284f3 100644 --- a/SKPhotoBrowser/SKZoomingScrollView.swift +++ b/SKPhotoBrowser/SKZoomingScrollView.swift @@ -183,20 +183,22 @@ public class SKZoomingScrollView: UIScrollView { if let image = photo.underlyingImage { + // FIXED: Scrolling performance slowed #145 + // create padding - let width: CGFloat = image.size.width + SKPhotoBrowserOptions.imagePaddingX - let height: CGFloat = image.size.height + SKPhotoBrowserOptions.imagePaddingY; - UIGraphicsBeginImageContextWithOptions(CGSizeMake(width, height), false, 0.0); - let context: CGContextRef = UIGraphicsGetCurrentContext()!; - UIGraphicsPushContext(context); - let origin: CGPoint = CGPointMake((width - image.size.width) / 2, (height - image.size.height) / 2); - image.drawAtPoint(origin) - UIGraphicsPopContext(); - let imageWithPadding = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); + // let width: CGFloat = image.size.width + SKPhotoBrowserOptions.imagePaddingX + // let height: CGFloat = image.size.height + SKPhotoBrowserOptions.imagePaddingY; + // UIGraphicsBeginImageContextWithOptions(CGSizeMake(width, height), false, 0.0); + // let context: CGContextRef = UIGraphicsGetCurrentContext()!; + // UIGraphicsPushContext(context); + // let origin: CGPoint = CGPointMake((width - image.size.width) / 2, (height - image.size.height) / 2); + // image.drawAtPoint(origin) + // UIGraphicsPopContext(); + // let imageWithPadding = UIGraphicsGetImageFromCurrentImageContext(); + // UIGraphicsEndImageContext(); // image - photoImageView.image = imageWithPadding + photoImageView.image = image photoImageView.contentMode = photo.contentMode photoImageView.backgroundColor = SKPhotoBrowserOptions.backgroundColor @@ -336,4 +338,4 @@ private extension SKZoomingScrollView { return CGRect(x: x, y: y, width: w, height: h) } -} \ No newline at end of file +}