NativeScript icon indicating copy to clipboard operation
NativeScript copied to clipboard

feat: clipsToBounds support

Open rigor789 opened this issue 4 years ago • 4 comments
trafficstars

@farfromrefug here's a branch with the clipsToBounds changes - we had to revert them in the release branch here: https://github.com/NativeScript/NativeScript/commit/778540573a2827a9c029e7381b17b8a85104e334

We've seen some issues with this change, some with the borders and some with boxShadow, so we'd like to step back a bit and make sure everything works as expected before we release this.

rigor789 avatar Sep 07 '21 21:09 rigor789

@DimitrisRK you cant use setClipToBounds as it is a rect. It wont work with rounded corners. setClipToOutline is the way to go on api >21. @rigor789 what issue did you see? But yes clipToBounds will clip shadows. Maybe we should disable it by default (better perfs). But then what do we do on iOS?

farfromrefug avatar Oct 10 '21 12:10 farfromrefug

@DimitrisRK you cant use setClipToBounds as it is a rect. It wont work with rounded corners. setClipToOutline is the way to go on api >21. @rigor789 what issue did you see? But yes clipToBounds will clip shadows. Maybe we should disable it by default (better perfs). But then what do we do on iOS?

I'm leaving notes as a feedback regarding this feature.

From my experience at trying to get rid of clipping in android, I have concluded that setting clipping to false for scrollable views will let their children overflow during scrolling. I believe clipping should be true by default for such views (e.g. ListView, RadListView, ScrollView).

CatchABus avatar Oct 22 '21 21:10 CatchABus

@DimitrisRK you cant use setClipToBounds as it is a rect. It wont work with rounded corners. setClipToOutline is the way to go on api >21. @rigor789 what issue did you see? But yes clipToBounds will clip shadows. Maybe we should disable it by default (better perfs). But then what do we do on iOS?

I was wondering why this PR had flaws and It seems Outline has its own limitations.

As of API 33, all Outline shapes support clipping. Prior to API 33, only Outlines that could be represented as a rectangle, circle, or round rect supported clipping.

https://developer.android.com/reference/android/graphics/Outline#canClip()

It seems that setClipToOutline will not clip paths for the time being. :(

CatchABus avatar May 07 '22 16:05 CatchABus

@CatchABus indeed this is why i am using clipping path (if i remember correctly)

farfromrefug avatar May 07 '22 17:05 farfromrefug