Git Product home page Git Product logo

Comments (12)

mflint avatar mflint commented on June 3, 2024 6

This is a change of behaviour between iOS 14 and iOS 15 - the imageBounds parameter to AnimatedTextAttachment.image(forBounds:textContainer:characterIndex) is different for the two versions of iOS.

For iOS 14, imageBounds has a sensible-looking y value, close to zero. But on iOS 15 runtime, the y value is close to the height of the view. (20px or whatever).

I can't explain why Β―\_(ツ)_/Β―

But I have done an ugly fix to AnimatedAttachmentLabel:

diff --git a/Views/UIKit/AnimatedAttachmentLabel.swift b/Views/UIKit/AnimatedAttachmentLabel.swift
index 91402d9..c2e30fb 100644
--- a/Views/UIKit/AnimatedAttachmentLabel.swift
+++ b/Views/UIKit/AnimatedAttachmentLabel.swift
@@ -28,7 +28,7 @@ final class AnimatedAttachmentLabel: UILabel, EmojiInsertable {
                   let imageBounds = animatedAttachment.imageBounds
             else { return }
 
-            animatedAttachment.imageView.frame = imageBounds
+            animatedAttachment.imageView.frame = CGRect(x: imageBounds.minX, y: (rect.height - imageBounds.height) / 2, width: imageBounds.width, height: imageBounds.height)
             animatedAttachment.imageView.contentMode = .scaleAspectFit
 
             if animatedAttachment.imageView.superview != self {

This change ignores the y-position of the imageBounds, and instead centers the image vertically in the AnimatedAttachmentLabel.

(Note: this isn't a good long-term solution, because I think it will break multi-line labels)

from metatext.

BrandonNolet avatar BrandonNolet commented on June 3, 2024 1

Existing in the iOS 15 final versions on iPhone 12 mini:

imageimage

from metatext.

Kibranoz avatar Kibranoz commented on June 3, 2024 1

Same on iPad 9 image

from metatext.

LeviSnoot avatar LeviSnoot commented on June 3, 2024 1

Any news on this? Still experiencing the same on iOS 15.4.1, iPhone 13 Pro.

from metatext.

ShredderWalnut avatar ShredderWalnut commented on June 3, 2024

Same here.

  • Device: iPhone X
  • OS: iOS 15.0 (19A5340a)
  • App Version: 15.0(4)

IMG_4301

from metatext.

genebean avatar genebean commented on June 3, 2024

Same on iPhone 12 running iOS 15.1.1. I just installed the app and immediately had trouble reading toots because of this.

from metatext.

greyivy avatar greyivy commented on June 3, 2024

This is becoming a major blocker to using this app on instances that rely on emotes to convey important information. As a non-iOS developer, is there any way I can help get this fixed?

from metatext.

prplecake avatar prplecake commented on June 3, 2024

I think I've narrowed it down to this line:

attachment.bounds = CGRect(x: 0, y: lineHeight * -0.25, width: lineHeight, height: lineHeight)

Specifically the y value, I think... but I can't for the life of me figure out a better value, or have yet to find a value that aligns correctly.

Scratch that, messing with that value screws up alignment of custom emojis in posts, which as far as I see are aligned correctly, it's just in account names where they're not.

from metatext.

stramargio avatar stramargio commented on June 3, 2024

πŸ™πŸ» @prplecake

from metatext.

prplecake avatar prplecake commented on June 3, 2024

Confirmed fixed in 1.5.1!

from metatext.

stramargio avatar stramargio commented on June 3, 2024

πŸŽ‰

from metatext.

eai04191 avatar eai04191 commented on June 3, 2024

fixed in 3e93ced πŸ‘

from metatext.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.