mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Fix gallery
This commit is contained in:
parent
a5899ef4e7
commit
e8610d068a
@ -5,6 +5,8 @@ import Display
|
|||||||
import SwiftSignalKit
|
import SwiftSignalKit
|
||||||
import Postbox
|
import Postbox
|
||||||
|
|
||||||
|
private let edgeWidth: CGFloat = 44.0
|
||||||
|
|
||||||
private let leftFadeImage = generateImage(CGSize(width: 64.0, height: 1.0), opaque: false, rotatedContext: { size, context in
|
private let leftFadeImage = generateImage(CGSize(width: 64.0, height: 1.0), opaque: false, rotatedContext: { size, context in
|
||||||
let bounds = CGRect(origin: CGPoint(), size: size)
|
let bounds = CGRect(origin: CGPoint(), size: size)
|
||||||
context.clear(bounds)
|
context.clear(bounds)
|
||||||
@ -154,11 +156,11 @@ public final class GalleryPagerNode: ASDisplayNode, UIScrollViewDelegate, UIGest
|
|||||||
|
|
||||||
var highlightedSide: Bool?
|
var highlightedSide: Bool?
|
||||||
if let point = point {
|
if let point = point {
|
||||||
if point.x < size.width * 1.0 / 5.0 {
|
if point.x < edgeWidth && strongSelf.canGoToPreviousItem() {
|
||||||
if strongSelf.items.count > 1 {
|
if strongSelf.items.count > 1 {
|
||||||
highlightedSide = false
|
highlightedSide = false
|
||||||
}
|
}
|
||||||
} else {
|
} else if point.x > size.width - edgeWidth && strongSelf.canGoToNextItem() {
|
||||||
if strongSelf.items.count > 1 {
|
if strongSelf.items.count > 1 {
|
||||||
highlightedSide = true
|
highlightedSide = true
|
||||||
}
|
}
|
||||||
@ -207,9 +209,9 @@ public final class GalleryPagerNode: ASDisplayNode, UIScrollViewDelegate, UIGest
|
|||||||
if let (gesture, location) = recognizer.lastRecognizedGestureAndLocation {
|
if let (gesture, location) = recognizer.lastRecognizedGestureAndLocation {
|
||||||
if case .tap = gesture {
|
if case .tap = gesture {
|
||||||
let size = self.bounds.size
|
let size = self.bounds.size
|
||||||
if location.x < size.width * 1.0 / 5.0 && self.canGoToPreviousItem() {
|
if location.x < edgeWidth && self.canGoToPreviousItem() {
|
||||||
self.goToPreviousItem()
|
self.goToPreviousItem()
|
||||||
} else if self.canGoToNextItem() {
|
} else if location.x > size.width - edgeWidth && self.canGoToNextItem() {
|
||||||
self.goToNextItem()
|
self.goToNextItem()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user