mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Revert photo dimensions thing
This commit is contained in:
parent
4c794a0a91
commit
03af42a9f1
@ -619,8 +619,16 @@ final class ChatImageGalleryItemNode: ZoomableContentGalleryItemNode {
|
|||||||
|
|
||||||
func setFile(context: AccountContext, userLocation: MediaResourceUserLocation, fileReference: FileMediaReference) {
|
func setFile(context: AccountContext, userLocation: MediaResourceUserLocation, fileReference: FileMediaReference) {
|
||||||
if self.contextAndMedia == nil || !self.contextAndMedia!.1.media.isEqual(to: fileReference.media) {
|
if self.contextAndMedia == nil || !self.contextAndMedia!.1.media.isEqual(to: fileReference.media) {
|
||||||
if let largestSize = fileReference.media.dimensions {
|
if var largestSize = fileReference.media.dimensions {
|
||||||
let displaySize = largestSize.cgSize.dividedByScreenScale()
|
var displaySize = largestSize.cgSize.dividedByScreenScale()
|
||||||
|
if let previewDimensions = largestImageRepresentation(fileReference.media.previewRepresentations)?.dimensions {
|
||||||
|
let previewAspect = CGFloat(previewDimensions.width) / CGFloat(previewDimensions.height)
|
||||||
|
let aspect = displaySize.width / displaySize.height
|
||||||
|
if abs(previewAspect - 1.0 / aspect) < 0.1 {
|
||||||
|
displaySize = CGSize(width: displaySize.height, height: displaySize.width)
|
||||||
|
largestSize = PixelDimensions(width: largestSize.height, height: largestSize.width)
|
||||||
|
}
|
||||||
|
}
|
||||||
self.imageNode.asyncLayout()(TransformImageArguments(corners: ImageCorners(), imageSize: displaySize, boundingSize: displaySize, intrinsicInsets: UIEdgeInsets()))()
|
self.imageNode.asyncLayout()(TransformImageArguments(corners: ImageCorners(), imageSize: displaySize, boundingSize: displaySize, intrinsicInsets: UIEdgeInsets()))()
|
||||||
|
|
||||||
/*if largestSize.width > 2600 || largestSize.height > 2600 {
|
/*if largestSize.width > 2600 || largestSize.height > 2600 {
|
||||||
|
@ -184,7 +184,7 @@ public final class SelectablePeerNode: ASDisplayNode {
|
|||||||
|
|
||||||
let iconContent: EmojiStatusComponent.Content?
|
let iconContent: EmojiStatusComponent.Content?
|
||||||
if let fileId = iconId {
|
if let fileId = iconId {
|
||||||
iconContent = .animation(content: .customEmoji(fileId: fileId), size: CGSize(width: 18.0, height: 18.0), placeholderColor: theme.actionSheet.disabledActionTextColor, themeColor: theme.actionSheet.primaryTextColor, loopMode: .count(2))
|
iconContent = .animation(content: .customEmoji(fileId: fileId), size: CGSize(width: 18.0, height: 18.0), placeholderColor: theme.actionSheet.disabledActionTextColor, themeColor: theme.actionSheet.primaryTextColor, loopMode: .count(0))
|
||||||
} else if let customTitle = customTitle {
|
} else if let customTitle = customTitle {
|
||||||
iconContent = .topic(title: String(customTitle.prefix(1)), color: iconColor ?? 0, size: CGSize(width: 32.0, height: 32.0))
|
iconContent = .topic(title: String(customTitle.prefix(1)), color: iconColor ?? 0, size: CGSize(width: 32.0, height: 32.0))
|
||||||
} else {
|
} else {
|
||||||
|
@ -106,7 +106,7 @@ final class ShareTopicGridItemNode: GridItemNode {
|
|||||||
|
|
||||||
let iconContent: EmojiStatusComponent.Content
|
let iconContent: EmojiStatusComponent.Content
|
||||||
if let fileId = item.threadInfo.info.icon {
|
if let fileId = item.threadInfo.info.icon {
|
||||||
iconContent = .animation(content: .customEmoji(fileId: fileId), size: CGSize(width: 96.0, height: 96.0), placeholderColor: item.theme.actionSheet.disabledActionTextColor, themeColor: item.theme.actionSheet.primaryTextColor, loopMode: .count(2))
|
iconContent = .animation(content: .customEmoji(fileId: fileId), size: CGSize(width: 96.0, height: 96.0), placeholderColor: item.theme.actionSheet.disabledActionTextColor, themeColor: item.theme.actionSheet.primaryTextColor, loopMode: .count(0))
|
||||||
} else {
|
} else {
|
||||||
iconContent = .topic(title: String(item.threadInfo.info.title.prefix(1)), color: item.threadInfo.info.iconColor, size: CGSize(width: 64.0, height: 64.0))
|
iconContent = .topic(title: String(item.threadInfo.info.title.prefix(1)), color: item.threadInfo.info.iconColor, size: CGSize(width: 64.0, height: 64.0))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user