Zoomable icon indicating copy to clipboard operation
Zoomable copied to clipboard

Zoom Enabled Does Not Update With State

Open wakaztahir opened this issue 4 years ago • 7 comments

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 avatar Jun 23 '21 06:06 wakaztahir

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

wakaztahir avatar Jun 23 '21 07:06 wakaztahir

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

Tlaster avatar Jun 23 '21 07:06 Tlaster

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

wakaztahir avatar Jun 23 '21 07:06 wakaztahir

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

wakaztahir avatar Jun 25 '21 06:06 wakaztahir

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)

  • Zoom Works
  • Panning Works
  • Zoom Can't Be Disabled With A Button (Changing The State Only Disables Zoom and Panning Stays Enabled)
  • It consumes the touch events (even when disabled afterwards using mutable state , I want touch events when zoom disabled)

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 avatar Jul 06 '21 08:07 wakaztahir

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 avatar Jul 06 '21 09:07 wakaztahir

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

wakaztahir avatar Jul 06 '21 09:07 wakaztahir