exyte / Macaw

Powerful and easy-to-use vector graphics Swift library with SVG support
MIT License
6.01k stars 553 forks source link

contentScaleFactor not working 0.9.7 compared with 0.9.6 #723

Open petermauger opened 4 years ago

petermauger commented 4 years ago

We put together a SwiftUI proof-of-concept using Macaw 0.9.6 in XCode11 using a UIScrollView with a UIViewRepresentable wrapper and a MacawView as the only subview in the scrollview. We're now using XCode12 Beta which will not build with Macaw 0.9.6.

I integrated our PoC work into the project and noticed that there was a significant degradation in the quality of the rendered image. Previously we had adjusted that (for different zoom levels) by altering MacawView.contentScaleFactor. With Macaw 0.9.7 this value no longer has any effect on the rendering process leaving the image heavily pixelated even at low zoom levels.

I put together a test involving porting our project back to XCode 11, running the app on an emulator with 0.9.6 and then updating to 0.9.7 without any code changes (other than to the podfile) and running on a second emulator. The difference in quality is significant and can be seen in the attached image.

Screen Shot 2020-08-03 at 10 56 05 am

ystrot commented 4 years ago

Hi Peter,

Manual adjustment of contentScaleFactor doesn't look correct. There is MacawView.zoom property which you can use for zooming. If you want some custom scaling then you probably need to change place of the root element instead of image scaling (which will be pixelated).

If you'll be able to built a simple sample of what you're trying to achieve then I can help you fixing your code.

GDGapps commented 4 years ago

Hello @ystrot ,

when I use the MacawView.zoom property, the image still gets pixelated when I pinch. Do you know how can I solve the issue?

Thanks

ystrot commented 4 years ago

Could you create a sample project demonstrating your issue?

GDGapps commented 4 years ago

I only enabled the zoom. Maybe it's a problem with the SVG file? Thanks macawMap.zip