Microcharts
Microcharts copied to clipboard
[Feature] Add support for Pinch to Zoom
This is a consolidation of these two issues:
- #150
- #80
However there is a prerequisite issue:
- #295
The basic idea is that once we have a clip rect properly in place we can use the Skia Sharp canvas object to Translate and Scale a chart. If this transformations are coordinated with a zoom gesture this will give the look and feel of Pinch Gesture and Zooming.
Once I get a little further along with this I will make a pull request. The above works as a proof of concept in that you can pinch to zoom, however, the labels and Y axis do not properly scale. There's also some pixel precision issues with the clip rect.
Todo Items:
- [ ] Resolve discussion points surrounding clipping on edges of chart
- [ ] Add support for panning while zoomed in.
This is functionally complete. There are however a couple issues that need to be debated. I've posted them in: https://github.com/microcharts-dotnet/Microcharts/issues/295#issuecomment-948184864
I have tested this on a number of charts and all seems to work except the issues outlined in my previous comment.
https://user-images.githubusercontent.com/1433852/138197730-1cbe1b02-2610-4dc6-a895-cab46c510dd0.mp4
Impressive work ! I need time to look at this
I'm going to make a few changes to this a bit later. I'm going to have an option to turn on/off pinch to zoom and leave it off by default. When its off I will also disable the cliprect. This will allow backwards compatibility by default, and anyone who enables pinch to zoom can also deal with the clipping changes.