Skip to content

Commit

Permalink
[ASImageNode] Enable .clipsToBounds by default (fix .cornerRadius, GI…
Browse files Browse the repository at this point in the history
…Fs overflow). (#466)

* [ASImageNode] Enable .clipsToBounds by default (fix .cornerRadius, GIFs overflow).

We've seen a number of bugs reported over time that .cornerRadius didn't work on
ASNetworkImageNode. This wasn't much of a concern because cornerRadius is very
inefficient anyway, and there are better ways to round corners, but it should
certainly work.

It turns out that clipsToBounds has been off for images, and this ultimately
was behind another issue recently seen wehre decoded GIFs would spill outside
the bounds area to overlap nearby content.

Although there is some risk of behavior change from this, I think the risk
is fairly small, and in most cases it will probably fix behaviors in a way
that doesn't cause problems for the app.

We should consider if this property should be on for all ASDisplayNodes,
but for now it would be a great step to be confident it's on for all
ASImageNodes.

* Update changelog for ImageNode Clipping.
  • Loading branch information
appleguy authored Aug 20, 2017
1 parent 1204737 commit 65fabf4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## master

* Add your own contributions to the next release on the line below this with your name.
- [ASImageNode] Enabled .clipsToBounds by default, fixing the use of .cornerRadius and clipping of GIFs. [Scott Goodson](https://github.com/appleguy) [#466](https://github.com/TextureGroup/Texture/pull/466)
- Fix an issue in layout transition that causes it to unexpectedly use the old layout [Huy Nguyen](https://github.com/nguyenhuy) [#464](https://github.com/TextureGroup/Texture/pull/464)
- Add -[ASDisplayNode detailedLayoutDescription] property to aid debugging. [Adlai Holler](https://github.com/Adlai-Holler) [#476](https://github.com/TextureGroup/Texture/pull/476)
- Fix an issue that causes calculatedLayoutDidChange being called needlessly. [Huy Nguyen](https://github.com/nguyenhuy) [#490](https://github.com/TextureGroup/Texture/pull/490)
Expand Down
3 changes: 2 additions & 1 deletion Source/ASImageNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ - (instancetype)init
self.contentsScale = ASScreenScale();
self.contentMode = UIViewContentModeScaleAspectFill;
self.opaque = NO;

self.clipsToBounds = YES;

// If no backgroundColor is set to the image node and it's a subview of UITableViewCell, UITableView is setting
// the opaque value of all subviews to YES if highlighting / selection is happening and does not set it back to the
// initial value. With setting a explicit backgroundColor we can prevent that change.
Expand Down

0 comments on commit 65fabf4

Please sign in to comment.