JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.9k stars 1.16k forks source link

iOS. Use `nativeScale` instead of `scale` when we pass events to Compose, and create the Canvas for Compose #3316

Open igordmn opened 1 year ago

igordmn commented 1 year ago

We should use value * uiview.nativeScale for:

  1. the draw buffer size in pixels (see MetalContextHandler.kt and SkiaLayer.ios.kt)
  2. the ComposeScene size
  3. the event position sent via scene.sendPointerEvent

Now we use scale. If it is different from nativeScale - it leads to resizing artifacts.

We should use uiview.scale for:

  1. the density of ComposeScene.density (it is used when we use 354.dp in Compose)

To do all that, we need to change public API of skiko as well. One of the solutions:

okushnikov commented 2 weeks ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.