Tlaster / Zoomable

Easy zoom in and out with drag support for Jetpack Compose
MIT License
80 stars 6 forks source link

Zoom Enabled Does Not Update With State #10

Open wakaztahir opened 3 years ago

wakaztahir commented 3 years ago

As you can see I have a Box with Surface and a Canvas inside it and panning is not working , zooming is working and my drawing is displaying , I had a previous issue of zoom expanding the surface of canvas over other views which I fixed by clip to bounds modifier you can see on Zoomable

Getting rid of that modifier does not cause panning to work but instead that issue returns , I am not sure if this is an issue with your library or Compose works like this

wakaztahir commented 3 years ago

I also removed Box and Surface , But panning still didn't work on canvas !

Tlaster commented 3 years ago

It might because that Canvas consumes the position changes and Zoomable can not receive these changes, can you share more complete code of it?

wakaztahir commented 3 years ago

Sketcher only consumes the event if zoom is not enabled otherwise returns true in pointerInteropFilter !! tried returning false , doesn't work

wakaztahir commented 3 years ago

Could you please create a canvas and test panning and check why it might be failing ?

wakaztahir commented 3 years ago

Problem 1

OK , I have zoom enabled as a mutable state in my view model , that goes into the zoomable When I have set it to true in the view model , PANNING WORKS but if I set it to false , and set it to true again through a button PANNING does not work

Problem 2

When set to true initially (in view model)

So basically enabled should work always , with the change of state and everything , panning should not consume touch events when zoom is disabled or maybe when panning is disabled

wakaztahir commented 3 years ago

I can send zoomEnabled to true initially whish should solve my panning and zooming problem but setting it false again should disable panning and should not consume touch events so I can draw on canvas

wakaztahir commented 3 years ago

https://user-images.githubusercontent.com/42442700/124575302-b6ce4780-de64-11eb-9b8a-bfe1f31b66f2.mp4

enable (ZoomEnabled) is initially true (to make panning work) Zoom button changes zoom enabled state