Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CALayer: Set the default contentsScale to screen scale, update to match contents #1467

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Adlai-Holler
Copy link
Member

Currently we hack this into ASImageNode but really it applies to any node.

Without this, if you're on a 2.0 screen and you set the content mode of a text to, say, TopLeft, the text will be twice its size i.e. rendered at 1.0, and you can only see the top left quarter of the contents.

Basically, we are currently relying on UIViewContentModeScaleToFill/kCAGravityResize (the default) to apply our contentsScale. This is wrong and bad.

UIView sets contents scale based on the screen, we should do the same thing on our own.

  • Change the default to main screen scale.
  • When a contents image is applied to the layer, match its contentsScale to the contents image.
    • Old behavior was to set the node's contentsScale to the layer's contentScale but this is nonsensical, since the node's contentsScale is a bridged property from the layer! It was a no-op.

This is by no means the perfect state (we will still trample on a user-set value of contentsScale, but that's insanely rare) but it's better, and it's similar to how UIKit handles this.

@nguyenhuy
Copy link
Member

@Adlai-Holler Can you rebase with master to unblock the CI?

@Adlai-Holler
Copy link
Member Author

Sure, done

@TextureGroup TextureGroup deleted a comment Jul 17, 2019
@TextureGroup TextureGroup deleted a comment Jul 17, 2019
@ghost
Copy link

ghost commented Jul 17, 2019

🚫 CI failed with log

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants