From 3ace052fff635febf7d6e7d5e785ca8ccb48e308 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Sun, 1 Dec 2019 18:00:03 +0400 Subject: [PATCH] Fix incoming bubbles --- .../Sources/ChatMessageBubbleImages.swift | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/submodules/TelegramPresentationData/Sources/ChatMessageBubbleImages.swift b/submodules/TelegramPresentationData/Sources/ChatMessageBubbleImages.swift index 6680a8a2f6..d2ec37fc84 100644 --- a/submodules/TelegramPresentationData/Sources/ChatMessageBubbleImages.swift +++ b/submodules/TelegramPresentationData/Sources/ChatMessageBubbleImages.swift @@ -31,7 +31,7 @@ public func messageBubbleImage(incoming: Bool, fillColor: UIColor, strokeColor: let corner: CGFloat = 7.0 let knockout = knockoutValue && !mask - let inset: CGFloat = (extendedEdges && !mask) ? 1.0 : 0.0 + let inset: CGFloat = 1.0//(extendedEdges && !mask) ? 1.0 : 0.0 return generateImage(CGSize(width: 42.0 + inset * 2.0, height: diameter + inset * 2.0), contextGenerator: { rawSize, context in var drawWithClearColor = false @@ -48,6 +48,10 @@ public func messageBubbleImage(incoming: Bool, fillColor: UIColor, strokeColor: context.clear(CGRect(origin: CGPoint(), size: rawSize)) } + /*context.setFillColor(UIColor.green.cgColor) + context.fill(CGRect(origin: CGPoint(), size: rawSize)) + return;*/ + let additionalOffset: CGFloat switch neighbors { case .none, .bottom: @@ -58,7 +62,9 @@ public func messageBubbleImage(incoming: Bool, fillColor: UIColor, strokeColor: context.translateBy(x: rawSize.width / 2.0, y: rawSize.height / 2.0) context.scaleBy(x: incoming ? 1.0 : -1.0, y: -1.0) - context.translateBy(x: -rawSize.width / 2.0 + 0.5 + additionalOffset, y: -rawSize.height / 2.0 + 0.5) + context.translateBy(x: -rawSize.width / 2.0, y: -rawSize.height / 2.0) + + context.translateBy(x: additionalOffset, y: 0.0) let size = CGSize(width: rawSize.width - inset * 2.0, height: rawSize.height - inset * 2.0) context.translateBy(x: inset, y: inset) @@ -120,7 +126,7 @@ public func messageBubbleImage(incoming: Bool, fillColor: UIColor, strokeColor: let _ = try? drawSvgPath(context, path: "M35,17.5 C35,7.83501688 27.1671082,0 17.5,0 L5.99681848,0 C2.68486709,0 0,2.6882755 0,5.99681848 L0,29.0031815 C0,32.3151329 2.6882755,35 5.99681848,35 L17.5,35 C27.1649831,35 35,27.1671082 35,17.5 L35,17.5 L35,17.5 ") context.fillPath() } - })!.stretchableImage(withLeftCapWidth: incoming ? Int(inset + corner + diameter / 2.0) : Int(inset + diameter / 2.0), topCapHeight: Int(inset + diameter / 2.0)) + })!.stretchableImage(withLeftCapWidth: incoming ? Int(inset + corner + diameter / 2.0 - 1.0) : Int(inset + diameter / 2.0), topCapHeight: Int(inset + diameter / 2.0)) } public enum MessageBubbleActionButtonPosition {