https://kotlinlang.org logo
Title
c

Cody Mikol

06/13/2022, 10:50 PM
Hey, I'm trying to use
drawBehind
in conjunction with
drawLine
to draw lines at a fixed distance to the right of the window. I've noticed that this distance is different between Mac and Linux. Is this a bug, or is there a more precise way to set this distance?
k

Kirill Grouchnikov

06/14/2022, 12:15 AM
Are you accounting for the screen density?
c

Cody Mikol

06/14/2022, 1:21 AM
I am not sure how to do that. the offset x available to drawLine is a float, what would be the correct way to account for screen density?
c

Chris Sinco [G]

06/14/2022, 1:41 AM
You'll have to save density from LocalDensity.current outside the Canvas or draw context and pass in as a multiplier to the PX
c

Cody Mikol

06/14/2022, 1:42 AM
ok, thank you very much, I'll give that a shot 🙂