AndreiMisiukevich / CardView

CardsView | CarouselView | CoverflowView | CubeView for Xamarin.Forms
MIT License
711 stars 114 forks source link

Zoom WebView #412

Closed Alex-Dobrynin closed 2 years ago

Alex-Dobrynin commented 2 years ago

In my case I have your's carousel view with zoomable webview on android and zoomable scroll view on ios as datatemplates. When user trying to zoom, your's carouselview catches those gestures and swipes to next/previos view

AndreiMisiukevich commented 2 years ago

I presume you are using PinchGestureRecognizer? I'd propose to set IsUserInteractionEnabled = "False" when the pinch is started and set "True" back when it's finished.

Alex-Dobrynin commented 2 years ago

nope, i dont use PinchGestureRecognizer, because android's webview has it's own zoom functionalty as well as ios's scrollview

image for android i fixed this way

AndreiMisiukevich commented 2 years ago

Ah, I see... let me think about it a bit

AndreiMisiukevich commented 2 years ago

Probably the fix should be applied somewhere here: https://github.com/AndreiMisiukevich/CardView/blob/master/PanCardView.iOS/CardsViewRenderer.cs#L167

Can you try to use the pinch gesture for iOS and somehow "pass" zoom to zoomable scroll view?

Unfortunately, now I have pretty limited time :(

AndreiMisiukevich commented 2 years ago

Also, you can try to hacky ways of achieving that

e.g. disable user interaction by setting "IsUserInteractionEnabled=False", add your own PanGestureRecognizer and pass events to the carousel using this method https://github.com/AndreiMisiukevich/CardView/blob/master/PanCardView/CardsView.cs#L587 only when it's needed

e.g. (Zoom started means you should ignore pan)

I know this is a hacky way, but uh... Not sure how to fix that

Alex-Dobrynin commented 2 years ago

will try ios first

Alex-Dobrynin commented 2 years ago

UPD: on ios it works out of box. just need to be fixed on android But i noticed another bug on ios, if CarouselView lays within scrollview and I trying to pan through CarouselView vertically, scrollview does not move

Alex-Dobrynin commented 2 years ago

UPD: Ok, it is not obvious, but I should add PanCardView.iOS.CardsViewRenderer.Preserve(); to AppDelegate to make it work

AndreiMisiukevich commented 2 years ago

UPD: Ok, it is not obvious, but I should add PanCardView.iOS.CardsViewRenderer.Preserve(); to AppDelegate to make it work

It's in the setup section here https://github.com/AndreiMisiukevich/CardView#Setup

This is some xamarin linker bug, unfortunately, can't work around it with the existing architecture approach (without switching to multiplatform project)

Alex-Dobrynin commented 2 years ago

Oh, Yeah, now I see. I'm sorry

AndreiMisiukevich commented 2 years ago

no worries.

if you wish, feel free to submit a PR with this property

Or we can consider this as closed, if you think it's ok now.

AndreiMisiukevich commented 2 years ago

Closing this issue as the workaround was found. Please use it.