mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Web app improvements
This commit is contained in:
parent
b92746d357
commit
29d11093db
@ -778,10 +778,10 @@ final class AttachmentPanel: ASDisplayNode, UIScrollViewDelegate {
|
||||
var leftNodeOriginX = (layout.size.width - internalWidth) / 2.0
|
||||
|
||||
var buttonWidth = buttonSize.width
|
||||
if self.buttons.count > 6 {
|
||||
if self.buttons.count > 6 && layout.size.width < layout.size.height {
|
||||
buttonWidth = smallButtonWidth
|
||||
distanceBetweenNodes = buttonWidth
|
||||
leftNodeOriginX = sideInset + buttonWidth / 2.0
|
||||
leftNodeOriginX = layout.safeInsets.left + sideInset + buttonWidth / 2.0
|
||||
}
|
||||
|
||||
for i in 0 ..< self.buttons.count {
|
||||
@ -851,9 +851,9 @@ final class AttachmentPanel: ASDisplayNode, UIScrollViewDelegate {
|
||||
|
||||
var contentSize = CGSize(width: layout.size.width, height: buttonSize.height)
|
||||
var buttonWidth = buttonSize.width
|
||||
if self.buttons.count > 6 {
|
||||
if self.buttons.count > 6 && layout.size.width < layout.size.height {
|
||||
buttonWidth = smallButtonWidth
|
||||
contentSize = CGSize(width: sideInset * 2.0 + CGFloat(self.buttons.count) * buttonWidth, height: buttonSize.height)
|
||||
contentSize.width = layout.safeInsets.left + layout.safeInsets.right + sideInset * 2.0 + CGFloat(self.buttons.count) * buttonWidth
|
||||
}
|
||||
self.scrollLayout = (layout.size.width, contentSize)
|
||||
|
||||
|
@ -2293,7 +2293,7 @@ public func svgIconImageFile(account: Account, fileReference: FileMediaReference
|
||||
let context = DrawingContext(size: arguments.drawingSize, clear: true)
|
||||
|
||||
let drawingRect = arguments.drawingRect
|
||||
let fittedSize = arguments.imageSize.aspectFilled(arguments.boundingSize).fitted(arguments.imageSize)
|
||||
var fittedSize = arguments.imageSize.aspectFilled(arguments.boundingSize).fitted(arguments.imageSize)
|
||||
|
||||
var fullSizeImage: UIImage?
|
||||
let imageOrientation: UIImage.Orientation = .up
|
||||
@ -2301,12 +2301,15 @@ public func svgIconImageFile(account: Account, fileReference: FileMediaReference
|
||||
if let fullSizePath = fullSizePath {
|
||||
if fullSizeComplete, let data = try? Data(contentsOf: URL(fileURLWithPath: fullSizePath)) {
|
||||
fullSizeImage = drawSvgImage(data, CGSize.zero, .clear, .black, false)
|
||||
if let image = fullSizeImage {
|
||||
fittedSize = image.size.aspectFitted(arguments.boundingSize)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var fittedRect = CGRect(origin: CGPoint(x: drawingRect.origin.x + (drawingRect.size.width - fittedSize.width) / 2.0, y: drawingRect.origin.y + (drawingRect.size.height - fittedSize.height) / 2.0), size: fittedSize)
|
||||
if stickToTop {
|
||||
fittedRect.origin.y = 0.0
|
||||
fittedRect.origin.y = drawingRect.size.height - fittedSize.height
|
||||
}
|
||||
|
||||
context.withFlippedContext { c in
|
||||
|
@ -141,7 +141,8 @@ public final class WebAppController: ViewController, AttachmentContainable {
|
||||
if let strongSelf = self {
|
||||
let imageSize: CGSize
|
||||
if isPlaceholder, let (layout, _) = strongSelf.validLayout {
|
||||
imageSize = layout.size
|
||||
let minSize = min(layout.size.width, layout.size.height)
|
||||
imageSize = CGSize(width: minSize, height: minSize * 3.0)
|
||||
} else {
|
||||
imageSize = CGSize(width: 75.0, height: 75.0)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user