alexvasilkov / GestureViews

ImageView and FrameLayout with gestures control and position animation
Apache License 2.0
2.37k stars 384 forks source link

Contents not rendering outside GestureFrameLayout even if clipping is set to false #166

Closed ParticleCore closed 3 years ago

ParticleCore commented 3 years ago

I have a GestureFrameLayout that is at on an arbitrary position with an arbitrary size (let's say 300dp by 300dp at center of screen) and I'd like to zoom in to its contents and allow them to show outside the GestureFrameLayout itself. I tried setting any clipping I could think of to false (to children, to the gesture layout itself and to any parents above them), but nothing is drawn outside its bounds whenever I zoom or move the contents inside the GestureFrameLayout.

Is it suppose to clip the contents even if the GestureFrameLayout is set to not clip its children? Is there a way to correct this issue?

alexvasilkov commented 3 years ago

I just tested it in LayoutViewerActivity example activity by adding parent FrameLayout with android:clipChildren="false" and using GestureFrameLayout as its child, with size 300dp x 300dp, centered. It works just fine to me, nothing is clipped.

Maybe you need to add android:clipChildren="false" for all parent layouts, I can say little without seeing the code you use.

ParticleCore commented 3 years ago

I just tested in the demo app, it is not showing outside the GestureFrameLayout.

Set this code:

    android:layout_width="300dp"
    android:layout_height="300dp"
    android:clipToPadding="false"
    android:clipChildren="false"

Here:

https://github.com/alexvasilkov/GestureViews/blob/master/sample/src/main/res/layout/layout_viewer_screen.xml#L7-L8

And this is the result:

gif7

The contents of the GestureFrameLayout are not showing outside its bounds.

Note: I don't need to interact outside its bounds, only to show its contents outside its bounds.

ParticleCore commented 3 years ago

Just an explanation for bringing this up is, as you confirmed, this is possible with a FrameLayout and this is the layout the GestureFrameLayout extends from, so to me I would expect for this capacity to be present, but it is not.

I understand if this limitation is intentional or was not considered when developing it, but I thought it would be important to mention it since there are a few scenarios that I needed this functionality to be working.

If you don't think it's worth the effort that is alright, just close the case if that happens to be your conclusion.

alexvasilkov commented 3 years ago

As said you need to set android:clipChildren="false" to the parent view(s) not to the GestureFrameLayout. GestureFrameLayout itself does not clip its children, but its parents are clipping it by default.

In the sample app I'm using "merge" as parent tag, you cannot set android:clipChildren="false" to it. Instead you should either change it to FrameLayout or disable children clipping from code.

I'll close this issue as it is not related to the library.

ParticleCore commented 3 years ago

It does work indeed if I set the GestureViewLayout inside the FrameLayout like you mentioned, thanks for the the explanation. I did not notice it was being merged at first, now it make sense.